Last active
January 25, 2018 18:37
-
-
Save jkeam/06099d588d379b8e104bfead3158f94e to your computer and use it in GitHub Desktop.
Get SSL Cert
This file contains hidden or 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 | |
# | |
# usage: getcert.sh remote.host.name [port] | |
# eg) getcert.sh api.mailgun.net | |
# | |
RHOST=$1 | |
RPORT=${2:-443} | |
# see cert | |
echo -n | openssl s_client -connect ${RHOST}:${RPORT} | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | |
# see chain | |
echo | openssl s_client -showcerts -servername ${RHOST} -connect ${RHOST}:${RPORT} 2>/dev/null | openssl x509 -inform pem -noout -text | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment