SSLの証明書期限をCLIで確認する

SSLなんだからopenssl使えばわかるよねっていう。

openssl

$ openssl s_client -connect ssl.example.com:443 2>&1 < /dev/null | openssl x509 -enddate | grep ^notAfter
notAfter=Oct  1 23:59:59 2011 GMT

opensslで接続しにいくので、remote host の状態を確認可能。

certwatch

(in crypto-utils package (redhat))
yumでいれるとcron.dailyに登録されて毎日チェックされる。defaultの設定では、apacheに設定されている証明書(httpd -t -DDUMP_CERTS)を調べている様子。

$ certwatch /path/to/cert.pem

ファイルを調べるので基本的には自分のサーバ内の証明書のみ確認可能。

といっても↑のopensslのように

$ openssl s_client -connect ssl.example.com:443 2>&1 < /dev/null | openssl x509 > cert.pem

とかやれば取ってこれば好きにできるけど。