An SSL certificate contains such information as: validity dates, subject, issuer and other stuff. It is a quite common task to check if an SSL certificate is valid and when it expires. We can easily use Linux command line tools to retrieve all the information from website’s SSL certificate.
Here we will show how to use the Linux command line to connect to a remote https website, decode SSL certificate and get its validity date.
Check an HTTPS certificate expires date from command line:
$ echo | openssl s_client -connect site:port 2>/dev/null | openssl x509 -noout -dates
Let’s check when the SSL certificate of facebook.com expires:
$ echo | openssl s_client -connect facebook.com:443 2>/dev/null | openssl x509 -noout -dates notBefore=Apr 10 00:00:00 2015 GMT notAfter=Dec 31 12:00:00 2015 GMT