Blame doc/man1/s_client.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
openssl-s_client,
Packit c4476c
s_client - SSL/TLS client program
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
B<openssl> B<s_client>
Packit c4476c
[B<-help>]
Packit c4476c
[B<-connect host:port>]
Packit c4476c
[B<-bind host:port>]
Packit c4476c
[B<-proxy host:port>]
Packit c4476c
[B<-unix path>]
Packit c4476c
[B<-4>]
Packit c4476c
[B<-6>]
Packit c4476c
[B<-servername name>]
Packit c4476c
[B<-noservername>]
Packit c4476c
[B<-verify depth>]
Packit c4476c
[B<-verify_return_error>]
Packit c4476c
[B<-cert filename>]
Packit c4476c
[B<-certform DER|PEM>]
Packit c4476c
[B<-key filename>]
Packit c4476c
[B<-keyform DER|PEM>]
Packit c4476c
[B<-cert_chain filename>]
Packit c4476c
[B<-build_chain>]
Packit c4476c
[B<-xkey>]
Packit c4476c
[B<-xcert>]
Packit c4476c
[B<-xchain>]
Packit c4476c
[B<-xchain_build>]
Packit c4476c
[B<-xcertform PEM|DER>]
Packit c4476c
[B<-xkeyform PEM|DER>]
Packit c4476c
[B<-pass arg>]
Packit c4476c
[B<-CApath directory>]
Packit c4476c
[B<-CAfile filename>]
Packit c4476c
[B<-chainCApath directory>]
Packit c4476c
[B<-chainCAfile filename>]
Packit c4476c
[B<-no-CAfile>]
Packit c4476c
[B<-no-CApath>]
Packit c4476c
[B<-requestCAfile filename>]
Packit c4476c
[B<-dane_tlsa_domain domain>]
Packit c4476c
[B<-dane_tlsa_rrdata rrdata>]
Packit c4476c
[B<-dane_ee_no_namechecks>]
Packit c4476c
[B<-attime timestamp>]
Packit c4476c
[B<-check_ss_sig>]
Packit c4476c
[B<-crl_check>]
Packit c4476c
[B<-crl_check_all>]
Packit c4476c
[B<-explicit_policy>]
Packit c4476c
[B<-extended_crl>]
Packit c4476c
[B<-ignore_critical>]
Packit c4476c
[B<-inhibit_any>]
Packit c4476c
[B<-inhibit_map>]
Packit c4476c
[B<-no_check_time>]
Packit c4476c
[B<-partial_chain>]
Packit c4476c
[B<-policy arg>]
Packit c4476c
[B<-policy_check>]
Packit c4476c
[B<-policy_print>]
Packit c4476c
[B<-purpose purpose>]
Packit c4476c
[B<-suiteB_128>]
Packit c4476c
[B<-suiteB_128_only>]
Packit c4476c
[B<-suiteB_192>]
Packit c4476c
[B<-trusted_first>]
Packit c4476c
[B<-no_alt_chains>]
Packit c4476c
[B<-use_deltas>]
Packit c4476c
[B<-auth_level num>]
Packit c4476c
[B<-nameopt option>]
Packit c4476c
[B<-verify_depth num>]
Packit c4476c
[B<-verify_email email>]
Packit c4476c
[B<-verify_hostname hostname>]
Packit c4476c
[B<-verify_ip ip>]
Packit c4476c
[B<-verify_name name>]
Packit c4476c
[B<-build_chain>]
Packit c4476c
[B<-x509_strict>]
Packit c4476c
[B<-reconnect>]
Packit c4476c
[B<-showcerts>]
Packit c4476c
[B<-debug>]
Packit c4476c
[B<-msg>]
Packit c4476c
[B<-nbio_test>]
Packit c4476c
[B<-state>]
Packit c4476c
[B<-nbio>]
Packit c4476c
[B<-crlf>]
Packit c4476c
[B<-ign_eof>]
Packit c4476c
[B<-no_ign_eof>]
Packit c4476c
[B<-psk_identity identity>]
Packit c4476c
[B<-psk key>]
Packit c4476c
[B<-psk_session file>]
Packit c4476c
[B<-quiet>]
Packit c4476c
[B<-ssl3>]
Packit c4476c
[B<-tls1>]
Packit c4476c
[B<-tls1_1>]
Packit c4476c
[B<-tls1_2>]
Packit c4476c
[B<-tls1_3>]
Packit c4476c
[B<-no_ssl3>]
Packit c4476c
[B<-no_tls1>]
Packit c4476c
[B<-no_tls1_1>]
Packit c4476c
[B<-no_tls1_2>]
Packit c4476c
[B<-no_tls1_3>]
Packit c4476c
[B<-dtls>]
Packit c4476c
[B<-dtls1>]
Packit c4476c
[B<-dtls1_2>]
Packit c4476c
[B<-sctp>]
Packit c4476c
[B<-sctp_label_bug>]
Packit c4476c
[B<-fallback_scsv>]
Packit c4476c
[B<-async>]
Packit c4476c
[B<-max_send_frag>]
Packit c4476c
[B<-split_send_frag>]
Packit c4476c
[B<-max_pipelines>]
Packit c4476c
[B<-read_buf>]
Packit c4476c
[B<-bugs>]
Packit c4476c
[B<-comp>]
Packit c4476c
[B<-no_comp>]
Packit c4476c
[B<-allow_no_dhe_kex>]
Packit c4476c
[B<-sigalgs sigalglist>]
Packit c4476c
[B<-curves curvelist>]
Packit c4476c
[B<-cipher cipherlist>]
Packit c4476c
[B<-ciphersuites val>]
Packit c4476c
[B<-serverpref>]
Packit c4476c
[B<-starttls protocol>]
Packit c4476c
[B<-xmpphost hostname>]
Packit c4476c
[B<-name hostname>]
Packit c4476c
[B<-engine id>]
Packit c4476c
[B<-tlsextdebug>]
Packit c4476c
[B<-no_ticket>]
Packit c4476c
[B<-sess_out filename>]
Packit c4476c
[B<-sess_in filename>]
Packit c4476c
[B<-rand file...>]
Packit c4476c
[B<-writerand file>]
Packit c4476c
[B<-serverinfo types>]
Packit c4476c
[B<-status>]
Packit c4476c
[B<-alpn protocols>]
Packit c4476c
[B<-nextprotoneg protocols>]
Packit c4476c
[B<-ct>]
Packit c4476c
[B<-noct>]
Packit c4476c
[B<-ctlogfile>]
Packit c4476c
[B<-keylogfile file>]
Packit c4476c
[B<-early_data file>]
Packit c4476c
[B<-enable_pha>]
Packit c4476c
[B<target>]
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
The B<s_client> command implements a generic SSL/TLS client which connects
Packit c4476c
to a remote host using SSL/TLS. It is a I<very> useful diagnostic tool for
Packit c4476c
SSL servers.
Packit c4476c
Packit c4476c
=head1 OPTIONS
Packit c4476c
Packit c4476c
In addition to the options below the B<s_client> utility also supports the
Packit c4476c
common and client only options documented
Packit c4476c
in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
Packit c4476c
manual page.
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item B<-help>
Packit c4476c
Packit c4476c
Print out a usage message.
Packit c4476c
Packit c4476c
=item B<-connect host:port>
Packit c4476c
Packit c4476c
This specifies the host and optional port to connect to. It is possible to
Packit c4476c
select the host and port using the optional target positional argument instead.
Packit c4476c
If neither this nor the target positional argument are specified then an attempt
Packit c4476c
is made to connect to the local host on port 4433.
Packit c4476c
Packit c4476c
=item B<-bind host:port>]
Packit c4476c
Packit c4476c
This specifies the host address and or port to bind as the source for the
Packit c4476c
connection.  For Unix-domain sockets the port is ignored and the host is
Packit c4476c
used as the source socket address.
Packit c4476c
Packit c4476c
=item B<-proxy host:port>
Packit c4476c
Packit c4476c
When used with the B<-connect> flag, the program uses the host and port
Packit c4476c
specified with this flag and issues an HTTP CONNECT command to connect
Packit c4476c
to the desired server.
Packit c4476c
Packit c4476c
=item B<-unix path>
Packit c4476c
Packit c4476c
Connect over the specified Unix-domain socket.
Packit c4476c
Packit c4476c
=item B<-4>
Packit c4476c
Packit c4476c
Use IPv4 only.
Packit c4476c
Packit c4476c
=item B<-6>
Packit c4476c
Packit c4476c
Use IPv6 only.
Packit c4476c
Packit c4476c
=item B<-servername name>
Packit c4476c
Packit c4476c
Set the TLS SNI (Server Name Indication) extension in the ClientHello message to
Packit c4476c
the given value. 
Packit c4476c
If B<-servername> is not provided, the TLS SNI extension will be populated with 
Packit c4476c
the name given to B<-connect> if it follows a DNS name format. If B<-connect> is 
Packit c4476c
not provided either, the SNI is set to "localhost".
Packit c4476c
This is the default since OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
Even though SNI should normally be a DNS name and not an IP address, if 
Packit c4476c
B<-servername> is provided then that name will be sent, regardless of whether 
Packit c4476c
it is a DNS name or not.
Packit c4476c
Packit c4476c
This option cannot be used in conjunction with B<-noservername>.
Packit c4476c
Packit c4476c
=item B<-noservername>
Packit c4476c
Packit c4476c
Suppresses sending of the SNI (Server Name Indication) extension in the
Packit c4476c
ClientHello message. Cannot be used in conjunction with the B<-servername> or
Packit c4476c
<-dane_tlsa_domain> options.
Packit c4476c
Packit c4476c
=item B<-cert certname>
Packit c4476c
Packit c4476c
The certificate to use, if one is requested by the server. The default is
Packit c4476c
not to use a certificate.
Packit c4476c
Packit c4476c
=item B<-certform format>
Packit c4476c
Packit c4476c
The certificate format to use: DER or PEM. PEM is the default.
Packit c4476c
Packit c4476c
=item B<-key keyfile>
Packit c4476c
Packit c4476c
The private key to use. If not specified then the certificate file will
Packit c4476c
be used.
Packit c4476c
Packit c4476c
=item B<-keyform format>
Packit c4476c
Packit c4476c
The private format to use: DER or PEM. PEM is the default.
Packit c4476c
Packit c4476c
=item B<-cert_chain>
Packit c4476c
Packit c4476c
A file containing trusted certificates to use when attempting to build the
Packit c4476c
client/server certificate chain related to the certificate specified via the
Packit c4476c
B<-cert> option.
Packit c4476c
Packit c4476c
=item B<-build_chain>
Packit c4476c
Packit c4476c
Specify whether the application should build the certificate chain to be
Packit c4476c
provided to the server.
Packit c4476c
Packit c4476c
=item B<-xkey infile>, B<-xcert infile>, B<-xchain>
Packit c4476c
Packit c4476c
Specify an extra certificate, private key and certificate chain. These behave
Packit c4476c
in the same manner as the B<-cert>, B<-key> and B<-cert_chain> options.  When
Packit c4476c
specified, the callback returning the first valid chain will be in use by the
Packit c4476c
client.
Packit c4476c
Packit c4476c
=item B<-xchain_build>
Packit c4476c
Packit c4476c
Specify whether the application should build the certificate chain to be
Packit c4476c
provided to the server for the extra certificates provided via B<-xkey infile>,
Packit c4476c
B<-xcert infile>, B<-xchain> options.
Packit c4476c
Packit c4476c
=item B<-xcertform PEM|DER>, B<-xkeyform PEM|DER>
Packit c4476c
Packit c4476c
Extra certificate and private key format respectively.
Packit c4476c
Packit c4476c
=item B<-pass arg>
Packit c4476c
Packit c4476c
the private key password source. For more information about the format of B<arg>
Packit c4476c
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
Packit c4476c
Packit c4476c
=item B<-verify depth>
Packit c4476c
Packit c4476c
The verify depth to use. This specifies the maximum length of the
Packit c4476c
server certificate chain and turns on server certificate verification.
Packit c4476c
Currently the verify operation continues after errors so all the problems
Packit c4476c
with a certificate chain can be seen. As a side effect the connection
Packit c4476c
will never fail due to a server certificate verify failure.
Packit c4476c
Packit c4476c
=item B<-verify_return_error>
Packit c4476c
Packit c4476c
Return verification errors instead of continuing. This will typically
Packit c4476c
abort the handshake with a fatal error.
Packit c4476c
Packit c4476c
=item B<-nameopt option>
Packit c4476c
Packit c4476c
Option which determines how the subject or issuer names are displayed. The
Packit c4476c
B<option> argument can be a single option or multiple options separated by
Packit c4476c
commas.  Alternatively the B<-nameopt> switch may be used more than once to
Packit c4476c
set multiple options. See the L<x509(1)> manual page for details.
Packit c4476c
Packit c4476c
=item B<-CApath directory>
Packit c4476c
Packit c4476c
The directory to use for server certificate verification. This directory
Packit c4476c
must be in "hash format", see L<verify(1)> for more information. These are
Packit c4476c
also used when building the client certificate chain.
Packit c4476c
Packit c4476c
=item B<-CAfile file>
Packit c4476c
Packit c4476c
A file containing trusted certificates to use during server authentication
Packit c4476c
and to use when attempting to build the client certificate chain.
Packit c4476c
Packit c4476c
=item B<-chainCApath directory>
Packit c4476c
Packit c4476c
The directory to use for building the chain provided to the server. This
Packit c4476c
directory must be in "hash format", see L<verify(1)> for more information.
Packit c4476c
Packit c4476c
=item B<-chainCAfile file>
Packit c4476c
Packit c4476c
A file containing trusted certificates to use when attempting to build the
Packit c4476c
client certificate chain.
Packit c4476c
Packit c4476c
=item B<-no-CAfile>
Packit c4476c
Packit c4476c
Do not load the trusted CA certificates from the default file location
Packit c4476c
Packit c4476c
=item B<-no-CApath>
Packit c4476c
Packit c4476c
Do not load the trusted CA certificates from the default directory location
Packit c4476c
Packit c4476c
=item B<-requestCAfile file>
Packit c4476c
Packit c4476c
A file containing a list of certificates whose subject names will be sent
Packit c4476c
to the server in the B<certificate_authorities> extension. Only supported
Packit c4476c
for TLS 1.3
Packit c4476c
Packit c4476c
=item B<-dane_tlsa_domain domain>
Packit c4476c
Packit c4476c
Enable RFC6698/RFC7671 DANE TLSA authentication and specify the
Packit c4476c
TLSA base domain which becomes the default SNI hint and the primary
Packit c4476c
reference identifier for hostname checks.  This must be used in
Packit c4476c
combination with at least one instance of the B<-dane_tlsa_rrdata>
Packit c4476c
option below.
Packit c4476c
Packit c4476c
When DANE authentication succeeds, the diagnostic output will include
Packit c4476c
the lowest (closest to 0) depth at which a TLSA record authenticated
Packit c4476c
a chain certificate.  When that TLSA record is a "2 1 0" trust
Packit c4476c
anchor public key that signed (rather than matched) the top-most
Packit c4476c
certificate of the chain, the result is reported as "TA public key
Packit c4476c
verified".  Otherwise, either the TLSA record "matched TA certificate"
Packit c4476c
at a positive depth or else "matched EE certificate" at depth 0.
Packit c4476c
Packit c4476c
=item B<-dane_tlsa_rrdata rrdata>
Packit c4476c
Packit c4476c
Use one or more times to specify the RRDATA fields of the DANE TLSA
Packit c4476c
RRset associated with the target service.  The B<rrdata> value is
Packit c4476c
specified in "presentation form", that is four whitespace separated
Packit c4476c
fields that specify the usage, selector, matching type and associated
Packit c4476c
data, with the last of these encoded in hexadecimal.  Optional
Packit c4476c
whitespace is ignored in the associated data field.  For example:
Packit c4476c
Packit c4476c
  $ openssl s_client -brief -starttls smtp \
Packit c4476c
    -connect smtp.example.com:25 \
Packit c4476c
    -dane_tlsa_domain smtp.example.com \
Packit c4476c
    -dane_tlsa_rrdata "2 1 1
Packit c4476c
      B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
Packit c4476c
    -dane_tlsa_rrdata "2 1 1
Packit c4476c
      60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
Packit c4476c
  ...
Packit c4476c
  Verification: OK
Packit c4476c
  Verified peername: smtp.example.com
Packit c4476c
  DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
Packit c4476c
  ...
Packit c4476c
Packit c4476c
=item B<-dane_ee_no_namechecks>
Packit c4476c
Packit c4476c
This disables server name checks when authenticating via DANE-EE(3) TLSA
Packit c4476c
records.
Packit c4476c
For some applications, primarily web browsers, it is not safe to disable name
Packit c4476c
checks due to "unknown key share" attacks, in which a malicious server can
Packit c4476c
convince a client that a connection to a victim server is instead a secure
Packit c4476c
connection to the malicious server.
Packit c4476c
The malicious server may then be able to violate cross-origin scripting
Packit c4476c
restrictions.
Packit c4476c
Thus, despite the text of RFC7671, name checks are by default enabled for
Packit c4476c
DANE-EE(3) TLSA records, and can be disabled in applications where it is safe
Packit c4476c
to do so.
Packit c4476c
In particular, SMTP and XMPP clients should set this option as SRV and MX
Packit c4476c
records already make it possible for a remote domain to redirect client
Packit c4476c
connections to any server of its choice, and in any case SMTP and XMPP clients
Packit c4476c
do not execute scripts downloaded from remote servers.
Packit c4476c
Packit c4476c
=item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
Packit c4476c
B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
Packit c4476c
B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
Packit c4476c
B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
Packit c4476c
B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
Packit c4476c
B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
Packit c4476c
B<-verify_ip>, B<-verify_name>, B<-x509_strict>
Packit c4476c
Packit c4476c
Set various certificate chain validation options. See the
Packit c4476c
L<verify(1)> manual page for details.
Packit c4476c
Packit c4476c
=item B<-reconnect>
Packit c4476c
Packit c4476c
Reconnects to the same server 5 times using the same session ID, this can
Packit c4476c
be used as a test that session caching is working.
Packit c4476c
Packit c4476c
=item B<-showcerts>
Packit c4476c
Packit c4476c
Displays the server certificate list as sent by the server: it only consists of
Packit c4476c
certificates the server has sent (in the order the server has sent them). It is
Packit c4476c
B<not> a verified chain.
Packit c4476c
Packit c4476c
=item B<-prexit>
Packit c4476c
Packit c4476c
Print session information when the program exits. This will always attempt
Packit c4476c
to print out information even if the connection fails. Normally information
Packit c4476c
will only be printed out once if the connection succeeds. This option is useful
Packit c4476c
because the cipher in use may be renegotiated or the connection may fail
Packit c4476c
because a client certificate is required or is requested only after an
Packit c4476c
attempt is made to access a certain URL. Note: the output produced by this
Packit c4476c
option is not always accurate because a connection might never have been
Packit c4476c
established.
Packit c4476c
Packit c4476c
=item B<-state>
Packit c4476c
Packit c4476c
Prints out the SSL session states.
Packit c4476c
Packit c4476c
=item B<-debug>
Packit c4476c
Packit c4476c
Print extensive debugging information including a hex dump of all traffic.
Packit c4476c
Packit c4476c
=item B<-msg>
Packit c4476c
Packit c4476c
Show all protocol messages with hex dump.
Packit c4476c
Packit c4476c
=item B<-trace>
Packit c4476c
Packit c4476c
Show verbose trace output of protocol messages. OpenSSL needs to be compiled
Packit c4476c
with B<enable-ssl-trace> for this option to work.
Packit c4476c
Packit c4476c
=item B<-msgfile>
Packit c4476c
Packit c4476c
File to send output of B<-msg> or B<-trace> to, default standard output.
Packit c4476c
Packit c4476c
=item B<-nbio_test>
Packit c4476c
Packit c4476c
Tests non-blocking I/O
Packit c4476c
Packit c4476c
=item B<-nbio>
Packit c4476c
Packit c4476c
Turns on non-blocking I/O
Packit c4476c
Packit c4476c
=item B<-crlf>
Packit c4476c
Packit c4476c
This option translated a line feed from the terminal into CR+LF as required
Packit c4476c
by some servers.
Packit c4476c
Packit c4476c
=item B<-ign_eof>
Packit c4476c
Packit c4476c
Inhibit shutting down the connection when end of file is reached in the
Packit c4476c
input.
Packit c4476c
Packit c4476c
=item B<-quiet>
Packit c4476c
Packit c4476c
Inhibit printing of session and certificate information.  This implicitly
Packit c4476c
turns on B<-ign_eof> as well.
Packit c4476c
Packit c4476c
=item B<-no_ign_eof>
Packit c4476c
Packit c4476c
Shut down the connection when end of file is reached in the input.
Packit c4476c
Can be used to override the implicit B<-ign_eof> after B<-quiet>.
Packit c4476c
Packit c4476c
=item B<-psk_identity identity>
Packit c4476c
Packit c4476c
Use the PSK identity B<identity> when using a PSK cipher suite.
Packit c4476c
The default value is "Client_identity" (without the quotes).
Packit c4476c
Packit c4476c
=item B<-psk key>
Packit c4476c
Packit c4476c
Use the PSK key B<key> when using a PSK cipher suite. The key is
Packit c4476c
given as a hexadecimal number without leading 0x, for example -psk
Packit c4476c
1a2b3c4d.
Packit c4476c
This option must be provided in order to use a PSK cipher.
Packit c4476c
Packit c4476c
=item B<-psk_session file>
Packit c4476c
Packit c4476c
Use the pem encoded SSL_SESSION data stored in B<file> as the basis of a PSK.
Packit c4476c
Note that this will only work if TLSv1.3 is negotiated.
Packit c4476c
Packit c4476c
=item B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-tls1_3>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2>, B<-no_tls1_3>
Packit c4476c
Packit c4476c
These options require or disable the use of the specified SSL or TLS protocols.
Packit c4476c
By default B<s_client> will negotiate the highest mutually supported protocol
Packit c4476c
version.
Packit c4476c
When a specific TLS version is required, only that version will be offered to
Packit c4476c
and accepted from the server.
Packit c4476c
Note that not all protocols and flags may be available, depending on how
Packit c4476c
OpenSSL was built.
Packit c4476c
Packit c4476c
=item B<-dtls>, B<-dtls1>, B<-dtls1_2>
Packit c4476c
Packit c4476c
These options make B<s_client> use DTLS protocols instead of TLS.
Packit c4476c
With B<-dtls>, B<s_client> will negotiate any supported DTLS protocol version,
Packit c4476c
whilst B<-dtls1> and B<-dtls1_2> will only support DTLS1.0 and DTLS1.2
Packit c4476c
respectively.
Packit c4476c
Packit c4476c
=item B<-sctp>
Packit c4476c
Packit c4476c
Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
Packit c4476c
conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
Packit c4476c
available where OpenSSL has support for SCTP enabled.
Packit c4476c
Packit c4476c
=item B<-sctp_label_bug>
Packit c4476c
Packit c4476c
Use the incorrect behaviour of older OpenSSL implementations when computing
Packit c4476c
endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
Packit c4476c
older broken implementations but breaks interoperability with correct
Packit c4476c
implementations. Must be used in conjunction with B<-sctp>. This option is only
Packit c4476c
available where OpenSSL has support for SCTP enabled.
Packit c4476c
Packit c4476c
=item B<-fallback_scsv>
Packit c4476c
Packit c4476c
Send TLS_FALLBACK_SCSV in the ClientHello.
Packit c4476c
Packit c4476c
=item B<-async>
Packit c4476c
Packit c4476c
Switch on asynchronous mode. Cryptographic operations will be performed
Packit c4476c
asynchronously. This will only have an effect if an asynchronous capable engine
Packit c4476c
is also used via the B<-engine> option. For test purposes the dummy async engine
Packit c4476c
(dasync) can be used (if available).
Packit c4476c
Packit c4476c
=item B<-max_send_frag int>
Packit c4476c
Packit c4476c
The maximum size of data fragment to send.
Packit c4476c
See L<SSL_CTX_set_max_send_fragment(3)> for further information.
Packit c4476c
Packit c4476c
=item B<-split_send_frag int>
Packit c4476c
Packit c4476c
The size used to split data for encrypt pipelines. If more data is written in
Packit c4476c
one go than this value then it will be split into multiple pipelines, up to the
Packit c4476c
maximum number of pipelines defined by max_pipelines. This only has an effect if
Packit c4476c
a suitable cipher suite has been negotiated, an engine that supports pipelining
Packit c4476c
has been loaded, and max_pipelines is greater than 1. See
Packit c4476c
L<SSL_CTX_set_split_send_fragment(3)> for further information.
Packit c4476c
Packit c4476c
=item B<-max_pipelines int>
Packit c4476c
Packit c4476c
The maximum number of encrypt/decrypt pipelines to be used. This will only have
Packit c4476c
an effect if an engine has been loaded that supports pipelining (e.g. the dasync
Packit c4476c
engine) and a suitable cipher suite has been negotiated. The default value is 1.
Packit c4476c
See L<SSL_CTX_set_max_pipelines(3)> for further information.
Packit c4476c
Packit c4476c
=item B<-read_buf int>
Packit c4476c
Packit c4476c
The default read buffer size to be used for connections. This will only have an
Packit c4476c
effect if the buffer size is larger than the size that would otherwise be used
Packit c4476c
and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
Packit c4476c
further information).
Packit c4476c
Packit c4476c
=item B<-bugs>
Packit c4476c
Packit c4476c
There are several known bugs in SSL and TLS implementations. Adding this
Packit c4476c
option enables various workarounds.
Packit c4476c
Packit c4476c
=item B<-comp>
Packit c4476c
Packit c4476c
Enables support for SSL/TLS compression.
Packit c4476c
This option was introduced in OpenSSL 1.1.0.
Packit c4476c
TLS compression is not recommended and is off by default as of
Packit c4476c
OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=item B<-no_comp>
Packit c4476c
Packit c4476c
Disables support for SSL/TLS compression.
Packit c4476c
TLS compression is not recommended and is off by default as of
Packit c4476c
OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=item B<-brief>
Packit c4476c
Packit c4476c
Only provide a brief summary of connection parameters instead of the
Packit c4476c
normal verbose output.
Packit c4476c
Packit c4476c
=item B<-sigalgs sigalglist>
Packit c4476c
Packit c4476c
Specifies the list of signature algorithms that are sent by the client.
Packit c4476c
The server selects one entry in the list based on its preferences.
Packit c4476c
For example strings, see L<SSL_CTX_set1_sigalgs(3)>
Packit c4476c
Packit c4476c
=item B<-curves curvelist>
Packit c4476c
Packit c4476c
Specifies the list of supported curves to be sent by the client. The curve is
Packit c4476c
ultimately selected by the server. For a list of all curves, use:
Packit c4476c
Packit c4476c
    $ openssl ecparam -list_curves
Packit c4476c
Packit c4476c
=item B<-cipher cipherlist>
Packit c4476c
Packit c4476c
This allows the TLSv1.2 and below cipher list sent by the client to be modified.
Packit c4476c
This list will be combined with any TLSv1.3 ciphersuites that have been
Packit c4476c
configured. Although the server determines which ciphersuite is used it should
Packit c4476c
take the first supported cipher in the list sent by the client. See the
Packit c4476c
B<ciphers> command for more information.
Packit c4476c
Packit c4476c
=item B<-ciphersuites val>
Packit c4476c
Packit c4476c
This allows the TLSv1.3 ciphersuites sent by the client to be modified. This
Packit c4476c
list will be combined with any TLSv1.2 and below ciphersuites that have been
Packit c4476c
configured. Although the server determines which cipher suite is used it should
Packit c4476c
take the first supported cipher in the list sent by the client. See the
Packit c4476c
B<ciphers> command for more information. The format for this list is a simple
Packit c4476c
colon (":") separated list of TLSv1.3 ciphersuite names.
Packit c4476c
Packit c4476c
=item B<-starttls protocol>
Packit c4476c
Packit c4476c
Send the protocol-specific message(s) to switch to TLS for communication.
Packit c4476c
B<protocol> is a keyword for the intended protocol.  Currently, the only
Packit c4476c
supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
Packit c4476c
"irc", "postgres", "mysql", "lmtp", "nntp", "sieve" and "ldap".
Packit c4476c
Packit c4476c
=item B<-xmpphost hostname>
Packit c4476c
Packit c4476c
This option, when used with "-starttls xmpp" or "-starttls xmpp-server",
Packit c4476c
specifies the host for the "to" attribute of the stream element.
Packit c4476c
If this option is not specified, then the host specified with "-connect"
Packit c4476c
will be used.
Packit c4476c
Packit c4476c
This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
Packit c4476c
Packit c4476c
=item B<-name hostname>
Packit c4476c
Packit c4476c
This option is used to specify hostname information for various protocols
Packit c4476c
used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
Packit c4476c
"smtp" and "lmtp" can utilize this B<-name> option.
Packit c4476c
Packit c4476c
If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
Packit c4476c
if specifies the host for the "to" attribute of the stream element. If this
Packit c4476c
option is not specified, then the host specified with "-connect" will be used.
Packit c4476c
Packit c4476c
If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
Packit c4476c
the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
Packit c4476c
this option is not specified, then "mail.example.com" will be used.
Packit c4476c
Packit c4476c
=item B<-tlsextdebug>
Packit c4476c
Packit c4476c
Print out a hex dump of any TLS extensions received from the server.
Packit c4476c
Packit c4476c
=item B<-no_ticket>
Packit c4476c
Packit c4476c
Disable RFC4507bis session ticket support.
Packit c4476c
Packit c4476c
=item B<-sess_out filename>
Packit c4476c
Packit c4476c
Output SSL session to B<filename>.
Packit c4476c
Packit c4476c
=item B<-sess_in sess.pem>
Packit c4476c
Packit c4476c
Load SSL session from B<filename>. The client will attempt to resume a
Packit c4476c
connection from this session.
Packit c4476c
Packit c4476c
=item B<-engine id>
Packit c4476c
Packit c4476c
Specifying an engine (by its unique B<id> string) will cause B<s_client>
Packit c4476c
to attempt to obtain a functional reference to the specified engine,
Packit c4476c
thus initialising it if needed. The engine will then be set as the default
Packit c4476c
for all available algorithms.
Packit c4476c
Packit c4476c
=item B<-rand file...>
Packit c4476c
Packit c4476c
A file or files containing random data used to seed the random number
Packit c4476c
generator.
Packit c4476c
Multiple files can be specified separated by an OS-dependent character.
Packit c4476c
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
Packit c4476c
all others.
Packit c4476c
Packit c4476c
=item [B<-writerand file>]
Packit c4476c
Packit c4476c
Writes random data to the specified I<file> upon exit.
Packit c4476c
This can be used with a subsequent B<-rand> flag.
Packit c4476c
Packit c4476c
=item B<-serverinfo types>
Packit c4476c
Packit c4476c
A list of comma-separated TLS Extension Types (numbers between 0 and
Packit c4476c
65535).  Each type will be sent as an empty ClientHello TLS Extension.
Packit c4476c
The server's response (if any) will be encoded and displayed as a PEM
Packit c4476c
file.
Packit c4476c
Packit c4476c
=item B<-status>
Packit c4476c
Packit c4476c
Sends a certificate status request to the server (OCSP stapling). The server
Packit c4476c
response (if any) is printed out.
Packit c4476c
Packit c4476c
=item B<-alpn protocols>, B<-nextprotoneg protocols>
Packit c4476c
Packit c4476c
These flags enable the Enable the Application-Layer Protocol Negotiation
Packit c4476c
or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
Packit c4476c
IETF standard and replaces NPN.
Packit c4476c
The B<protocols> list is a comma-separated list of protocol names that
Packit c4476c
the client should advertise support for. The list should contain the most
Packit c4476c
desirable protocols first.  Protocol names are printable ASCII strings,
Packit c4476c
for example "http/1.1" or "spdy/3".
Packit c4476c
An empty list of protocols is treated specially and will cause the
Packit c4476c
client to advertise support for the TLS extension but disconnect just
Packit c4476c
after receiving ServerHello with a list of server supported protocols.
Packit c4476c
The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
Packit c4476c
Packit c4476c
=item B<-ct>, B<-noct>
Packit c4476c
Packit c4476c
Use one of these two options to control whether Certificate Transparency (CT)
Packit c4476c
is enabled (B<-ct>) or disabled (B<-noct>).
Packit c4476c
If CT is enabled, signed certificate timestamps (SCTs) will be requested from
Packit c4476c
the server and reported at handshake completion.
Packit c4476c
Packit c4476c
Enabling CT also enables OCSP stapling, as this is one possible delivery method
Packit c4476c
for SCTs.
Packit c4476c
Packit c4476c
=item B<-ctlogfile>
Packit c4476c
Packit c4476c
A file containing a list of known Certificate Transparency logs. See
Packit c4476c
L<SSL_CTX_set_ctlog_list_file(3)> for the expected file format.
Packit c4476c
Packit c4476c
=item B<-keylogfile file>
Packit c4476c
Packit c4476c
Appends TLS secrets to the specified keylog file such that external programs
Packit c4476c
(like Wireshark) can decrypt TLS connections.
Packit c4476c
Packit c4476c
=item B<-early_data file>
Packit c4476c
Packit c4476c
Reads the contents of the specified file and attempts to send it as early data
Packit c4476c
to the server. This will only work with resumed sessions that support early
Packit c4476c
data and when the server accepts the early data.
Packit c4476c
Packit c4476c
=item B<-enable_pha>
Packit c4476c
Packit c4476c
For TLSv1.3 only, send the Post-Handshake Authentication extension. This will
Packit c4476c
happen whether or not a certificate has been provided via B<-cert>.
Packit c4476c
Packit c4476c
=item B<[target]>
Packit c4476c
Packit c4476c
Rather than providing B<-connect>, the target hostname and optional port may
Packit c4476c
be provided as a single positional argument after all options. If neither this
Packit c4476c
nor B<-connect> are provided, falls back to attempting to connect to localhost
Packit c4476c
on port 4433.
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
=head1 CONNECTED COMMANDS
Packit c4476c
Packit c4476c
If a connection is established with an SSL server then any data received
Packit c4476c
from the server is displayed and any key presses will be sent to the
Packit c4476c
server. If end of file is reached then the connection will be closed down. When
Packit c4476c
used interactively (which means neither B<-quiet> nor B<-ign_eof> have been
Packit c4476c
given), then certain commands are also recognized which perform special
Packit c4476c
operations. These commands are a letter which must appear at the start of a
Packit c4476c
line. They are listed below.
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item B<Q>
Packit c4476c
Packit c4476c
End the current SSL connection and exit.
Packit c4476c
Packit c4476c
=item B<R>
Packit c4476c
Packit c4476c
Renegotiate the SSL session (TLSv1.2 and below only).
Packit c4476c
Packit c4476c
=item B
Packit c4476c
Packit c4476c
Send a heartbeat message to the server (DTLS only)
Packit c4476c
Packit c4476c
=item B<k>
Packit c4476c
Packit c4476c
Send a key update message to the server (TLSv1.3 only)
Packit c4476c
Packit c4476c
=item B<K>
Packit c4476c
Packit c4476c
Send a key update message to the server and request one back (TLSv1.3 only)
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
B<s_client> can be used to debug SSL servers. To connect to an SSL HTTP
Packit c4476c
server the command:
Packit c4476c
Packit c4476c
 openssl s_client -connect servername:443
Packit c4476c
Packit c4476c
would typically be used (https uses port 443). If the connection succeeds
Packit c4476c
then an HTTP command can be given such as "GET /" to retrieve a web page.
Packit c4476c
Packit c4476c
If the handshake fails then there are several possible causes, if it is
Packit c4476c
nothing obvious like no client certificate then the B<-bugs>,
Packit c4476c
B<-ssl3>, B<-tls1>, B<-no_ssl3>, B<-no_tls1> options can be tried
Packit c4476c
in case it is a buggy server. In particular you should play with these
Packit c4476c
options B<before> submitting a bug report to an OpenSSL mailing list.
Packit c4476c
Packit c4476c
A frequent problem when attempting to get client certificates working
Packit c4476c
is that a web client complains it has no certificates or gives an empty
Packit c4476c
list to choose from. This is normally because the server is not sending
Packit c4476c
the clients certificate authority in its "acceptable CA list" when it
Packit c4476c
requests a certificate. By using B<s_client> the CA list can be viewed
Packit c4476c
and checked. However some servers only request client authentication
Packit c4476c
after a specific URL is requested. To obtain the list in this case it
Packit c4476c
is necessary to use the B<-prexit> option and send an HTTP request
Packit c4476c
for an appropriate page.
Packit c4476c
Packit c4476c
If a certificate is specified on the command line using the B<-cert>
Packit c4476c
option it will not be used unless the server specifically requests
Packit c4476c
a client certificate. Therefor merely including a client certificate
Packit c4476c
on the command line is no guarantee that the certificate works.
Packit c4476c
Packit c4476c
If there are problems verifying a server certificate then the
Packit c4476c
B<-showcerts> option can be used to show all the certificates sent by the
Packit c4476c
server.
Packit c4476c
Packit c4476c
The B<s_client> utility is a test tool and is designed to continue the
Packit c4476c
handshake after any certificate verification errors. As a result it will
Packit c4476c
accept any certificate chain (trusted or not) sent by the peer. None test
Packit c4476c
applications should B<not> do this as it makes them vulnerable to a MITM
Packit c4476c
attack. This behaviour can be changed by with the B<-verify_return_error>
Packit c4476c
option: any verify errors are then returned aborting the handshake.
Packit c4476c
Packit c4476c
The B<-bind> option may be useful if the server or a firewall requires
Packit c4476c
connections to come from some particular address and or port.
Packit c4476c
Packit c4476c
=head1 BUGS
Packit c4476c
Packit c4476c
Because this program has a lot of options and also because some of the
Packit c4476c
techniques used are rather old, the C source of B<s_client> is rather hard to
Packit c4476c
read and not a model of how things should be done.
Packit c4476c
A typical SSL client program would be much simpler.
Packit c4476c
Packit c4476c
The B<-prexit> option is a bit of a hack. We should really report
Packit c4476c
information whenever a session is renegotiated.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<SSL_CONF_cmd(3)>, L<sess_id(1)>, L<s_server(1)>, L<ciphers(1)>,
Packit c4476c
L<SSL_CTX_set_max_send_fragment(3)>, L<SSL_CTX_set_split_send_fragment(3)>,
Packit c4476c
L<SSL_CTX_set_max_pipelines(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The B<-no_alt_chains> option was added in OpenSSL 1.1.0.
Packit c4476c
The B<-name> option was added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut