在建立 SSL 憑證時規劃好一點, 日後會省卻不少麻煩, 例如將不同憑證以域名命名, 或者像 Let’s Encrypt 一樣, 將憑證放到網址名稱的目錄.
但如果建立憑證時沒有規劃好, 日後要檢視憑證的有效網址, 可以用 openssl 指令取得憑證的相關資訊, 以下指令可以取得憑證的資訊:
# openssl x509 -in cert.pem -text -noout
只顯示 SSL 憑證的 CN, 可用以下指令:
# openssl x509 -noout -subject -in cert.pem
或
|
1 |
# openssl x509 -in cert.pem -text -noout | grep 'Subject: CN' |
而每張 SSL 感證除了 CN, 還有 Subject Alternative Name, 即一張憑證對多個網域有效, 可以用以下 grep 指令, 把 CN 及 Subject Alternative Name 印出:
|
1 |
# openssl x509 -in cert.pem -text -noout | grep 'Subject: CN\|DNS' |
使用www.sslbuyer.com即可