NAME

openssl-s_client, s_client - SSL/TLS client program

SYNOPSIS

openssl s_client [-help] [-connect host:port] [-bind host:port] [-proxy host:port] [-unix path] [-4] [-6] [-servername name] [-noservername] [-verify depth] [-verify_return_error] [-cert filename] [-certform DER|PEM] [-key filename] [-keyform DER|PEM] [-cert_chain filename] [-build_chain] [-xkey] [-xcert] [-xchain] [-xchain_build] [-xcertform PEM|DER] [-xkeyform PEM|DER] [-pass arg] [-CApath directory] [-CAfile filename] [-chainCApath directory] [-chainCAfile filename] [-no-CAfile] [-no-CApath] [-requestCAfile filename] [-dane_tlsa_domain domain] [-dane_tlsa_rrdata rrdata] [-dane_ee_no_namechecks] [-attime timestamp] [-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map] [-no_check_time] [-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num] [-nameopt option] [-verify_depth num] [-verify_email email] [-verify_hostname hostname] [-verify_ip ip] [-verify_name name] [-build_chain] [-x509_strict] [-reconnect] [-showcerts] [-debug] [-msg] [-nbio_test] [-state] [-nbio] [-crlf] [-ign_eof] [-no_ign_eof] [-psk_identity identity] [-psk key] [-psk_session file] [-quiet] [-ssl3] [-tls1] [-tls1_1] [-tls1_2] [-tls1_3] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2] [-no_tls1_3] [-dtls] [-dtls1] [-dtls1_2] [-sctp] [-sctp_label_bug] [-fallback_scsv] [-async] [-max_send_frag] [-split_send_frag] [-max_pipelines] [-read_buf] [-bugs] [-comp] [-no_comp] [-allow_no_dhe_kex] [-sigalgs sigalglist] [-curves curvelist] [-cipher cipherlist] [-ciphersuites val] [-serverpref] [-starttls protocol] [-xmpphost hostname] [-name hostname] [-engine id] [-tlsextdebug] [-no_ticket] [-sess_out filename] [-sess_in filename] [-rand file...] [-writerand file] [-serverinfo types] [-status] [-alpn protocols] [-nextprotoneg protocols] [-ct] [-noct] [-ctlogfile] [-keylogfile file] [-early_data file] [-enable_pha] [target]

DESCRIPTION

The s_client command implements a generic SSL/TLS client which connects to a remote host using SSL/TLS. It is a very useful diagnostic tool for SSL servers.

OPTIONS

In addition to the options below the s_client utility also supports the common and client only options documented in the Supported Command Line Commands section of the SSL_CONF_cmd (3) manual page.

CONNECTED COMMANDS

If a connection is established with an SSL server then any data received from the server is displayed and any key presses will be sent to the server. If end of file is reached then the connection will be closed down. When used interactively (which means neither -quiet nor -ign_eof have been given), then certain commands are also recognized which perform special operations. These commands are a letter which must appear at the start of a line. They are listed below.

  1. End the current SSL connection and exit.

  2. Renegotiate the SSL session (TLSv1.2 and below only).

  3. Send a heartbeat message to the server (DTLS only)

  1. Send a key update message to the server (TLSv1.3 only)

  1. Send a key update message to the server and request one back (TLSv1.3 only)

NOTES

s_client can be used to debug SSL servers. To connect to an SSL HTTP server the command:

openssl s_client -connect servername:443

would typically be used (https uses port 443). If the connection succeeds then an HTTP command can be given such as GET / to retrieve a web page.

If the handshake fails then there are several possible causes, if it is nothing obvious like no client certificate then the -bugs, -ssl3, -tls1, -no_ssl3, -no_tls1 options can be tried in case it is a buggy server. In particular you should play with these options before submitting a bug report to an OpenSSL mailing list.

A frequent problem when attempting to get client certificates working is that a web client complains it has no certificates or gives an empty list to choose from. This is normally because the server is not sending the clients certificate authority in its acceptable CA list when it requests a certificate. By using s_client the CA list can be viewed and checked. However, some servers only request client authentication after a specific URL is requested. To obtain the list in this case it is necessary to use the -prexit option and send an HTTP request for an appropriate page.

If a certificate is specified on the command line using the -cert option it will not be used unless the server specifically requests a client certificate. Therefore, merely including a client certificate on the command line is no guarantee that the certificate works.

If there are problems verifying a server certificate then the -showcerts option can be used to show all the certificates sent by the server.

The s_client utility is a test tool and is designed to continue the handshake after any certificate verification errors. As a result it will accept any certificate chain (trusted or not) sent by the peer. Non-test applications should not do this as it makes them vulnerable to a MITM attack. This behaviour can be changed by with the -verify_return_error option: any verify errors are then returned aborting the handshake.

The -bind option may be useful if the server or a firewall requires connections to come from some particular address and or port.

BUGS

Because this program has a lot of options and also because some of the techniques used are rather old, the C source of s_client is rather hard to read and not a model of how things should be done. A typical SSL client program would be much simpler.

The -prexit option is a bit of a hack. We should really report information whenever a session is renegotiated.

SEE ALSO

SSL_CONF_cmd (3), sess_id (1), s_server (1), ciphers (1), SSL_CTX_set_max_send_fragment (3), SSL_CTX_set_split_send_fragment (3), SSL_CTX_set_max_pipelines (3)

HISTORY

The -no_alt_chains option was added in OpenSSL 1.1.0. The -name option was added in OpenSSL 1.1.1.

COPYRIGHT

Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the OpenSSL license (the License). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.