使用 Java 标准密钥库是一种不好的做法吗

发布于 2024-12-11 15:06:18 字数 293 浏览 0 评论 0原文

我们一直使用 java 标准密钥库 ($JAVA_HOME/jre/lib/security/cacerts) 作为 tomcat 的可信存储。该 tomcat 服务器将与其他服务器通信。最近的 OS(AIX) 升级显然覆盖了 $JAVA_HOME/jre/lib/security/cacerts 处的文件,导致证书丢失以及 tomcat 中托管的应用程序出现很多问题。

看看这个,中继 $JAVA_HOME/jre/lib/security/cacerts 是一个不好的做法吗? 解决这种情况的替代(更好|标准)方法是什么?

We had been using java standard keystore ($JAVA_HOME/jre/lib/security/cacerts) as the trusted store for tomcat. And that tomcat server would communicate with some other server. A recent OS(AIX) upgrade apparently over-wrote the file at $JAVA_HOME/jre/lib/security/cacerts and that resulted in lost certificates and lot of issues with application hosted in tomcat.

Looking at this is it a bad practice to relay up on $JAVA_HOME/jre/lib/security/cacerts ?
What are the alternate (better|standard) ways to tackle this scenario?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

夏九 2024-12-18 15:06:18

如果您有一个会重复导入的构建过程,那么这不是一个坏习惯。

It's not a bad practice if you have a build process that will repeat the imports.

小梨窩很甜 2024-12-18 15:06:18

不确定,但假设您的假设是正确的,请小心放置密钥库的位置。我强烈建议将它放在 Apache 文件夹中。

默认情况下,在 Websphere 中密钥库以这种方式工作,因为它带来了自己的 JVM :)

Not sure, but assuming your assumptions are correct, caution where you put your keystore. I would strongly suggest it is placed inside Apache folder.

By default in Websphere the keystore works this way, since it brings it's own JVM :)

蒗幽 2024-12-18 15:06:18

就 cacerts 文件中的内容而言,这并不一定比依赖操作系统或浏览器中安装的默认 CA 证书更糟糕,但这并不意味着它很好。

Sun/Oracle 在 关于此的 JSSE 参考指南

重要提示:JDK 附带了有限数量的受信任根
/lib/security/cacerts 文件中的证书。作为
记录在 keytool 中,您有责任维护(即
添加/删除)此文件中包含的证书(如果您使用此文件)
文件作为信任库。

根据您联系的服务器的证书配置,
您可能需要添加额外的根证书。获取需要的
来自适当供应商的特定根证书。

在配置方面,对于必须安装“本地”CA 证书的特定应用程序,我发现使用本地信任存储更稳定(例如,使用 javax.net.ssl.trustStore 指定)代码>)。

In terms of what is in the cacerts file, it's not necessarily worse practice than relying on the default CA certificates installed in your OS or your browser, but that doesn't mean it's great.

Sun/Oracle have a little "important note" somewhere in the middle of the JSSE Reference Guide about this:

IMPORTANT NOTE: The JDK ships with a limited number of trusted root
certificates in the /lib/security/cacerts file. As
documented in keytool, it is your responsibility to maintain (that is,
add/remove) the certificates contained in this file if you use this
file as a truststore.

Depending on the certificate configuration of the servers you contact,
you may need to add additional root certificate(s). Obtain the needed
specific root certificate(s) from the appropriate vendor.

In terms of configuration, for specific applications where I've had to install "local" CA certificates, I find it more stable to use a local trust store (for example, specified with javax.net.ssl.trustStore).

猫性小仙女 2024-12-18 15:06:18

AIX 升级是一个补丁。任何补丁都不得删除/覆盖用户数据。我建议受此类数据丢失影响的用户要求 IBM 修复补丁程序。相比之下,httpd 服务器的补丁不会覆盖/删除配置,即使它位于程序目录中。

The AIX upgrade is a patch. Any patch must not delete / overwrite user data. I would suggest that users affected by this kind of data loss ask IBM to fix the patch procedure. In comparison, a patch of the httpd server does not overwrite / delete the configuration even though it is in the program directory.

梦罢 2024-12-18 15:06:18

是的,这样做是一种不好的做法。

最佳实践是根据需要限制您的受信任证书。
因此,您应该仅使用自己的密钥库以及应用程序信任的证书。

Yes it is a bad practice to do that.

The best practice is to have to limit your trusted certificates as much as needed.
So you should have used you own keystore with only the certificates trusted by your application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文