Get the SAN entries for a cert with openssl

openssl s_client -connect facebook.com:443 < /dev/null 2>/dev/null \
  | openssl x509 -noout -text | grep -i dns

# cleaner output
openssl s_client -connect facebook.com:443 < /dev/null 2>/dev/null \
  | openssl x509 -noout -text 2>/dev/null \
  | perl -ne 'm/DNS/ && s/(, *|^ *DNS:)//g && print(join("\n",split /DNS:/))'

Leave a Reply

Your email address will not be published. Required fields are marked *