Last active
March 11, 2016 23:29
-
-
Save kogent/284447 to your computer and use it in GitHub Desktop.
bash function to get a certificate from a remote host
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
# 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