我正在尝试为 tomcat 8 配置 SSL(https) 并已完成以下步骤但仍然无法正常工作
1) 使用创建 keystore 文件
keytool -genkey -alias myservername -keyalg RSA
2) 生成如下CSR
keytool -certreq -alias myservername -file C:\tomcat_ssl\local_machine\test.csr -keystore C:\tomcat_ssl\local_machine\test.keystore
3) 然后我们生成了证书,然后如下导入链证书和证书
keytool -import -alias root -keystore C:\tomcat_ssl\local_machine\test.keystore -trustcacerts -file C:\tomcat_ssl\local_machine\srv_chain.cer
keytool -import -alias myservername -keystore C:\tomcat_ssl\local_machine\test.keystore -file C:\tomcat_ssl\local_machine\srv_main.cer
4)最后在tomcat server.xml中做了如下修改
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="C:\tomcat_ssl\local_machine\test.keystore" keystorePass="123" keystoreAlias="myservername"/>
重新启动 tomcat,它不工作并显示在屏幕下方
在 tomcat 日志中,它没有显示任何错误,而且我还尝试了其他选项,例如保持 cipher
标记连接、Enabled TLS 1,2,3
、更改 https 端口等无济于事。
我还测试了 https 端口 443,当我 netstat 时它显示为正在监听。知道为什么这不起作用
添加tomcat开启ssl调试后的日志
http-nio-443-exec-5, fatal error: 10: General SSLEngine problem
javax.net.ssl.SSLHandshakeException: SSLv2Hello is disabled
http-nio-443-exec-5, SEND TLSv1.2 ALERT: fatal, description = unexpected_message
http-nio-443-exec-5, WRITE: TLSv1.2 Alert, length = 2
http-nio-443-exec-5, fatal: engine already closed. Rethrowing javax.net.ssl.SSLHandshakeException: SSLv2Hello is disabled
http-nio-443-exec-5, called closeOutbound()
http-nio-443-exec-5, closeOutboundInternal()
[Raw write]: length = 7
最佳答案
由于您使用的是 java 8,因此 default将 TLS 1.2
。
通过查看您的屏幕截图,您的 IE 11 中未启用客户端 TLS。默认情况下 IE 11已启用 SSL 3.0、TLS 1.0、1.1、1.2
。
如果您看到 protocols矩阵,你会明白为什么连接不成功。
因此,请更新您的 IE 11 SSL TLS 设置或尝试使用其他浏览器进行验证。
关于java - SSL 不适用于 Tomcat 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45129667/