Skip to content

Instantly share code, notes, and snippets.

@cmbuckley
Last active October 27, 2017 10:35
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 cmbuckley/c2419b7f1c8ca6398131ab62934f5804 to your computer and use it in GitHub Desktop.
Save cmbuckley/c2419b7f1c8ca6398131ab62934f5804 to your computer and use it in GitHub Desktop.
List the SAN extension domain names contained in an SSL cert on a given domain
#!/bin/bash
domain=$1
[[ $domain != *":"* ]] && domain="$domain:443"
openssl s_client -connect $domain 2>/dev/null </dev/null \
| openssl x509 -noout -text \
| grep -A1 'Subject Alternative Name:' \
| awk 'BEGIN{RS=",";FS=":"}{print $NF}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment