Linux

我的證書不適用於所有機器

  • November 6, 2014

我在我的新品牌伺服器上安裝了 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"

為什麼相同的證書適用於另一台伺服器而不是這台伺服器

感謝您的回答。


謝謝比爾雷神,

但是系統似乎對我來說是這樣做的,因為已經創建了帶有雜湊返回的符號連結。順便說一句,我在 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 知道從哪裡來嗎?


我認為這一點可能是關鍵:

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 簽名密鑰的長度。

除了部署證書,您可能需要為證書創建符號連結。該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

引用自:https://serverfault.com/questions/640910