Establishing a TLS client connection on the command line
To establish a TLS client connection, we will use the s_client
subcommand of the openssl
tool. Its documentation can be found on its man
page:
$ man openssl-s_client
There is an HTTPS server on the internet to use as an example, https://example.org/. Let’s connect to it via TLS and get its home page:
$ openssl s_client -connect example.org:443
The openssl
tool will output a lot of information about how the TLS handshaking has gone, which cryptographic algorithms were used, and even the base64
-encoded server certificate will be printed.
We can also request verification of the server certificate and its hostname by adding the -verify_return_error
and -verify_hostname
command-line options:
$ openssl s_client \ -connect example.org:443 \ -verify_return_error \ -verify_hostname example.org
If you want to verify the server certificate...