Marco Bravo

Logo

Marco Bravo's DEV Profile If you don’t know, ask – if you know, share! ~ opensource mindset Baseball ball image


➠ "We may not have control over our circumstances, but we do have control over our minds"
➠ What do I want to do next?
Cloud and rainbow image

View My GitHub Profile

14 February 2020

Display a remote SSL certificate details using CLI tools

by Marco Bravo

SSL certificate image

Get the full certificate information form a command line tool.

echo | openssl s_client -showcerts -servername gnupg.org -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text

Improvement.

echo | openssl s_client -showcerts -servername gnupg.org -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text | grep "Not After" | sed 's/$/ - gnupg.org/'

With result:

Not After : Apr  3 00:55:19 2020 GMT - gnupg.org

Reference for servername.

Essentially it works a little like a “Host” header in HTTP, i.e. it causes the requested domain name to be passed as part of the SSL/TLS handshake (in the SNI - Server Name Indication extension). A server can then host multiple domains behind a single IP. It will respond with the appropriate certificate based on the requested domain name.

Full article

tags: ssl - certificat - command - line - tools