Skip to content

Instantly share code, notes, and snippets.

@derektamsen
Created March 10, 2015 19:18
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 derektamsen/d1053ced05b261d0dce5 to your computer and use it in GitHub Desktop.
Save derektamsen/d1053ced05b261d0dce5 to your computer and use it in GitHub Desktop.
Outputs the openssl certificate details including the chain, subject, and expiration date. Usage: `./checksslcert <fqdn> [port]` - <fqdn>: The hostname or fully qualified domain name of the cert to check - [port]: The tcp port the ssl service is listening on. This will default to `443` if unspecified.
#!/usr/bin/env sh
checksslcert() {
echo "QUIT" | openssl s_client -servername ${1} -connect ${1}:${2:-443}
echo "QUIT" | openssl s_client -servername ${1} -connect ${1}:${2:-443} | openssl x509 -noout -dates
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment