commit 34aea3ff6f89b0ebc3f66ab943a19f5f9aa01e1a (patch) parent 421f7dde70ea4772daf78ed1599a8619d7ccc99f Author: Alex Karle <alex@alexkarle.com> Date: Thu, 25 Aug 2022 09:07:32 -0400 bin: Add small tool to check a site's certificate: `certck` This is a nice win over going to the site in firefox :) Diffstat:
A | bin/certck | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/bin/certck b/bin/certck @@ -0,0 +1,19 @@ +#!/bin/sh +# view the details of a site's certificate +# +# Inspired by https://stackoverflow.com/questions/42635253/ but modified to be +# more robust (drops HTML output, strips https:// so any URL is valid, etc)! +set -e +die() { + echo "$*" 1>&2 +} + +[ -z "$1" ] && die "usage: $0 domain.com" +case "$1" in + https://*) DOMAIN=${1##https://} ;; + *) DOMAIN=${1} ;; +esac + +# Use --insecure so that we can troubleshoot expired / otherwise bad certs +curl --verbose --insecure "https://$DOMAIN" 2>&1 1>/dev/null \ + | grep -E '(Connected to|subject:|date:|issuer)'