From 34aea3ff6f89b0ebc3f66ab943a19f5f9aa01e1a Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Thu, 25 Aug 2022 09:07:32 -0400 Subject: [PATCH] bin: Add small tool to check a site's certificate: `certck` This is a nice win over going to the site in firefox :) --- bin/certck | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 bin/certck diff --git a/bin/certck b/bin/certck new file mode 100755 index 0000000..a108f66 --- /dev/null +++ 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)' -- libgit2 1.1.1