DEV Community

Benjamin Black
Benjamin Black

Posted on • Updated on

Use OpenSSL to get a remote server's TLS certificate expiration date

My posts are usually notes and reference materials for myself, which I publish here with the hope that others might find them useful.

There really should be an s_client option to do this. In lieu of, use s_client to read the cert and pipe it to the x509 command.

echo | openssl s_client -connect -servername 2>/dev/null | openssl x509 -noout -dates
Enter fullscreen mode Exit fullscreen mode

Top comments (0)