Skip to content

Instantly share code, notes, and snippets.

@iver
Last active November 16, 2017 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iver/3fe806f211e9e3e4a2918d92583e6f1e to your computer and use it in GitHub Desktop.
Save iver/3fe806f211e9e3e4a2918d92583e6f1e to your computer and use it in GitHub Desktop.
Validate SSL Certificate from command line

Determine SSL cert expiration date from a PEM file:

$ openssl x509 -enddate -noout -in file.pem

Check many files:

for pem in /etc/ssl/certs/*.pem; do 
   printf '%s: %s\n' \
      "$(date --date="$(openssl x509 -enddate -noout -in "$pem"|cut -d= -f 2)" --iso-8601)" \
      "$pem"
done | sort

Retrieve the mail.nixcraft.net certificate provided by the nixcraft HTTPD mail server:

$ openssl s_client -showcerts -connect mail.nixcraft.net:443

https://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment