Skip to content

Instantly share code, notes, and snippets.

@glaszig
Created September 4, 2015 20:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glaszig/191097a644610482d720 to your computer and use it in GitHub Desktop.
Save glaszig/191097a644610482d720 to your computer and use it in GitHub Desktop.
show ssl fingerprints for remote hosts
#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: `basename $0` hostname [hostname]..."
exit $E_NOARGS
fi
until [ -z "$1" ]; do
host=$1
if [[ $host != *:* ]]; then
host="$host:443"
fi
cert=`echo | openssl s_client -connect $host 2>/dev/null`
echo "= $host ="
echo "$cert" | openssl x509 -noout -fingerprint -md5
echo "$cert" | openssl x509 -noout -fingerprint -sha1
echo "$cert" | openssl x509 -noout -fingerprint -sha256
echo
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment