Created
September 4, 2015 20:40
-
-
Save glaszig/191097a644610482d720 to your computer and use it in GitHub Desktop.
show ssl fingerprints for remote hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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