Skip to content

Instantly share code, notes, and snippets.

@msuksong
Created April 30, 2019 03:43
Show Gist options
  • Save msuksong/a906afbd7a95d79d4f8089a9045647ff to your computer and use it in GitHub Desktop.
Save msuksong/a906afbd7a95d79d4f8089a9045647ff to your computer and use it in GitHub Desktop.
show SSL certificate for a given web site
#!/bin/sh
PORT=443
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
echo "Usage: $0 <domain> [<port>] (without https://)" 1>&2
echo " default port is $PORT" 1>&2
exit 1
fi
host="$1"
port="${2:-$PORT}"
echo | openssl s_client -connect "$host":"$port" 2>/dev/null| openssl x509 -noout -text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment