Created
May 25, 2022 06:07
-
-
Save loplex/6b1351d357d279fe42b2a480da41d5e3 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
set -xe | |
endpoint="$1" | |
# append specification to use port 443 if no port is provided | |
[[ ! "$endpoint" =~ ^.*:[0-9]+$ ]] && endpoint="${endpoint}:443" | |
# remove leading protocol if it is provided (e.g. https://) | |
endpoint="$(echo "$endpoint" | sed -e 's/^[^\:]*\:\/\/*//')" | |
openssl s_client -showcerts -connect "$endpoint" </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment