如何在 RedHat 上更新 cURL CA 包?

And*_*rew 43 ssl redhat curl certificate-authority

我遇到了与我的 cURL 版本捆绑在一起的 CA 包已过时的问题。

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
Run Code Online (Sandbox Code Playgroud)

通读文档对我没有帮助,因为我不明白我需要做什么或如何做。我正在运行 RedHat 并且需要更新 CA 包。我需要做什么才能在 RedHat 上更新我的 CA 包?

Nad*_*ada 53

对于 RHEL 6 或更高版本,您应该使用update-ca-trust,正如 lzap 在下面的回答中所述。

--- 对于旧版本的 Fedora、CentOS、Redhat:

Curl 使用存储在 /etc/pki/tls/certs/ca-bundle.crt 中的系统默认 CA 包。在更改之前,请复制该文件,以便您可以在需要时恢复系统默认值。您可以简单地将新的 CA 证书附加到该文件,或者您可以替换整个包。

您是否还想知道从哪里获得证书?我(和其他人)推荐 curl.haxx.se/ca 。在一行中:

curl https://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)

Fedora Core 2 的位置是/usr/share/ssl/certs/ca-bundle.crt.


lza*_*zap 41

在 RHEL 6+ 系统上执行此操作的推荐方法是使用update-ca-trust工具,该工具现已默认安装。

# cat /etc/pki/ca-trust/source/README 
This directory /etc/pki/ca-trust/source/ contains CA certificates and 
trust settings in the PEM file format. The trust settings found here will be
interpreted with a high priority - higher than the ones found in 
/usr/share/pki/ca-trust-source/.

=============================================================================
QUICK HELP: To add a certificate in the simple PEM or DER file formats to the
            list of CAs trusted on the system:

            Copy it to the
                    /etc/pki/ca-trust/source/anchors/
            subdirectory, and run the
                    update-ca-trust
            command.

            If your certificate is in the extended BEGIN TRUSTED file format,
            then place it into the main source/ directory instead.
=============================================================================

Please refer to the update-ca-trust(8) manual page for additional information
Run Code Online (Sandbox Code Playgroud)

因此,您只需要将 crt 文件拖放到/etc/pki/ca-trust/source/anchors/并运行该工具。完成工作。这是安全的,您不需要做任何备份。完整的手册页可以在这里找到:https : //www.mankier.com/8/update-ca-trust


小智 7

可能取决于哪个版本的Redhat。您可以通过执行以下操作找到实际更新文件的包:

rpm -qf /etc/pki/tls/certs/ca-bundle.crt
Run Code Online (Sandbox Code Playgroud)

我的结果显示需要更新openssl-0.9.8e-12.el5

如果您的发行版中没有更新的证书,您必须按照 Nada 的回答手动更新。


mgo*_*ven 6

RHEL 提供 Mozilla CA 证书作为ca-certificates软件包的一部分(yum如果尚未安装,请安装它)。要告诉 cURL 使用这些,请使用--cacert像这样的参数。

curl --cacert /etc/ssl/certs/ca-bundle.crt https://google.com/
Run Code Online (Sandbox Code Playgroud)


Ada*_*son 6

自从 Dan Pritts 发表评论以来,Red Hat 一直在更频繁地更新支持的 RHEL 版本的证书包;您可以在包更改日志中很容易地看到这一点。RHEL 6 的证书在 2013 年和 2014 年更新了两次。

所有 RHEL 和相关/克隆/派生发行版都在 提供了一个捆绑文件/etc/pki/tls/certs/ca-bundle.crt,并且同一个文件位于/etc/pki/tls/cert.pem(在较旧的发行版上是指向cert.pem的符号链接ca-bundle.crt;在较新的发行版中,两者都是指向由 输出的文件的符号链接update-ca-trust)。

在 RHEL 6 和更新版本中,该捆绑包是“ca-certificates”包的一部分。在 RHEL 5 及更早版本中,它是“openssl”包的一部分。

在带有更新https://rhn.redhat.com/errata/RHEA-2013-1596.html和任何更新的 RHEL 的RHEL 6 中,“共享系统证书”系统可用(您必须运行update-ca-trust enable以启用它)并且是最好的方法是由 lzap 给出的。该系统的一个好处是它适用于基于 NSS 和 GnuTLS 的应用程序以及基于 OpenSSL 的应用程序。请注意,您还可以通过将证书放在目录中来不信任证书/etc/pki/ca-trust/source/blacklist/

在RHEL 5及以上(和RHEL 6,如果你不希望使用新的系统),你可以通过把他们的PEM格式的证书文件,相信额外的CA扩展名为.pem在/ etc / PKI / TLS /证书和运行c_rehash(也可根据需要yum install /usr/bin/c_rehash)。这仅适用于使用 OpenSSL 的默认信任存储的软件。这比编辑或替换捆绑文件要好,因为它允许您继续接收捆绑文件的官方更新。

直接使用捆绑文件位置之一(而不是要求 OpenSSL 使用系统默认信任存储)的软件将不遵守更改;如果你有这样的软件,你就无法编辑捆绑文件(或改进软件)。根本不使用 OpenSSL 的软件不会尊重添加的证书。