
過去兩天我一直在嘗試修復我們伺服器中的 ssl 憑證問題。
我們有兩台伺服器 A 和 B,我能夠將 A 連接到 B,但 B 更改了 ssl 憑證。他們共享了這個密鑰,我們導入了那個密鑰,但是當我嘗試連接 BI 時,我得到了
$ openssl s_client -CApath /etc/ssl/certs/ -connect B:443
verify error:num=10:certificate has expired
notAfter=Sep 17 12:00:00 2021 GMT
所以這仍然是舊的。然後我嘗試了解是否無法匯入新的 .crt 文件,以及它是否仍然是舊文件。
$ openssl x509 -in B.crt -noout -dates
notBefore=Aug 4 00:00:00 2021 GMT
notAfter=Aug 4 23:59:59 2022 GMT
不,如您所見,證書是新的且有效。所以我嘗試用它來測試與B的連接。
$ openssl s_client -connect B:443 -CAfile B.crt
但它仍然返回
verify error:num=10:certificate has expired
notAfter=Sep 17 12:00:00 2021 GMT
我現在該怎麼做?
答案1
$ openssl s_client -CApath /etc/ssl/certs/ -connect B:443 verify error:num=10:certificate has expired notAfter=Sep 17 12:00:00 2021 GMT
因此B發送了一個過期的憑證。根據評論,當您使用 SNI 要求名稱 B 的憑證時,他們會發送有效的憑證。
解決方案顯然是使用 SNI,因為這是 B 已經測試和實現的。