Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Bash function to visualize PKI chain-of-trust
function certchain() {
# Usage: certchain
# Display PKI chain-of-trust for a given domain
# GistID:
if [[ "$#" -ne 1 ]]; then
echo "Usage: ${FUNCNAME} <ip|domain[:port]>"
return 1
local host_port="$1"
if [[ "$1" != *:* ]]; then
local host_port="${1}:443"
\openssl \
s_client -connect "${host_port}" </dev/null 2>/dev/null \
| \egrep \
--color=never \
--extended-regexp '\ (s|i):'

This comment has been minimized.

Copy link
Owner Author

@joshenders joshenders commented Jan 18, 2016

Usage: certchain <ip|domain[:port]>


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment