Skip to content

Instantly share code, notes, and snippets.

@gboone
Last active June 3, 2020 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gboone/d477facc81349542757b69923d945963 to your computer and use it in GitHub Desktop.
Save gboone/d477facc81349542757b69923d945963 to your computer and use it in GitHub Desktop.
crtchk.sh
#! /bin/zsh
# Very much low-fi, low-tech shortcut to check a domain name passed via stdin and return details about the certificate.
# If `ca` is passed, the "CA Issuers" string is grepped from the output.
domain=${1%/}
echo $domain
if [[ $2 == "ca" ]]; then
echo | openssl s_client -showcerts -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -inform pem -noout -text | grep "CA Issuers";
else
echo | openssl s_client -showcerts -servername $domain -connect $domain:443 2>/dev/null | openssl x509 -inform pem -noout -text;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment