我的证书并不适用于所有机器

我的证书并不适用于所有机器

我在新品牌服务器上安装了 Centos7。我使用 LDAP 作为身份验证。我在所有服务器上部署了证书,LDAPS 可与 RHEL5、Debian 或 SOLARIS 配合使用

在 Centos7 上,我遇到了 sssd 问题,在安装之前我并不知道。LDAP 正在运行,我可以顺利执行 su - $user。当我在 LDAPS 中升级时,我丢失了此身份验证。在我的 LDAP 服务器上,我收到此错误:

[30/oct./2014:16:32:05 +0100] DISCONNECT conn=735741 reason="Protocol Error" msg="The client sent a request to  Directory Server which did not decode  well as LDAP message : javax.net.ssl.SSLException: Received fatal alert: bad_certificate"

为什么同一证书在其他服务器上有效,而在这台服务器上无效

谢谢您的回答。


谢谢BillThor,

但系统似乎为我做了这件事,因为已经创建了带有哈希返回的符号链接。顺便说一下,我在 ldap.conf 中修改了这一行

TLS_CACERT /etc/openldap/cacerts/xxxxxx.0

我使用命令对其进行了测试ldapsearch -x -d3,并收到以下错误消息:

    attempting to connect: 
connect success
TLS: loaded CA certificate file /etc/openldap/cacerts/xxxxxx.0.
tls_write: want=157, written=157
.../...
certificate  is not valid - error -8016:The certificate was signed using a signature algorithm that is disabled because it is not secure
TLS: error: connect - force handshake failure: errno 0 - moznss error -8157
TLS: can't connect: TLS error -8157:Certificate extension not found..
ldap_err2string

这很奇怪,因为我的所有服务器都接受这个 CA,但不接受 CENTOS7 下的新 CA,知道它来自哪里吗?


答案1

我认为这一点可能是关键:

certificate  is not valid - error -8016:The certificate was signed using a signature algorithm that is disabled because it is not secure

我猜想拒绝证书的服务器可能配置为不接受基于 SHA-1 的签名。我不是密码学家,但最近我注意到的其他 SSL 问题中,我想不出其他似乎合适的问题。

您应该对我的细节的猜测持保留态度,但应该记住,该服务器拒绝您的证书的理由可能是有根据的,而接受该证书的服务器应该检查其配置。

编辑:这里有更多关于该问题的描述,以及 ldapsearch 的解决方法: https://bugzilla.redhat.com/show_bug.cgi?id=895513

看起来问题可能出在 MD5 上,而不是我猜测的 SHA-1。从 ldapsearch 3.14 开始:

Certificate signatures that make use of the MD5 hash algorithm will now
be rejected by default. Support for MD5 may be manually enabled (but is
discouraged) by setting the environment variable of
"NSS_HASH_ALG_SUPPORT=+MD5"
or by using the NSS_SetAlgorithmPolicy function. Note that SSL cipher
suites with "MD5" in their names are NOT disabled by this change; those
cipher suites use HMAC-MD5, not plain MD5, and are still considered safe.

鉴于您的错误发生在服务器上,您可能只能解决该系统上的问题。

如果问题出在 MD5 上,我建议您在采取这种方法之前仔细考虑。对 MD5 证书的攻击非常实际,如果您不打算摆脱 MD5 证书,您应该问问自己为什么要运行 CA。

http://www.win.tue.nl/hashclash/rogue-ca/

如果这是关于 SHA-1 的较新问题,则攻击会更加困难,并且是否可行取决于 CA 的签名密钥的长度。

答案2

除了部署证书之外,您可能还需要为证书创建符号链接。c_rehash为此提供了实用程序。您还可以使用命令openssl x509 -noout -hash -in vsignss.pem获取证书的哈希值。符号链接具有后缀.0

或者,您可以将证书添加到 LDAP 配置中。这可以是/etc/ldap/ldap.conf。旧版本也有 中的设置pam_ldap.conf

编辑:握手错误可能是由于禁用 SSLv3 或以其他方式限制可用算法而导致的。我最近由于 Poodle 而禁用 SLLv3漏洞。我在最后列出了用于测试连接的命令。对于您的情况,请尝试以下命令:

openssl s_client -connect localhost:ldap
openssl s_client -quiet -connect localhost:ldap -ssl3
openssl s_client -quiet -connect localhost:ldap -tls1
openssl s_client -quiet -connect localhost:ldap -tls1_2

答案3

您没有说明如何安装 CA 证书文件。使用 RH 或衍生产品时,您只需使用 man update-ca-trust 中的信息,tldr;版本是:

  1. 将 CA 证书文件复制到 /etc/pki/ca-trust/source/anchors/
  2. 运行 update-ca-trust 启用 && update-ca-trust
  3. 利润!

update-ca-trust 附带基础存储库中的 ca-certificates 包。

这应该可以解决几乎所有问题。根据我的经验,只有 php 比较特殊,需要特别注意,方法是在 /etc/openldap/ldap.conf(系统范围)或 $HOME/.ldaprc(仅针对一个用户)中指定:

TLS_CACERT /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem

顺便说一下,这个 TLS_CACERT 路径是 update-ca-trust 工具管理的。

答案4

大家好,谢谢大家。

我找到了这些链接:

https://bugzilla.redhat.com/show_bug.cgi?id=895513

和这个 :

http://www.unixmen.com/rhel-centos-6-4-ldap-md5-certificate-error-caused-by-nss-3-14-update/

我在测试这个解决方案时遇到了一个问题,如何在 GRUB2 中输入下面这行代码

systemd.setenv=NSS_HASH_ALG_SUPPORT=+MD5

所以,我在这里得到了答案: 在 grub2 中添加 systemd setenv

谢谢。

相关内容