Wednesday, 29 April 2020

Get SSL/TLS from a Website and Identify the Expiry Date

Install utility executables:
sudo yum install gnutls-utils -y
sudo apt install gnutls-bin -y

Get the cert:
true | gnutls-cli --print-cert $Domain 2>/dev/null | \
openssl x509 >temp.pem;

"true" to make 'gnutls-cli' end.
"2>/dev/null" to remove errors.
"openssl x509" to extract the cert only.

Get the expiry date:
openssl x509 -enddate -noout -in temp.pem;

No comments:

Post a Comment