如何在Tomcat上续订ssl证书?

问题描述 投票:0回答:2

关于go-daddy文档:

https://www.godaddy.com/help/tomcat-4x5x6x-renew-a-certificate-5355

流程:

我创建了myDomain.csr并将其发送给GoDaddy,得到了3个文件的回复( gd_bundle-g2-g1.crt , gdig2.crt.pem ,59a41eaec32d2046.crt)

我提到过期的旧证书有一个链式结构,不幸的是Go-daddy只给我“平”证书。

我试图自己制作一个链条:

cat 59a41eaec32d2046.crt gd_bundle-g2-g1.crt gdig2.crt.pem >> myDomain.crt

之后 :

sudo keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file myDomain.crt  
sudo keytool -import -alias intermed -keystore tomcat.keystore -trustcacerts -file gdig2.crt
sudo keytool -import -alias root -keystore tomcat.keystore -trustcacerts -file gd_bundle-g2-g1.crt

并完全按照文档中的说明更改server.xml

我附上了我认为应该出现的照片enter image description here

但实际上在我的链条后我有:enter image description here

当我打开浏览器GOT时:

Secure Connection Failed

An error occurred during a connection to talenttribe.me. Cannot communicate securely with peer: no common encryption algorithm(s). Error code: SSL_ERROR_NO_CYPHER_OVERLAP

    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem.

Learn more…

Report errors like this to help Mozilla identify and block malicious sites

不明白我错过了什么......是链创造还是tomcat问题?

BR,

security tomcat ssl https ssl-certificate
2个回答
1
投票

如果您从现有供应商续订,则只需要替换tomcat证书。证书名称hexcode.crt其他无需更改。它对我有用。

keytool -import -alias tomcat -keystore tomcat.keystore -trustcacerts -file filepath


0
投票

问题是没有使用链接完整创建tomcat.keystore。要解决此问题,您需要在单独的文件中隔离根证书和中间证书,然后按特定顺序导入它们。为了创建一个工作示例,这里有一些简化的假设:

  • 59a41eaec32d2046.crt文件仅包含Go Daddy发布的SSL证书,可能适用于面向Internet的Web服务器。
  • “gd_bundle-g2-g1.crt”文件是Go Daddy中间证书和根证书的串联。
  • “gdig2.crt.pem”文件包含Go Daddy根证书的冗余副本。
  • 只有一个中间证书,它也是您的SSL证书的颁发者。
  • crt文件是基本64位编码或“pem”格式。
  • tomcat.keystore文件使用JKS格式。

根据上面的假设,以下是创建tomcat.keystore的步骤:

  1. 列出gd_bundle-g2-g1.crt的内容: sudo keytool -printcert -file gd_bundle-g2-g1.crt

输出将包括捆绑中每个证书的分隔符。第一个证书的分隔符为“Certificate [1]:”,第二个证书的分隔符为“Certificate [2]:”。在“证书[1]:”之后,您将立即看到第一个证书的所有者和发行人记录。同样,在“证书[2]:”之后,您将看到第二个证书的所有者和发行者记录。另请注意:

  • 根证书的独特之处在于所有者与发行者相同(换句话说,它是自签名的)。
  • 根证书也是中间证书的颁发者。
  1. 以“rfc”格式列出gd_bundle-g2-g1.crt的内容: sudo keytool -printcert -file gd_bundle-g2-g1.crt -rfc

再次注意,分隔符“Certificate [1]:”和“Certificate [2]:”的使用与上述含义相同。但在rfc格式中,证书使用base 64“pem”格式列出,以“----- BEGIN CERTIFICATE -----”开头,以“----- END CERTIFICATE -----”结尾。这是单独的根证书和中间证书文件中需要的格式。

  1. 将步骤2的输出重定向到临时文件。然后使用文本编辑器将Go Daddy根证书保存在名为gd_root.crt的单独文件中。

确保包括以“----- BEGIN CERTIFICATE -----”开头并以“----- END CERTIFICATE -----”结尾的整个文本。

  1. 同样,将Go Daddy中间证书保存在名为gd_intermediate.crt的单独文件中。
  2. 使用“keytool -importcert”命令以递增方式创建密钥库: sudo keytool -importcert -noprompt -file gd_intermediate.crt -alias intermed -keystore tomcat.keystore -storepass'!q @ wDDfll' sudo keytool -importcert -noprompt -file gd_root.crt -alias root -keystore tomcat.keystore -storepass'!q @ wDDfll' sudo keytool -importcert -noprompt -file 59a41eaec32d2046.crt -alias tomcat -keystore tomcat.keystore -storepass'!q @ wDDfll'

上述命令的顺序很重要。您需要首先使用CA使用的中间证书来创建密钥库,以颁发(签署)您的SSL证书。 (如果有其他中间证书,则会添加其他证书,直到添加由根证书签名的最终中间证书。)接下来,添加根证书。最后,您为应用程序添加CA颁发的SSL证书。

这将解决tomcat.keystore文件的问题。您还可以考虑构建自定义信任库文件,该文件需要connector元素中的truststoreFile和truststorePass选项,作为依赖Java的cacerts信任库的替代方法。执行此操作的命令与上面的第2个命令类似,将信任库文件名替换为信任库密码。

© www.soinside.com 2019 - 2024. All rights reserved.