Created
February 2, 2024 05:34
-
-
Save redneck-f25/5b10d503c417a3e13730eb0076e0afdf 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/bash | |
openssl s_client -showcerts -connect example.org:443 < /dev/null \ | |
| sed -n '/^-----BEGIN CERTIFICATE-----/,/^-----END CERTIFICATE-----/p' \ | |
| { | |
cert= | |
while read -r; do | |
cert+="${REPLY}"$'\n' | |
if [[ "${REPLY}" == "-----END CERTIFICATE-----" ]]; then | |
openssl x509 -in - -out - -text <<<"${cert}" | |
cert= | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment