如何在Apache Tomcat中禁用SSLv3支持?


20

我试图将我的Apache Tomcat服务器重新配置为仅使用TLSv1。但是,它仍然使用某些浏览器退回到SSLv3。

我使用以下设置设置了<connector>标记:

<Connector ...
       enableLookups="true" disableUploadTimeout="true"
       acceptCount="100"  maxThreads="200"
       scheme="https" secure="true" SSLEnabled="true"
       clientAuth="false" sslProtocol="TLS" ciphers="TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA" sslEnabledProtocols="TLSv1" />

我是否缺少配置设置或存在我不应该拥有的礼物?


v3有什么问题?我认为v1存在安全问题。
mdpc

8
@mdpc POODLE影响SSLv3。
CoverosGene

2
Tomcat版本?JDK版本?在最新版本中,默认情况下,sslProtocol为TLS。
Xavier Lucas

2
rmeisen:答案将因您的Tomcat和Java版本以及使用JSSE和AJP而异。差异与sslProtocols=TLSv1经文一样微妙sslProtocol="TLS"(请注意s?)。指定Tomcat和Java版本将使您免于精神错乱。
Stefan Lasiewski 2014年

Answers:


12

取决于Tomcat 5和版本6的版本,SSLEnabled =“ true”可能无法正常运行,因为它是在中间版本中添加的。为了克服这个问题,您只需要编辑以下内容:sslProtocols = TLS到:sslProtocols =“ TLSv1,TLSv1.1,TLSv1.2”

看起来很奇怪,但是即使它说的是TLS,它也包含SSL 3。

这将其固定在我们的Tomcat 5.5.20和Tomcat 6实例上。格雷格

我相信您需要做的是:

Jboss:

<Connector protocol="HTTP/1.1" SSLEnabled="true" 
       enableLookups="true" disableUploadTimeout="true"
       acceptCount="100"  maxThreads="200"
       scheme="https" secure="true" clientAuth="false" 
       keystoreFile="${jboss.server.home.dir}/conf/keystore.jks"
       keystorePass="rmi+ssl"
       sslProtocols = "TLSv1,TLSv1.1,TLSv1.2" />

不确定密码套件的定义,但是sslprotocols应该只设置为TLSv1,TLSv1.1,TLSv1.2

根据您的tomcat版本,它会有所不同,其他潜在的解决方案:

Tomcat 5和6

<Connector...
   enableLookups="true" disableUploadTimeout="true"
   acceptCount="100"  maxThreads="200" SSLEnabled="true" scheme="https" secure="true"
   clientAuth="false" sslEnabledProtocols = "TLSv1,TLSv1.1,TLSv1.2" />

**在基于RHEL5的发行版中,以下内容适用于Tomcat 6.0.38之前的 Tomcat 6版本**

请注意,TLSv1.1,TLSv1.2Java 7支持此功能,而不是Java 6支持。将这些指令添加到运行Java 6的服务器是无害的,但不会启用TLSv1.1和TLSv1.2。

<Connector...
   enableLookups="true" disableUploadTimeout="true"
   acceptCount="100"  maxThreads="200" SSLEnabled="true" scheme="https" secure="true"
   clientAuth="false" sslProtocols = "TLSv1,TLSv1.1,TLSv1.2" />

雄猫> = 7

<Connector...
       enableLookups="true" disableUploadTimeout="true"
       acceptCount="100"  maxThreads="200" SSLEnabled="true" scheme="https" secure="true"
       clientAuth="false" sslProtocols = "TLSv1,TLSv1.1,TLSv1.2" />

Tomcat APR连接器

<Connector...
               maxThreads="200"
               enableLookups="true" disableUploadTimeout="true"
               acceptCount="100" scheme="https" secure="true"
               SSLEnabled="true" 
               SSLProtocol="TLSv1"
               SSLCertificateFile="${catalina.base}/conf/localhost.crt"
               SSLCertificateKeyFile="${catalina.base}/conf/localhost.key" />

为了满足您上面的连接器规格,对以上内容进行了更改。资料来源:https : //access.redhat.com/solutions/1232233


1
仅供参考,sslEnabledProtocols在Tomcat 6上对我们不起作用 sslProtocols = "TLSv1,...."
Stefan Lasiewski 2014年

4

我有一个类似的用例,它使Tomcat 7严格只使用TLSv1.2,而不回退到TLSv1.1或SSLv3等早期的SSL协议。

我正在使用:C:\ apache-tomcat-7.0.64-64bit和C:\ Java64 \ jdk1.8.0_60。

按照以下说明进行操作:https : //tomcat.apache.org/tomcat-7.0-doc/security-howto.html。Tomcat相对容易设置SSL支持。

从许多参考资料中,我测试了许多组合,最后我发现1将强制Tomcat 7仅接受TLSv1.2。需要触摸2个地方:

1)在C:\ apache-tomcat-7.0.64-64bit \ conf \ server.xml中

<Connector port="8443" 
 protocol="org.apache.coyote.http11.Http11Protocol"
 maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
 keystoreFile="ssl/.keystore" keystorePass="changeit"
 clientAuth="false" sslProtocol="SSL" sslEnabledProtocols="TLSv1.2" />

哪里

keystoreFile =本地自签名信任库

org.apache.coyote.http11.Http11Protocol = JSSE BIO实现。

我们不使用org.apache.coyote.http11.Http11AprProtocol,因为它由openssl驱动。基本的openssl将回退以支持较早的SSL协议。

2)启动Tomcat时,启用以下环境参数。

set JAVA_HOME=C:\Java64\jdk1.8.0_60
set PATH=%PATH%;C:\Java64\jdk1.8.0_60\bin
set CATALINA_HOME=C:\apache-tomcat-7.0.64-64bit
set JAVA_OPTS=-Djdk.tls.client.protocols="TLSv1.2" -Dsun.security.ssl.allowUnsafeRenegotiation=false -Dhttps.protocols="TLSv1.2"

需要JAVA_OPTS限制,否则Tomcat(由Java8支持)将回退以支持较早的SSL协议。

启动Tomcat C:\apache-tomcat-7.0.64-64bit\bin\startup.bat

我们可以看到JAVA_OPTS出现在Tomcat启动日志中。

Oct 16, 2015 4:10:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.client.protocols=TLSv1.2
Oct 16, 2015 4:10:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dsun.security.ssl.allowUnsafeRenegotiation=false
Oct 16, 2015 4:10:17 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dhttps.protocols=TLSv1.2

然后,我们可以使用openssl命令来验证我们的设置。首先使用TLSv1.1协议连接localhost:8443。Tomcat拒绝使用服务器证书答复。

C:\OpenSSL-Win32\bin>openssl s_client -connect localhost:8443 -tls1_1
Loading 'screen' into random state - done
CONNECTED(000001C0)
5372:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:.\ssl\s3_pkt.c:362:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 0 bytes

使用TLSv1.2协议连接localhost:8443,Tomcat会使用证书回复ServerHello:

C:\OpenSSL-Win32\bin>openssl s_client -connect localhost:8443 -tls1_2
Loading 'screen' into random state - done
CONNECTED(000001C0)
depth=1 C = US, ST = Washington, L = Seattle, O = getaCert - www.getacert.com
verify error:num=19:self signed certificate in certificate chain
---
Certificate chain
0 s:/C=SG/ST=SG/L=Singapore/O=Xxxx/OU=Development/CN=Myself
   i:/C=US/ST=Washington/L=Seattle/O=getaCert - www.getacert.com
1 s:/C=US/ST=Washington/L=Seattle/O=getaCert - www.getacert.com
   i:/C=US/ST=Washington/L=Seattle/O=getaCert - www.getacert.com
---
Server certificate
-----BEGIN CERTIFICATE-----
(ignored)
-----END CERTIFICATE-----
subject=/C=SG/ST=SG/L=Singapore/O=Xxxx/OU=Development/CN=Myself
issuer=/C=US/ST=Washington/L=Seattle/O=getaCert - www.getacert.com
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 2367 bytes and written 443 bytes

这证明Tomcat现在仅严格响应TLSv1.2请求。


非常好的和彻底的答案!荣誉!
珍妮D说恢复莫妮卡2015年

我发现这JAVA_OPTS=-Djdk.tls.client.protocols="TLSv1.2不是必需的(Tomcat 8.0.29,Java 1.8.0_74)。这里也没有提及:wiki.apache.org/tomcat/Security/POODLE
Paul


0

在Tomcat 6.0.41中,您将需要使用阻塞连接器,因为NIO会忽略这些设置。

http://wiki.apache.org/tomcat/Security/POODLE

http://mail-archives.apache.org/mod_mbox/tomcat-users/201410.mbox/%3C5440F1C6.3040205@apache.org%3E

连接器端口=“ 443”协议=“ org.apache.coyote.http11.Http11Protocol” maxThreads =“ 200” scheme =“ https” secure =“ true” SSLEnabled =“ true” clientAuth =“ false”
keystoreFile =“ tomcat.jks “ keystorePass =” changeit“ sslEnabledProtocols =” TLSv1,TLSv1.1,TLSv1.2“ />


0

在Tomcat 5.5中,您应该使用未记录的参数

protocols="TLSv1"

限制使用此协议版本。


0

要在server.xml中的Jboss 4.0.3 SP1(带有Java 1.5的Tomcat 5.5)中禁用SSL 3(POODLE),请更改您的代码。

<Connector port="443" address="${jboss.bind.address}" maxThreads="100" strategy="ms" maxHttpHeaderSize="8192" emptySessionPath="true" scheme="https" secure="true" clientAuth="false" keystoreFile="${jboss.server.home.dir}/conf/eCP.keystore" keystorePass="password" sslProtocol="TLS" protocols="TLSv1,TLSv1.1,TLSv1.2" />


0

对于较新的Tomcat,请使用sslProtocolssslEnabledProtocols组合,如下所示:

<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocols="TLSv1,TLSv1.1,TLSv1.2" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" SSLEnabled="true" URIEncoding="UTF-8" keystorePass=""/>


0

首先,作为@iviorel说,它不是sslProtocols,它是sslProtocol。(为什么他的答案很低?)

JSSE
对我来说,在Tomcat 7和Java 7上,sslProtocol以下配置不起作用:

<Connector SSLEnabled="true" clientAuth="false" 
keyAlias="keyalias" keystoreFile="keystore" keystorePass="changeit" 
maxThreads="150" port="443" protocol="org.apache.coyote.http11.Http11Protocol" 
scheme="https" secure="true" sslProtocol="TLSv1,TLSv1.1,TLSv1.2" />

它说:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-443"]
java.io.IOException: TLSv1,TLSv1.1,TLSv1.2 SSLContext not available
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:465)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:187)
    at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:398)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:646)
    ...
Caused by: java.security.NoSuchAlgorithmException: TLSv1,TLSv1.1,TLSv1.2 SSLContext not available
    at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
    at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSSLContext(JSSESocketFactory.java:478)
    at org.apache.tomcat.util.net.jsse.JSSESocketFactory.init(JSSESocketFactory.java:439)
    ... 19 more

但是以下工作正常:

<Connector SSLEnabled="true" clientAuth="false" 
keyAlias="keyalias" keystoreFile="keystore" keystorePass="changeit" 
maxThreads="150" port="443" protocol="org.apache.coyote.http11.Http11Protocol" 
scheme="https" secure="true" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" />

APR
要禁用SSL v3,并启用TLSv1协议,请执行以下操作:

SSLProtocol="TLSv1"

要启用TLSv1,TLSv1.1,TLSv1.2协议,请执行以下操作:

SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"

要么:

SSLProtocol="all"

注意:“ TLSv1.1”,“ TLSv1.2”值需要Tomcat Native 1.1.32和支持它的Tomcat版本。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.