certck (559B) [raw]
1 #!/bin/sh 2 # view the details of a site's certificate 3 # 4 # Inspired by https://stackoverflow.com/questions/42635253/ but modified to be 5 # more robust (drops HTML output, strips https:// so any URL is valid, etc)! 6 set -e 7 die() { 8 echo "$*" 1>&2 9 } 10 11 [ -z "$1" ] && die "usage: $0 domain.com" 12 case "$1" in 13 https://*) DOMAIN=${1##https://} ;; 14 *) DOMAIN=${1} ;; 15 esac 16 17 # Use --insecure so that we can troubleshoot expired / otherwise bad certs 18 curl --verbose --insecure "https://$DOMAIN" 2>&1 1>/dev/null \ 19 | grep -E '(Connected to|subject:|date:|issuer)'