15

Is there a way to list all domains on an SAN/UCC SSL Certificate (ideally using command line on linux/os x)?

Clearly there must be some way to extract the data, since browsers can do it. Unfortunately, I can see the list but can't cut and paste it.

25

openssl x509 -text < foo.crt should do the trick.

  • 3
    For posterity, this is the full command I used, since I was doing it for another server: openssl s_client -showcerts -connect www.example.org:443 | openssl x509 -text – Jordan Reiter Sep 10 '12 at 13:39
  • 3
    To get a clean space delimited list of domains you can pass it through grep and sed like so openssl x509 -text < $CRT | grep 'DNS:' | sed 's/\s*DNS:\([a-z0-9.\-]*\)[,\s]\?/\1 /g' – Geoffrey Apr 28 '17 at 8:49
  • Please scroll down: panticz.de's answer is better ;-) – lucaferrario May 3 at 11:04
8

You can list the domains with this command (tested on linux):

cat cert.pem | openssl x509 -text | grep DNS
  • This one gives a better output than the accepted answer. – VaTo Apr 2 at 18:51
  • Yep, this should be the accepted answer instead. – Kal Apr 11 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.