在 LDAP 伺服器和用戶端設定新的 SSL 憑證時發生錯誤

在 LDAP 伺服器和用戶端設定新的 SSL 憑證時發生錯誤

我的最後一個 SSL 憑證昨天過期了,並且是在我的 LDAP 伺服器上配置的,因此我購買了一個新的 SSL 金鑰啟動它並再次嘗試配置,但仍然顯示相同的錯誤。首先我嘗試ldapsearch -d 33 -H ldaps://ldap.example.com -b "dc=example,dc=com" -D "cn=manager,ou=Internal,dc=example,dc=com" -w Zsi9olp4rf8jWi6bmD 連接伺服器然後輸出是

ldap_url_parse_ext(ldaps://ldap.example.com)
ldap_create
ldap_url_parse_ext(ldaps://ldap.example.com:636/??base)
ldap_sasl_bind
ldap_send_initial_request
ldap_new_connection 1 1 0
ldap_int_open_connection
ldap_connect_to_host: TCP ldap.example.com:636
ldap_new_socket: 3
ldap_prepare_socket: 3
ldap_connect_to_host: Trying 10.2.0.102:636
ldap_pvt_connect: fd: 3 tm: -1 async: 0
attempting to connect:
connect success
TLS: certdb config: configDir='/etc/openldap/cacerts' tokenDescription='ldap(0)' certPrefix='' keyPrefix='' flags=readOnly
TLS: using moznss security dir /etc/openldap/cacerts prefix .
TLS: loaded CA certificate file /etc/openldap/cacerts/f96879fa.1.
**TLS: certificate [CN=*.example.com,OU=EssentialSSL Wildcard,OU=Domain Control Validated] is not valid - error -8181:Peer's Certificate has expired..**
TLS: error: connect - force handshake failure: errno 21 - moznss error -8174
TLS: can't connect: TLS error -8174:security library: bad database..
ldap_err2string
**ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)**

所以我將新密鑰複製到 LDAP 伺服器的/etc/openldap/cacerts/cert.pem檔案中,但還有另一個檔案/etc/openldap/cacerts/key.pem。現在我很困惑應該將密鑰添加到哪個文件。

在客戶端,cacerts 資料夾中有很多檔案。請檢查附件照片中的文件。

客戶端證書文件

伺服器 cacerts 文件

請建議我需要在哪裡新增新的 ssl 金鑰以進行正確的配置。

答案1

SSL 需要私鑰和公鑰。由於超出本答案範圍的原因,您的公鑰將在您的憑證簽署請求 (CSR) 中傳送至憑證授權單位(或 CA),並包含在傳回給您的憑證中。

伺服器需要私鑰和公鑰(幾乎總是包含在憑證中)才能運作。這就是為什麼您會看到兩個檔案。

如果您使用相同的私鑰產生了新證書,您應該能夠僅替換該證書。大多數建立 CSR 的線上說明也會產生新的私鑰(在同一資料夾中)。在這種情況下,您需要尋找該私鑰並將其與您的憑證結合使用。

相關內容