Skip to content

Instantly share code, notes, and snippets.

@bijanebrahimi
Created August 9, 2013 21:09
Show Gist options
  • Save bijanebrahimi/6197219 to your computer and use it in GitHub Desktop.
Save bijanebrahimi/6197219 to your computer and use it in GitHub Desktop.
Check certification fingerprints using openssl in bash
#!/bin/sh
#
# usage: certcheck hostname [port]
#
REMHOST=$1
REMPORT=${2:-443}
echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | openssl x509 -sha1 -noout -fingerprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment