简体   繁体   English

在 Tomcat 8 上配置 SSL 和连接超时

[英]Configured SSL on Tomcat 8 and Connection Times Out

I setup a keystore and got a SSL cert from openssl.com.我设置了一个密钥库并从 openssl.com 获得了 SSL 证书。 The exact steps I followed are here: https://drive.google.com/file/d/0B6PUGo7cBLcDTzdkc0pzT2pTMk0/view?usp=sharing我遵循的确切步骤在这里: https : //drive.google.com/file/d/0B6PUGo7cBLcDTzdkc0pzT2pTMk0/view?usp=sharing

Unfortunately even after following their instructions for tomcat exactly and working with customer support my https connection times out.不幸的是,即使完全按照他们的 tomcat 说明并与客户支持合作,我的 https 连接也会超时。

It seems like tomcat is up and running, listening on port 443, but I don't know how to debug deeper.貌似tomcat已经启动并运行了,监听443端口,但是不知道怎么调试更深。 Http requests are served just fine, so I know tomcat itself is working just fine. Http 请求服务得很好,所以我知道 tomcat 本身工作得很好。

[ec2-user@ip- logs]$ sudo netstat -tunlp | grep 443 
tcp6       0      0 :::443                  :::*                    LISTEN      19407/java

[ec2-user@ip- logs]$ ps -ef | grep java 
root     19407     1  1 23:03 pts/0    00:00:06 /usr/java/jre1.8.0_60//bin/java
-Djava.util.logging.config.file=/usr/apache-tomcat-8.0.26//conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/apache-tomcat-8.0.26//endorsed -classpath /usr/apache-tomcat-8.0.26//bin/bootstrap.jar:/usr/apache-tomcat-8.0.26//bin/tomcat-juli.jar -Dcatalina.base=/usr/apache-tomcat-8.0.26/ -Dcatalina.home=/usr/apache-tomcat-8.0.26/ -Djava.io.tmpdir=/usr/apache-tomcat-8.0.26//temp org.apache.catalina.startup.Bootstrap start ec2-user 19449 18021  0 23:13 pts/0    00:00:00 grep --color=auto java

My connector is configured as:我的连接器配置为:

<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" KeystoreFile="/home/ec2-user/.keystore" KeystorePass="password" />

Please help!请帮忙!

When I configure tomcat, if there's a delay before I see any response, it is almost always because the PORT is blocked for some reason. 当我配置tomcat时,如果在看到任何响应之前有延迟,则几乎总是因为PORT由于某种原因被阻止。 Are you positive port 443 is open through the firewall (assuming this is being done on an external server)? 你是肯定的端口443是通过防火墙打开的(假设这是在外部服务器上完成的)?

If your standard port works fine but 443 just sits and spins for a period of time before failing, I'd put my money on a blocked port. 如果您的标准端口工作正常,但443只是在失败前坐下并旋转一段时间,我会把钱放在一个被阻塞的端口上。

First ensure the 8443 is open,443 is the port reserved for https,you can use it for tomcat,but I prefer to use 8443 or another port different from 443 to avoid conflict with httpd https. 首先确保8443是开放的,443是为https保留的端口,你可以将它用于tomcat,但我更喜欢使用8443或不同于443的其他端口以避免与httpd https冲突。 For testing from outside 从外面进行测试

telnet yourserver 8443

Must connect,if not check the firewall. 必须连接,如果没有检查防火墙。 Then check permission of your certificates,pem or keystore(depend from your configuration) must be readable from group or user which run tomcat(on debian is tomcat8,on fedora simply tomcat). 然后检查你的证书的权限,pem或keystore(取决于你的配置)必须是可以从运行tomcat的组或用户读取的(在debian上是tomcat8,在fedora上只是tomcat)。

For example,this is my configuration of /etc/tomcat/server.xml 例如,这是我的/etc/tomcat/server.xml配置

 <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
    <Connector
           protocol="org.apache.coyote.http11.Http11NioProtocol"
           port="8443" maxThreads="200"
           scheme="https" secure="true" SSLEnabled="true"
           keystoreFile="/etc/tomcat/keystore" keystorePass="ooops"
           clientAuth="false" sslProtocol="TLS"/>

The keystore perms 密钥库烫发

ls -lh /etc/tomcat/keystore 
-r--r-----. 1 tomcat tomcat 2,6K 20 dic 01.06 /etc/tomcat/keystore

The port 8443 is open,and I can connect without problem 端口8443是开放的,我可以毫无问题地连接

Would you mind sharing how you created the keystore?您介意分享您是如何创建密钥库的吗? I have the same timeout problem except port 443 is open and if I create a self-signed store it works (with the warning but it works) meaning there is a problem in the keystore which I generate from the CRT file provided by sectigo.我有同样的超时问题,除了端口 443 是打开的,如果我创建一个自签名存储它可以工作(有警告但它可以工作),这意味着我从 sectigo 提供的 CRT 文件生成的密钥库中存在问题。 I appreciate your help since I can感谢您的帮助,因为我可以

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM