Get server SSL certificate using openssl

Using the openssl command, it’s possible to connect to the secure service and dump its certificate chain.

Advertisements

Accessing secure services with command line apps such as curl, ldapsearch, etc. fail if the server’s certificate is not trusted. Most of the time they won’t be due to the command not having a certificate store to check against. Using the openssl command, it’s possible to connect to the secure service and dump out its certificate. For example, the following will dump out the server’s certificate:

openssl s_client -connect example.com:443

You can also get the CA certificate by adding the -showcerts option:

openssl s_client -showcerts -connect example.com:443

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s