Skip to content

Instantly share code, notes, and snippets.

@pgporada
Created February 4, 2018 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgporada/7391863e37d329e37a746b5207510a07 to your computer and use it in GitHub Desktop.
Save pgporada/7391863e37d329e37a746b5207510a07 to your computer and use it in GitHub Desktop.
#!/bin/bash
# AUTHOR: Phil Porada
DOMAIN=${1}
CERT=$(openssl s_client -connect ${DOMAIN}:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p')
SANS=$(openssl x509 -noout -text -in <(echo "${CERT}") | grep '^[[:space:]]*Subject: CN=' | sed 's/^[[:space:]]*Subject: CN=//')
echo "${SANS}"
##################################################
##################### OUTPUT #####################
##################################################
$ ./check_cert.sh download.osmc.tv
my.osmc.tv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment