jump to navigation

Get Remote SSL Certificate From Command Line on Linux February 23, 2011

Posted by Tournas Dimitrios in Linux.

Easy way to get the SSL certificate of a server from the command line in Linux. The nice thing about it is that you get the full certificate chain. Nice for troubleshooting issues.  After the “-connect”, specify the host and port you want to connect to.  TCP port 443 is the default https port.
openssl s_client -connect mail.google.com:443


1. Jsh - September 6, 2011

# If one is interested in just the certificate then following will do the needful
openssl s_client -connect mail.google.com mail.google.com.crt

Jsh - September 6, 2011

# earlier post got truncated, trying again
openssl s_client -connect mail.google.com:443 < /dev/null | sed -n ‘
}’ > mail.google.com.crt

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