Last active
August 26, 2021 18:19
-
-
Save joshenders/cda916797665de69ebcd to your computer and use it in GitHub Desktop.
Simple Bash function to visualize PKI chain-of-trust
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
function certchain() { | |
# Usage: certchain | |
# Display PKI chain-of-trust for a given domain | |
# GistID: https://gist.github.com/joshenders/cda916797665de69ebcd | |
if [[ "$#" -ne 1 ]]; then | |
echo "Usage: ${FUNCNAME} <ip|domain[:port]>" | |
return 1 | |
fi | |
local host_port="$1" | |
if [[ "$1" != *:* ]]; then | |
local host_port="${1}:443" | |
fi | |
\openssl \ | |
s_client -connect "${host_port}" </dev/null 2>/dev/null \ | |
| \egrep \ | |
--color=never \ | |
--extended-regexp '\ (s|i):' | |
} |
Author
joshenders
commented
Jan 18, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment