Skip to content

Instantly share code, notes, and snippets.

@kogent
Last active March 11, 2016 23:29
Show Gist options
  • Save kogent/284447 to your computer and use it in GitHub Desktop.
Save kogent/284447 to your computer and use it in GitHub Desktop.
bash function to get a certificate from a remote host
# bash function to get a certificate from a remote host
function getcert {
host=$1
port=$2
if [ -n $port ]; then
port=443
fi
openssl s_client -connect ${host}:${port} </dev/null 2>/dev/null | sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/p'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment