net::ERR_CERT_AUTHORITY_INVALID 用于 spring 引导应用程序

net::ERR_CERT_AUTHORITY_INVALID for spring boot application

当我尝试访问 aws ec2 实例上的 spring 引导后端应用程序 运行 时,我在 chrome 上收到此错误:

net::ERR_CERT_AUTHORITY_INVALID

我已经将我的证书导出到 jre cacerts:

sudo keytool -importcert -file certificate.crt -alias tomcat -keystore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts

已安装的证书:

keytool -list -keystore /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts -alias tomcat

tomcat, Jan 5, 2021, trustedCertEntry, 
Certificate fingerprint (SHA1): 41:41:E0:F6:88:F5:B3:DF:B0:D7:3B:8D:87:95:4B:16:48:C9:92:5D

我还有其他事情要做吗?

自签名 证书是正常的。想象一下,尝试访问一家拥有开发者妈妈签名证书的在线商店:它应该显示警告(即使我们非常爱妈妈们),因为该网站不是一点都不安全,你不应该在那里输入你的卡号。

这就是为什么会有证书提供商,例如 Symantec 或 Digicert。他们签署了您的证书,并最终将其签署的任何内容确定为有效的证书颁发机构。 他们就像在线交流的公证人

比如在浏览器上点击Whosebug的页面锁。它将显示此页面证书的提供者,即 Let's Encrypt. This provider allows the creation of trusted certificates without paying a cent, as it's a non-profit authority run by the Internet Security Research Group.

感谢 Voo 在评论区指出这一点。