Query a server certificate from the command line

‹ Kappa Architecture | Rebase all local branches in git ›

To display SSL/TLS certificate information about a web server from the command line:

showcert()
{
  HOSTNAME="$1"
  : | openssl s_client -showcerts -servername "$HOSTNAME" -connect "$HOSTNAME":443 2>/dev/null | openssl x509 -inform pem -noout -text
}

Then, call this function with the hostname you want to check, like:

showcert example.com

Subscribe to All Posts - Wesley Tanaka