简体   繁体   English

与Tomcat 7的Diffie-Hellman公钥错误

[英]Diffie-Hellman public key error with Tomcat 7

I successfully set up two Ubuntu machines with Tomcat and SSL certificates. 我成功地使用Tomcat和SSL证书设置了两台Ubuntu机器。 I followed exactly the same procedure with Centos 6, but I'm getting this when I'm trying to connect to the Server (using Opera): 我使用Centos 6完全遵循相同的程序,但是当我尝试连接到服务器(使用Opera)时,我得到了这个:

Server has a weak, ephemeral Diffie-Hellman public key 服务器有一个弱的,短暂的Diffie-Hellman公钥

The connector is the following, and there are no errors in catalina.log: 连接器如下,catalina.log中没有错误:

<Connector port="some port number"  
           protocol="org.apache.coyote.http11.Http11Protocol" 
           SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS"
           keystoreFile="path to jks"
           keystoreType="JKS"
           keystorePass="mypass1"
           keyPass="mypass2"  /> 

With Firefox, I get the untrusted communication error. 使用Firefox,我得到了不受信任的通信错误。

For me it worked after adding a list of allowed ciphers to the Tomcat configuration in conf/server.xml to disable the weak Diffie-Hellman ciphers: 对我来说,在将一个允许的密码列表添加到conf / server.xml中的T​​omcat配置以禁用弱Diffie-Hellman密码之后,它才起作用:

    <Connector
        ...
        ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA"
        ...

This is due to the fact that new browser versions have started to either issue warning/errors when accessing web sites which are configured with weak DH ciphers for SSL. 这是因为新的浏览器版本在访问配置了SSL的弱DH密码的网站时已经开始发出警告/错误。 For more information about issue follow below links 有关问题的更多信息,请参阅以下链接

https://weakdh.org https://weakdh.org

logjam issue 僵局问题

To fix this either you can find a way around this at browser side or server side. 要解决此问题,您可以在浏览器端或服务器端找到解决此问题的方法。 Servers side is the best as it will fix the issue for all users , if they are accessing server from different browsers/locations. 服务器端是最好的,因为它将解决所有用户的问题,如果他们从不同的浏览器/位置访问服务器。

Fix the issue we have to make sure our server (in this case tomcat) use strong ciphers for SSL. 修复我们必须确保我们的服务器(在本例中为tomcat)使用强密码进行SSL的问题。

In tomcat, there are two different implementations of SSL. 在tomcat中,有两种不同的SSL实现。 Defautl is JSSE implementation provided as part of the Java runtime. Defautl是作为Java运行时的一部分提供的JSSE实现。 Other being APR implementation, which uses the OpenSSL engine by default. 其他是APR实现,默认情况下使用OpenSSL引擎。

JSSE since it's dependent on the Java runtime, we have to first find out which Java version we are using with tomcat. JSSE因为它依赖于Java运行时,我们必须首先找出我们使用tomcat的Java版本。 Tomcat 7 supports java 1.6 upwards. Tomcat 7支持java 1.6以上版本。 Then we have to find the respective cipher suites supported by relevant java version of JSSE. 然后我们必须找到相关java版JSSE支持的相应密码套件。 Weak ones are which which has ' DHE ', so pick ones which does not contain ' DHE '. 弱的是哪个有' DHE ',所以选择那些不包含' DHE '的。 Few of stronger suites for java 1.6 JSSE is listed below. 下面列出了几个更强大的java 1.6 JSSE套件。

TLS_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_ECDH_ECDSA_WITH_RC4_128_SHA
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDH_RSA_WITH_RC4_128_SHA
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_RSA_WITH_RC4_128_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDH_ECDSA_WITH_NULL_SHA
TLS_ECDH_RSA_WITH_NULL_SHA
TLS_ECDHE_ECDSA_WITH_NULL_SHA
TLS_ECDHE_RSA_WITH_NULL_SHA
...

Compile a list of strong cipher suits and add it to the connector ciphers in conf/server.xml in your tomcat 编译强密码套件列表,并将其添加到tomcat中conf / server.xml中的连接器密码

<Connector
...
ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_ECDH_ECDSA_WITH_RC4_128_SHA,TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDH_RSA_WITH_RC4_128_SHA,TLS_ECDH_RSA_WITH_AES_128_CBC_SHA,TLS_ECDH_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_RC4_128_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,TLS_ECDH_ECDSA_WITH_NULL_SHA,TLS_ECDH_RSA_WITH_NULL_SHA,TLS_ECDHE_ECDSA_WITH_NULL_SHA,TLS_ECDHE_RSA_WITH_NULL_SHA"
...
/>

Restart the server and error/warning should go away. 重新启动服务器,错误/警告应该消失。 Remember if Java version is different copy/pasting above might not work. 请记住,如果Java版本不同,上面的复制/粘贴可能不起作用。 So refer to correct version and supported cipher suites. 因此,请参阅正确的版本和支持的密码套件。

Note: To be able to use the 256 bit AES Ciphers, it is necessary to install the JCE Unlimited Strength Jurisdiction Policy Files 注意:为了能够使用256位AES密码,必须安装JCE Unlimited Strength Jurisdiction Policy Files

If Tomcat is configured to use APR instead of JSSE, above configuration will not work. 如果Tomcat配置为使用APR而不是JSSE,则上述配置将不起作用。 You can enable strong cipher suites by following tomcat ssl configuration guide for APR and logjam admin guide . 您可以按照适用于APR和logjam管理指南的tomcat ssl配置指南启用强密码套件。

It works with Google Chrome ver.44 and Thanks to Jason Scroggins for suggesting: 它适用于Google Chrome ver.44,感谢Jason Scroggins建议:

  1. In a new tab, type or paste about:config in the address bar and press Enter. 在新选项卡中,在地址栏中键入或粘贴about:config ,然后按Enter键。 Click the button promising to be careful. 点击按钮承诺要小心。
  2. In the search box above the list, type or paste dhe and pause while the list is filtered. 在列表上方的搜索框中,键入或粘贴dhe并在筛选列表时暂停。
  3. Double-click the security.ssl3.dhe_rsa_aes_128_sha preference to switch it from true to false (disable Firefox from using this cipher). 双击security.ssl3.dhe_rsa_aes_128_sha首选项将其从true切换为false(禁用Firefox使用此密码)。
  4. Double-click the security.ssl3.dhe_rsa_aes_256_sha preference to switch it from true to false (disable Firefox from using this cipher). 双击security.ssl3.dhe_rsa_aes_256_sha首选项将其从true切换为false(禁用Firefox使用此密码)。

Add this into the server.xml file and restart the server 将其添加到server.xml文件中并重新启动服务器

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
       maxThreads="150" scheme="https" secure="true"
       keystoreFile="keystorePath"
       keystorePass="keystorepass"
       ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA"
       clientAuth="false" sslProtocol="TLS"/>

Try to browse with https://localhost:8443 尝试使用https:// localhost:8443进行浏览

For me,It was the issue of java version being used by tomcat. 对我来说,这是tomcat使用的java版本的问题。 I changed the version from JDK 6 to JDK 1.7_080 and the error vanished. 我将版本从JDK 6更改为JDK 1.7_080,错误消失了。

When I said I changed the JAVA version,I meant I modified the environment variable "JAVA_HOME". 当我说我更改了JAVA版本时,我的意思是我修改了环境变量“JAVA_HOME”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TOMCAT 6 SSL错误:别名没有标识密钥条目 - TOMCAT 6 SSL Error: Alias name does not identify a key entry TOMCAT SSL错误:别名不识别键条目 - TOMCAT SSL Error: Alias name does not identify a key entry 如何使用异常diffie-hellmen算法为服务器生成证书或密钥库 - How to generate certificate or key store for server using annoymous diffie-hellmen algorithm Tomcat安全密钥警告 - Tomcat security key warnings Javamelody与tomcat的集成,/公共服务器上的/ monitoring链接 - Javamelody integration with tomcat, /monitoring link on the public server 公共子网中的 AWS Apache 和私有子网中的 Tomcat - AWS Apache in Public and Tomcat in Private Subnets 如何阻止对tomcat和Solr接口的公共访问 - How to block public access to tomcat and solr interfaces 错误:别名(null)无法在Tomcat中实施SSL期间标识密钥条目 - Error: Alias name [null] does not identify a key entry during implementing SSL in Tomcat Tomcat + OpenSSL符号查找错误未定义符号EC_KEY_new_by_curve_name - Tomcat + OpenSSL symbol lookup error undefined symbol EC_KEY_new_by_curve_name 在 Tomcat/Spring Boot 上配置 SSL(“Could not find key store classpath:keystore.jks”错误) - Configuring SSL on Tomcat/Spring Boot ("Could not find key store classpath:keystore.jks" error)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM