Skip to content

Instantly share code, notes, and snippets.

@x43x61x69
Last active May 21, 2018 10:14
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x43x61x69/5fe58c9b22b42004ce4965d3dee74653 to your computer and use it in GitHub Desktop.
Save x43x61x69/5fe58c9b22b42004ce4965d3dee74653 to your computer and use it in GitHub Desktop.
Check SSL Certificate Info via Linux/macOS Command Line
# You can place this into '.bash_profile' to make it more accessible.
# sslstatus google.com:443
sslstatus()
{
echo
a=(${1//:/ })
PORT=443
if [ "${#a[@]}" -ne 2 ]; then
if [ "${#1}" -lt 1 ] || [[ "$1" =~ ":" ]]; then
echo "usage: ${0} HOST[:PORT]"
echo
echo "Note: If PORT was not provied, ${PORT} will be used by default."
return;
fi
else
PORT=(${a[1]})
fi
HOST=(${a[0]})
echo "Checking SSL Cert on host \"${HOST}\" for port ${PORT}..."
echo
echo | openssl s_client -servername "${HOST}" -connect "${HOST}:${PORT}" 2>/dev/null | openssl x509 -noout -issuer -subject -email -dates -pubkey -fingerprint
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment