使用OpenSSL檢查SSL證書狀態的步驟如下:
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -dates
example.com
是你要檢查的域名。-servername
參數用于指定SNI(Server Name Indication),這在多域名服務器上特別有用。</dev/null
和 2>/dev/null
用于忽略標準輸入和錯誤輸出,只顯示證書的有效期信息。notBefore=Apr 1 12:00:00 2023 GMT
notAfter=Oct 1 12:00:00 2023 GMT
這表示證書的有效期從2023年4月1日開始,到2023年10月1日結束。
如果你不想在本地安裝OpenSSL,也可以使用在線的SSL檢查工具,如:
這些工具通常提供更詳細的證書信息,包括證書鏈、加密套件、協議支持等。
通過以上方法,你可以輕松地使用OpenSSL檢查SSL證書的狀態。