我有2份由CA签署的证书。我希望使用这些证书在tomcat上启用ssl。
我运行了以下命令来创建jks文件,并将证书导入到jks文件中。
1. keytool -genkey -alias bmark.com -keyalg RSA -keystore keystore.jks
2. keytool -import -alias root -keystore keystore.jks -trustcacerts -file b32dasd75493.crt
3. keytool -import -alias intermed -keystore keystore.jks -trustcacerts -file sf_bundle-g2-g1.crt并在tomcat的server.xml中启用https。
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="/Users/test/Desktop/keystore.jks" keystorePass="changeme"/>启动tomcat并在chrome中打开url https://bmark.com:8080,但是它声称CA签名的SSL证书是不可信的,它声称它是自签名的。除了这些我还需要其他文件吗?我怎样才能解决这个问题?
发布于 2020-01-26 22:39:15
要检查CA响应是否正确安装,请运行:
keytool -list -keystore /Users/test/Desktop/keystore.jks -alias bmark.com -v它应该显示您的证书链从叶到根。
在连接器定义中,您没有指定密钥别名,因此使用了找到的第一个证书。改为:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/Users/test/Desktop/keystore.jks"
keystorePass="changeme"
keyAlias="bmark.com" />或者,如果您使用Tomcat8.5(您不应该使用使用Tomcat8.0),切换到新的SSL配置:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" scheme="https" secure="true" SSLEnabled="true">
<SSLHostConfig protocols="TLS">
<Certificate certificateKeystoreFile="/Users/test/Desktop/keystore.jks"
certificateKeystorePassword="changeme"
certificateKeyAlias="bmark.com" />
</SSLHostConfig>
</Connector>编辑:要安装所有三个证书,只需要一个包含证书和中间层的文件,以便从茎到根运行:
keytool -importcert -keystore /Users/test/Desktop/keystore.jks\
-alias bmark.com -file <chain_file> -trustcacerts或者,您可以从根插入到茎。
https://serverfault.com/questions/1000405
复制相似问题