Forrest logo
back to the openssl tool

openssl-s_client:tldr:c6144

openssl-s_client: Display the complete certificate chain of an HTTPS server.
$ openssl s_client -connect ${host}:443 -showcerts
try on your machine

This command is used to establish a secure SSL/TLS connection with a server and retrieve its SSL certificate. Let's break it down:

  • openssl is the command-line tool used for various cryptographic operations, including SSL/TLS.
  • s_client is a subcommand in OpenSSL that allows the client (your machine) to connect to an SSL/TLS server.
  • -connect ${host}:443 specifies the server's address and port to which the client should connect. This command assumes the host variable holds the domain name or IP address of the server. :443 is the default port used for secure HTTPS communication.
  • -showcerts tells s_client to display the server's SSL certificate(s) as part of the output.
  • </dev/null is a shell redirection that provides an empty input to the s_client command. This is done to prevent any potential interference from user input, as s_client typically waits for user input interactively.

Overall, this command establishes a connection to a server, retrieves the SSL certificate(s) presented by the server, and displays them on the terminal.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the openssl tool