Apache 作为代理:如何在下游配置 TLS?

问题描述 投票:0回答:2

我们希望使用 Apache2 (v2.4.51) 作为(反向)代理来访问下游服务器(运行 Tomcat)。 Tomcat 配置为仅接受 TLS v1.2 和一组非常有限的密码(这是不可协商的)。

在日志中,我发现我们的 Apache 尝试使用 TLS v1.3 打开与 Tomcat 的连接,这会导致下游服务器立即终止连接,并且不会发生进一步的通信。

如何配置 Apache 服务器以在传出/下游连接上使用特定的 TLS 版本和密码?我发现的一切都是重新的。到目前为止,Apache TLS 配置处理的是“前端”端,即 Apache 接收和接受的内容。但就我而言,我需要调整后端,即 Apache 在转发请求时使用的内容。 如何/在哪里可以配置它?

编辑:同时我意识到术语“上游”和“下游”并不总是一致使用 - 所以以防万一:这里的“下游”我指的是连接(2),如下所示:

{浏览器/互联网} --(1)--> [Apache 反向代理] --(2)--> [Tomcat 应用服务器]。

编辑2:在Tomcat的日志(catalina.out)中,我不断收到以下异常,这似乎表明它是使用TLS v1.3(它无法处理)解决的:

Oct 06, 2022 5:22:06 PM org.apache.tomcat.util.net.NioEndpoint setSocketOptions SEVERE: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) at sun.security.ssl.ServerHandshakeContext.<init>(ServerHandshakeContext.java:62) at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220) at sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:97) at org.apache.tomcat.util.net.SecureNioChannel.reset(SecureNioChannel.java:89) at org.apache.tomcat.util.net.SecureNioChannel.<init>(SecureNioChannel.java:71) at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:666) at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:808) at java.lang.Thread.run(Thread.java:750) javax.net.ssl|FINE|B5|http-nio-8443-Acceptor-0|2022-10-06 17:22:07.539 CEST|HandshakeContext.java:304|No available cipher suite for TLS13 javax.net.ssl|SEVERE|B5|http-nio-8443-Acceptor-0|2022-10-06 17:22:07.540 CEST|TransportContext.java:316|Fatal (HANDSHAKE_FAILURE): Couldn't kickstart handshaking ( "throwable" : { javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate) at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) at sun.security.ssl.ServerHandshakeContext.<init>(ServerHandshakeContext.java:62) at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220) at sun.security.ssl.SSLEngineImpl.beginHandshake(SSLEngineImpl.java:97) at org.apache.tomcat.util.net.SecureNioChannel.reset(SecureNioChannel.java:89) at org.apache.tomcat.util.net.SecureNioChannel.<init>(SecureNioChannel.java:71) at org.apache.tomcat.util.net.NioEndpoint.setSocketOptions(NioEndpoint.java:666) at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:808) at java.lang.Thread.run(Thread.java:750)}

编辑 3:我的 
/etc/apache2/conf.d/proxy.conf

文件现在显示为:

Listen 443

<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile -name-removed-
    SSLProxyEngine On
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    SSLProxyMachineCertificateFile -name-removed-
    ProxyPass /foobar https://-name-removed-:8443/foobar
    ProxyPassReverse /foobar https://-name-removed-:8443/foobar

    SSLProxyProtocol +TLSv1.2
    
    <Proxy "*">
        Require all granted
        SSLProxyProtocol +TLSv1.2
    </Proxy>
    LogLevel debug
    ErrorLog "-name-removed-"
</VirtualHost>

注意:“foobar”和“-name-removed-”代表我出于隐私原因替换的值。

编辑4: nmap 响应是:

# nmap -sV --script ssl-enum-ciphers -p 8443 127.0.0.1 Starting Nmap 7.70 ( https://nmap.org ) at 2022-10-10 16:12 CEST Nmap scan report for localhost (127.0.0.1) Host is up (0.00011s latency). PORT STATE SERVICE VERSION 8443/tcp open tcpwrapped Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 3.67 seconds #

这告诉我什么?

apache
2个回答
2
投票
SSLProxyProtocol

SSLProxyCipherSuite
指令将 Apache HTTPD 配置为对后端连接使用相同的协议和密码。
如何使用nmap:

nmap -sV --script ssl-enum-ciphers -p <TLS Port number> <TLS host>



0
投票

© www.soinside.com 2019 - 2024. All rights reserved.