Having TLS certificate in local file, I can display its details using syntax like:

openssl x509 -text -noout -in cert_filename

Is there any way to display remote SMTP/POP3/HTTP server's TLS certificate in this same format in bash terminal?


openssl s_client -connect server:port display some informations. Maybe is it sufficient for you. It is not exactly the same format, but it can help.

| improve this answer | |
  • You can also add -starttls PROTO if the protocol is not native SSL/TLS. For example, -starttls pop3. – a CVn Aug 8 '14 at 19:48

You can use OpenSSL's s_client command to dump the certificate in PEM format (and lots of other stuff, but -in doesn't seem to care about it). All you need is some output redirection to convince x509 to parse that:

openssl x509 -text -noout -in <(openssl s_client -connect server:443)
| improve this answer | |

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.