How to display a remote SSL certificate details using CLI tools?

Better Stack Team
Updated on November 9, 2023

You can use various command-line tools to display details of a remote SSL certificate. One common tool is openssl, which provides commands to fetch and examine SSL certificates.

Here's an example of how to use openssl s_client to view SSL certificate details of a remote server:

 
openssl s_client -connect example.com:443

Replace example.com with the domain name or IP address of the remote server you want to examine. This command initiates an SSL connection to the specified server and prints out the certificate details.

If you only want to see the certificate details without initiating an SSL connection, you can use the following:

 
echo | openssl s_client -showcerts -connect example.com:443 2>/dev/null | openssl x509 -text

This command will fetch the SSL certificate from the remote server and display its details.

Another method involves using the gnutls-cli tool:

 
gnutls-cli --print-cert example.com

Replace example.com with the domain name or IP address you wish to check.

Additionally, the curl command can be used to fetch and display the SSL certificate details:

 
curl -v <https://example.com>

This will display verbose output that includes SSL certificate information.

Remember to replace example.com with the actual domain you want to examine. These tools can provide detailed information about the SSL certificate, such as the certificate chain, expiration date, issuer information, and more.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github