view SSL certificate on ports 587, 25, 110, 465, 995, 143, 993

user1398287 picture user1398287 · Jul 31, 2012 · Viewed 37.4k times · Source

How can I view the SSL certificate details that is being used on ports 587, 25, 110, 465, 995, 143 & 993

I need to check which domain name is being used to secure these ports.

I've search here and on google but can't find anything!

Answer

Alessandro Menti picture Alessandro Menti · Jul 31, 2012

Use OpenSSL (installed by default on almost all Linux distributions, you can also get a binary build for Windows from Shining Light Productions):

openssl s_client -connect host:port -servername host [-starttls protocol]

where host is the host you want to connect to and port is the port number.

-servername host will include the host name in the TLS handshake (via the Server Name Indication extension), to allow servers hosting multiple protected resources on the same IP to choose the correct certificate.

The -starttls protocol part is needed only if the server you are checking starts a plain text session by default and switches to SSL/TLS later, when the client requests it (in this case, protocol must be one of smtp, pop3, imap, ftp, xmpp); you should check if your server configuration requires the switch and include the command line option accordingly.