Home | History | Annotate | Line # | Download | only in man1
      1  1.1  christos =pod
      2  1.1  christos {- OpenSSL::safe::output_do_not_edit_headers(); -}
      3  1.1  christos 
      4  1.1  christos =head1 NAME
      5  1.1  christos 
      6  1.1  christos openssl-s_client - SSL/TLS client program
      7  1.1  christos 
      8  1.1  christos =head1 SYNOPSIS
      9  1.1  christos 
     10  1.1  christos B<openssl> B<s_client>
     11  1.1  christos [B<-help>]
     12  1.1  christos [B<-ssl_config> I<section>]
     13  1.1  christos [B<-connect> I<host>:I<port>]
     14  1.1  christos [B<-host> I<hostname>]
     15  1.1  christos [B<-port> I<port>]
     16  1.1  christos [B<-bind> I<host>:I<port>]
     17  1.1  christos [B<-proxy> I<host>:I<port>]
     18  1.1  christos [B<-proxy_user> I<userid>]
     19  1.1  christos [B<-proxy_pass> I<arg>]
     20  1.1  christos [B<-unix> I<path>]
     21  1.1  christos [B<-4>]
     22  1.1  christos [B<-6>]
     23  1.1  christos [B<-quic>]
     24  1.1  christos [B<-servername> I<name>]
     25  1.1  christos [B<-noservername>]
     26  1.1  christos [B<-verify> I<depth>]
     27  1.1  christos [B<-verify_return_error>]
     28  1.1  christos [B<-verify_quiet>]
     29  1.1  christos [B<-verifyCAfile> I<filename>]
     30  1.1  christos [B<-verifyCApath> I<dir>]
     31  1.1  christos [B<-verifyCAstore> I<uri>]
     32  1.1  christos [B<-cert> I<filename>]
     33  1.1  christos [B<-certform> B<DER>|B<PEM>|B<P12>]
     34  1.1  christos [B<-cert_chain> I<filename>]
     35  1.1  christos [B<-build_chain>]
     36  1.1  christos [B<-CRL> I<filename>]
     37  1.1  christos [B<-CRLform> B<DER>|B<PEM>]
     38  1.1  christos [B<-crl_download>]
     39  1.1  christos [B<-key> I<filename>|I<uri>]
     40  1.1  christos [B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
     41  1.1  christos [B<-pass> I<arg>]
     42  1.1  christos [B<-chainCAfile> I<filename>]
     43  1.1  christos [B<-chainCApath> I<directory>]
     44  1.1  christos [B<-chainCAstore> I<uri>]
     45  1.1  christos [B<-requestCAfile> I<filename>]
     46  1.1  christos [B<-dane_tlsa_domain> I<domain>]
     47  1.1  christos [B<-dane_tlsa_rrdata> I<rrdata>]
     48  1.1  christos [B<-dane_ee_no_namechecks>]
     49  1.1  christos [B<-reconnect>]
     50  1.1  christos [B<-showcerts>]
     51  1.1  christos [B<-prexit>]
     52  1.1  christos [B<-no-interactive>]
     53  1.1  christos [B<-debug>]
     54  1.1  christos [B<-trace>]
     55  1.1  christos [B<-nocommands>]
     56  1.1  christos [B<-adv>]
     57  1.1  christos [B<-security_debug>]
     58  1.1  christos [B<-security_debug_verbose>]
     59  1.1  christos [B<-msg>]
     60  1.1  christos [B<-timeout>]
     61  1.1  christos [B<-mtu> I<size>]
     62  1.1  christos [B<-no_ems>]
     63  1.1  christos [B<-keymatexport> I<label>]
     64  1.1  christos [B<-keymatexportlen> I<len>]
     65  1.1  christos [B<-msgfile> I<filename>]
     66  1.1  christos [B<-nbio_test>]
     67  1.1  christos [B<-state>]
     68  1.1  christos [B<-nbio>]
     69  1.1  christos [B<-crlf>]
     70  1.1  christos [B<-ign_eof>]
     71  1.1  christos [B<-no_ign_eof>]
     72  1.1  christos [B<-psk_identity> I<identity>]
     73  1.1  christos [B<-psk> I<key>]
     74  1.1  christos [B<-psk_session> I<file>]
     75  1.1  christos [B<-quiet>]
     76  1.1  christos [B<-sctp>]
     77  1.1  christos [B<-sctp_label_bug>]
     78  1.1  christos [B<-fallback_scsv>]
     79  1.1  christos [B<-async>]
     80  1.1  christos [B<-maxfraglen> I<len>]
     81  1.1  christos [B<-max_send_frag>]
     82  1.1  christos [B<-split_send_frag>]
     83  1.1  christos [B<-max_pipelines>]
     84  1.1  christos [B<-read_buf>]
     85  1.1  christos [B<-ignore_unexpected_eof>]
     86  1.1  christos [B<-no_tx_cert_comp>]
     87  1.1  christos [B<-no_rx_cert_comp>]
     88  1.1  christos [B<-brief>]
     89  1.1  christos [B<-starttls> I<protocol>]
     90  1.1  christos [B<-xmpphost> I<hostname>]
     91  1.1  christos [B<-name> I<hostname>]
     92  1.1  christos [B<-tlsextdebug>]
     93  1.1  christos [B<-sess_out> I<filename>]
     94  1.1  christos [B<-sess_in> I<filename>]
     95  1.1  christos [B<-serverinfo> I<types>]
     96  1.1  christos [B<-status>]
     97  1.1  christos [B<-alpn> I<protocols>]
     98  1.1  christos [B<-nextprotoneg> I<protocols>]
     99  1.1  christos [B<-ct>]
    100  1.1  christos [B<-noct>]
    101  1.1  christos [B<-ctlogfile>]
    102  1.1  christos [B<-keylogfile> I<file>]
    103  1.1  christos [B<-early_data> I<file>]
    104  1.1  christos [B<-enable_pha>]
    105  1.1  christos [B<-use_srtp> I<value>]
    106  1.1  christos [B<-srpuser> I<value>]
    107  1.1  christos [B<-srppass> I<value>]
    108  1.1  christos [B<-srp_lateuser>]
    109  1.1  christos [B<-srp_moregroups>]
    110  1.1  christos [B<-srp_strength> I<number>]
    111  1.1  christos [B<-ktls>]
    112  1.1  christos [B<-tfo>]
    113  1.1  christos {- $OpenSSL::safe::opt_name_synopsis -}
    114  1.1  christos {- $OpenSSL::safe::opt_version_synopsis -}
    115  1.1  christos {- $OpenSSL::safe::opt_x_synopsis -}
    116  1.1  christos {- $OpenSSL::safe::opt_trust_synopsis -}
    117  1.1  christos {- $OpenSSL::safe::opt_s_synopsis -}
    118  1.1  christos {- $OpenSSL::safe::opt_r_synopsis -}
    119  1.1  christos {- $OpenSSL::safe::opt_provider_synopsis -}
    120  1.1  christos {- $OpenSSL::safe::opt_engine_synopsis -}[B<-ssl_client_engine> I<id>]
    121  1.1  christos {- $OpenSSL::safe::opt_v_synopsis -}
    122  1.1  christos [B<-enable_server_rpk>]
    123  1.1  christos [B<-enable_client_rpk>]
    124  1.1  christos [I<host>:I<port>]
    125  1.1  christos 
    126  1.1  christos =head1 DESCRIPTION
    127  1.1  christos 
    128  1.1  christos This command implements a generic SSL/TLS client which
    129  1.1  christos connects to a remote host using SSL/TLS. It is a I<very> useful diagnostic
    130  1.1  christos tool for SSL servers.
    131  1.1  christos 
    132  1.1  christos =head1 OPTIONS
    133  1.1  christos 
    134  1.1  christos In addition to the options below, this command also supports the
    135  1.1  christos common and client only options documented
    136  1.1  christos in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
    137  1.1  christos manual page.
    138  1.1  christos 
    139  1.1  christos =over 4
    140  1.1  christos 
    141  1.1  christos =item B<-help>
    142  1.1  christos 
    143  1.1  christos Print out a usage message.
    144  1.1  christos 
    145  1.1  christos =item B<-ssl_config> I<section>
    146  1.1  christos 
    147  1.1  christos Use the specified section of the configuration file to configure the B<SSL_CTX> object.
    148  1.1  christos 
    149  1.1  christos =item B<-connect> I<host>:I<port>
    150  1.1  christos 
    151  1.1  christos This specifies the host and optional port to connect to. It is possible to
    152  1.1  christos select the host and port using the optional target positional argument instead.
    153  1.1  christos If neither this nor the target positional argument are specified then an attempt
    154  1.1  christos is made to connect to the local host on port 4433.
    155  1.1  christos If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>.
    156  1.1  christos 
    157  1.1  christos =item B<-host> I<hostname>
    158  1.1  christos 
    159  1.1  christos Host to connect to; use B<-connect> instead.
    160  1.1  christos 
    161  1.1  christos =item B<-port> I<port>
    162  1.1  christos 
    163  1.1  christos Connect to the specified port; use B<-connect> instead.
    164  1.1  christos 
    165  1.1  christos =item B<-bind> I<host>:I<port>
    166  1.1  christos 
    167  1.1  christos This specifies the host address and or port to bind as the source for the
    168  1.1  christos connection.  For Unix-domain sockets the port is ignored and the host is
    169  1.1  christos used as the source socket address.
    170  1.1  christos If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>.
    171  1.1  christos 
    172  1.1  christos =item B<-proxy> I<host>:I<port>
    173  1.1  christos 
    174  1.1  christos When used with the B<-connect> flag, the program uses the host and port
    175  1.1  christos specified with this flag and issues an HTTP CONNECT command to connect
    176  1.1  christos to the desired server.
    177  1.1  christos If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>.
    178  1.1  christos 
    179  1.1  christos =item B<-proxy_user> I<userid>
    180  1.1  christos 
    181  1.1  christos When used with the B<-proxy> flag, the program will attempt to authenticate
    182  1.1  christos with the specified proxy using basic (base64) authentication.
    183  1.1  christos NB: Basic authentication is insecure; the credentials are sent to the proxy
    184  1.1  christos in easily reversible base64 encoding before any TLS/SSL session is established.
    185  1.1  christos Therefore, these credentials are easily recovered by anyone able to sniff/trace
    186  1.1  christos the network. Use with caution.
    187  1.1  christos 
    188  1.1  christos =item B<-proxy_pass> I<arg>
    189  1.1  christos 
    190  1.1  christos The proxy password source, used with the B<-proxy_user> flag.
    191  1.1  christos For more information about the format of B<arg>
    192  1.1  christos see L<openssl-passphrase-options(1)>.
    193  1.1  christos 
    194  1.1  christos =item B<-unix> I<path>
    195  1.1  christos 
    196  1.1  christos Connect over the specified Unix-domain socket.
    197  1.1  christos 
    198  1.1  christos =item B<-4>
    199  1.1  christos 
    200  1.1  christos Use IPv4 only.
    201  1.1  christos 
    202  1.1  christos =item B<-6>
    203  1.1  christos 
    204  1.1  christos Use IPv6 only.
    205  1.1  christos 
    206  1.1  christos =item B<-quic>
    207  1.1  christos 
    208  1.1  christos Connect using the QUIC protocol. If specified then the B<-alpn> option must also
    209  1.1  christos be provided.
    210  1.1  christos 
    211  1.1  christos =item B<-servername> I<name>
    212  1.1  christos 
    213  1.1  christos Set the TLS SNI (Server Name Indication) extension in the ClientHello message to
    214  1.1  christos the given value.
    215  1.1  christos If B<-servername> is not provided, the TLS SNI extension will be populated with
    216  1.1  christos the name given to B<-connect> if it follows a DNS name format. If B<-connect> is
    217  1.1  christos not provided either, the SNI is set to "localhost".
    218  1.1  christos This is the default since OpenSSL 1.1.1.
    219  1.1  christos 
    220  1.1  christos Even though SNI should normally be a DNS name and not an IP address, if
    221  1.1  christos B<-servername> is provided then that name will be sent, regardless of whether
    222  1.1  christos it is a DNS name or not.
    223  1.1  christos 
    224  1.1  christos This option cannot be used in conjunction with B<-noservername>.
    225  1.1  christos 
    226  1.1  christos =item B<-noservername>
    227  1.1  christos 
    228  1.1  christos Suppresses sending of the SNI (Server Name Indication) extension in the
    229  1.1  christos ClientHello message. Cannot be used in conjunction with the B<-servername> or
    230  1.1  christos B<-dane_tlsa_domain> options.
    231  1.1  christos 
    232  1.1  christos =item B<-cert> I<filename>
    233  1.1  christos 
    234  1.1  christos The client certificate to use, if one is requested by the server.
    235  1.1  christos The default is not to use a certificate.
    236  1.1  christos 
    237  1.1  christos The chain for the client certificate may be specified using B<-cert_chain>.
    238  1.1  christos 
    239  1.1  christos =item B<-certform> B<DER>|B<PEM>|B<P12>
    240  1.1  christos 
    241  1.1  christos The client certificate file format to use; unspecified by default.
    242  1.1  christos See L<openssl-format-options(1)> for details.
    243  1.1  christos 
    244  1.1  christos =item B<-cert_chain>
    245  1.1  christos 
    246  1.1  christos A file or URI of untrusted certificates to use when attempting to build the
    247  1.1  christos certificate chain related to the certificate specified via the B<-cert> option.
    248  1.1  christos The input can be in PEM, DER, or PKCS#12 format.
    249  1.1  christos 
    250  1.1  christos =item B<-build_chain>
    251  1.1  christos 
    252  1.1  christos Specify whether the application should build the client certificate chain to be
    253  1.1  christos provided to the server.
    254  1.1  christos 
    255  1.1  christos =item B<-CRL> I<filename>
    256  1.1  christos 
    257  1.1  christos CRL file to use to check the server's certificate.
    258  1.1  christos 
    259  1.1  christos =item B<-CRLform> B<DER>|B<PEM>
    260  1.1  christos 
    261  1.1  christos The CRL file format; unspecified by default.
    262  1.1  christos See L<openssl-format-options(1)> for details.
    263  1.1  christos 
    264  1.1  christos =item B<-crl_download>
    265  1.1  christos 
    266  1.1  christos Download CRL from distribution points in the certificate. Note that this option
    267  1.1  christos is ignored if B<-crl_check> option is not provided. Note that the maximum size
    268  1.1  christos of CRL is limited by L<X509_CRL_load_http(3)> function.
    269  1.1  christos 
    270  1.1  christos =item B<-key> I<filename>|I<uri>
    271  1.1  christos 
    272  1.1  christos The client private key to use.
    273  1.1  christos If not specified then the certificate file will be used to read also the key.
    274  1.1  christos 
    275  1.1  christos =item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
    276  1.1  christos 
    277  1.1  christos The key format; unspecified by default.
    278  1.1  christos See L<openssl-format-options(1)> for details.
    279  1.1  christos 
    280  1.1  christos =item B<-pass> I<arg>
    281  1.1  christos 
    282  1.1  christos the private key and certificate file password source.
    283  1.1  christos For more information about the format of I<arg>
    284  1.1  christos see L<openssl-passphrase-options(1)>.
    285  1.1  christos 
    286  1.1  christos =item B<-verify> I<depth>
    287  1.1  christos 
    288  1.1  christos The verify depth to use. This specifies the maximum length of the
    289  1.1  christos server certificate chain and turns on server certificate verification.
    290  1.1  christos Unless the B<-verify_return_error> option is given,
    291  1.1  christos the verify operation continues after errors so all the problems
    292  1.1  christos with a certificate chain can be seen. As a side effect the connection
    293  1.1  christos will never fail due to a server certificate verify failure.
    294  1.1  christos 
    295  1.1  christos By default, validation of server certificates and their chain
    296  1.1  christos is done w.r.t. the (D)TLS Server (C<sslserver>) purpose.
    297  1.1  christos For details see L<openssl-verification-options(1)/Certificate Extensions>.
    298  1.1  christos 
    299  1.1  christos =item B<-verify_return_error>
    300  1.1  christos 
    301  1.1  christos Turns on server certificate verification, like with B<-verify>,
    302  1.1  christos but returns verification errors instead of continuing.
    303  1.1  christos This will typically abort the handshake with a fatal error.
    304  1.1  christos 
    305  1.1  christos =item B<-verify_quiet>
    306  1.1  christos 
    307  1.1  christos Limit verify output to only errors.
    308  1.1  christos 
    309  1.1  christos =item B<-verifyCAfile> I<filename>
    310  1.1  christos 
    311  1.1  christos A file in PEM format containing trusted certificates to use
    312  1.1  christos for verifying the server's certificate.
    313  1.1  christos 
    314  1.1  christos =item B<-verifyCApath> I<dir>
    315  1.1  christos 
    316  1.1  christos A directory containing trusted certificates to use
    317  1.1  christos for verifying the server's certificate.
    318  1.1  christos This directory must be in "hash format",
    319  1.1  christos see L<openssl-verify(1)> for more information.
    320  1.1  christos 
    321  1.1  christos =item B<-verifyCAstore> I<uri>
    322  1.1  christos 
    323  1.1  christos The URI of a store containing trusted certificates to use
    324  1.1  christos for verifying the server's certificate.
    325  1.1  christos 
    326  1.1  christos =item B<-chainCAfile> I<file>
    327  1.1  christos 
    328  1.1  christos A file in PEM format containing trusted certificates to use
    329  1.1  christos when attempting to build the client certificate chain.
    330  1.1  christos 
    331  1.1  christos =item B<-chainCApath> I<directory>
    332  1.1  christos 
    333  1.1  christos A directory containing trusted certificates to use
    334  1.1  christos for building the client certificate chain provided to the server.
    335  1.1  christos This directory must be in "hash format",
    336  1.1  christos see L<openssl-verify(1)> for more information.
    337  1.1  christos 
    338  1.1  christos =item B<-chainCAstore> I<uri>
    339  1.1  christos 
    340  1.1  christos The URI of a store containing trusted certificates to use
    341  1.1  christos when attempting to build the client certificate chain.
    342  1.1  christos The URI may indicate a single certificate, as well as a collection of them.
    343  1.1  christos With URIs in the C<file:> scheme, this acts as B<-chainCAfile> or
    344  1.1  christos B<-chainCApath>, depending on if the URI indicates a directory or a
    345  1.1  christos single file.
    346  1.1  christos See L<ossl_store-file(7)> for more information on the C<file:> scheme.
    347  1.1  christos 
    348  1.1  christos =item B<-requestCAfile> I<file>
    349  1.1  christos 
    350  1.1  christos A file containing a list of certificates whose subject names will be sent
    351  1.1  christos to the server in the B<certificate_authorities> extension. Only supported
    352  1.1  christos for TLS 1.3
    353  1.1  christos 
    354  1.1  christos =item B<-dane_tlsa_domain> I<domain>
    355  1.1  christos 
    356  1.1  christos Enable RFC6698/RFC7671 DANE TLSA authentication and specify the
    357  1.1  christos TLSA base domain which becomes the default SNI hint and the primary
    358  1.1  christos reference identifier for hostname checks.  This must be used in
    359  1.1  christos combination with at least one instance of the B<-dane_tlsa_rrdata>
    360  1.1  christos option below.
    361  1.1  christos 
    362  1.1  christos When DANE authentication succeeds, the diagnostic output will include
    363  1.1  christos the lowest (closest to 0) depth at which a TLSA record authenticated
    364  1.1  christos a chain certificate.  When that TLSA record is a "2 1 0" trust
    365  1.1  christos anchor public key that signed (rather than matched) the top-most
    366  1.1  christos certificate of the chain, the result is reported as "TA public key
    367  1.1  christos verified".  Otherwise, either the TLSA record "matched TA certificate"
    368  1.1  christos at a positive depth or else "matched EE certificate" at depth 0.
    369  1.1  christos 
    370  1.1  christos =item B<-dane_tlsa_rrdata> I<rrdata>
    371  1.1  christos 
    372  1.1  christos Use one or more times to specify the RRDATA fields of the DANE TLSA
    373  1.1  christos RRset associated with the target service.  The I<rrdata> value is
    374  1.1  christos specified in "presentation form", that is four whitespace separated
    375  1.1  christos fields that specify the usage, selector, matching type and associated
    376  1.1  christos data, with the last of these encoded in hexadecimal.  Optional
    377  1.1  christos whitespace is ignored in the associated data field.  For example:
    378  1.1  christos 
    379  1.1  christos   $ openssl s_client -brief -starttls smtp \
    380  1.1  christos     -connect smtp.example.com:25 \
    381  1.1  christos     -dane_tlsa_domain smtp.example.com \
    382  1.1  christos     -dane_tlsa_rrdata "2 1 1
    383  1.1  christos       B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
    384  1.1  christos     -dane_tlsa_rrdata "2 1 1
    385  1.1  christos       60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
    386  1.1  christos   ...
    387  1.1  christos   Verification: OK
    388  1.1  christos   Verified peername: smtp.example.com
    389  1.1  christos   DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
    390  1.1  christos   ...
    391  1.1  christos 
    392  1.1  christos =item B<-dane_ee_no_namechecks>
    393  1.1  christos 
    394  1.1  christos This disables server name checks when authenticating via DANE-EE(3) TLSA
    395  1.1  christos records.
    396  1.1  christos For some applications, primarily web browsers, it is not safe to disable name
    397  1.1  christos checks due to "unknown key share" attacks, in which a malicious server can
    398  1.1  christos convince a client that a connection to a victim server is instead a secure
    399  1.1  christos connection to the malicious server.
    400  1.1  christos The malicious server may then be able to violate cross-origin scripting
    401  1.1  christos restrictions.
    402  1.1  christos Thus, despite the text of RFC7671, name checks are by default enabled for
    403  1.1  christos DANE-EE(3) TLSA records, and can be disabled in applications where it is safe
    404  1.1  christos to do so.
    405  1.1  christos In particular, SMTP and XMPP clients should set this option as SRV and MX
    406  1.1  christos records already make it possible for a remote domain to redirect client
    407  1.1  christos connections to any server of its choice, and in any case SMTP and XMPP clients
    408  1.1  christos do not execute scripts downloaded from remote servers.
    409  1.1  christos 
    410  1.1  christos =item B<-reconnect>
    411  1.1  christos 
    412  1.1  christos Reconnects to the same server 5 times using the same session ID, this can
    413  1.1  christos be used as a test that session caching is working.
    414  1.1  christos 
    415  1.1  christos =item B<-showcerts>
    416  1.1  christos 
    417  1.1  christos Displays the server certificate list as sent by the server: it only consists of
    418  1.1  christos certificates the server has sent (in the order the server has sent them). It is
    419  1.1  christos B<not> a verified chain.
    420  1.1  christos 
    421  1.1  christos =item B<-prexit>
    422  1.1  christos 
    423  1.1  christos Print session information when the program exits. This will always attempt
    424  1.1  christos to print out information even if the connection fails. Normally information
    425  1.1  christos will only be printed out once if the connection succeeds. This option is useful
    426  1.1  christos because the cipher in use may be renegotiated or the connection may fail
    427  1.1  christos because a client certificate is required or is requested only after an
    428  1.1  christos attempt is made to access a certain URL. Note: the output produced by this
    429  1.1  christos option is not always accurate because a connection might never have been
    430  1.1  christos established.
    431  1.1  christos 
    432  1.1  christos =item B<-no-interactive>
    433  1.1  christos 
    434  1.1  christos This flag can be used to run the client in a non-interactive mode.
    435  1.1  christos 
    436  1.1  christos =item B<-state>
    437  1.1  christos 
    438  1.1  christos Prints out the SSL session states.
    439  1.1  christos 
    440  1.1  christos =item B<-debug>
    441  1.1  christos 
    442  1.1  christos Print extensive debugging information including a hex dump of all traffic.
    443  1.1  christos 
    444  1.1  christos =item B<-nocommands>
    445  1.1  christos 
    446  1.1  christos Do not use interactive command letters.
    447  1.1  christos 
    448  1.1  christos =item B<-adv>
    449  1.1  christos 
    450  1.1  christos Use advanced command mode.
    451  1.1  christos 
    452  1.1  christos =item B<-security_debug>
    453  1.1  christos 
    454  1.1  christos Enable security debug messages.
    455  1.1  christos 
    456  1.1  christos =item B<-security_debug_verbose>
    457  1.1  christos 
    458  1.1  christos Output more security debug output.
    459  1.1  christos 
    460  1.1  christos =item B<-msg>
    461  1.1  christos 
    462  1.1  christos Show protocol messages.
    463  1.1  christos 
    464  1.1  christos =item B<-timeout>
    465  1.1  christos 
    466  1.1  christos Enable send/receive timeout on DTLS connections.
    467  1.1  christos 
    468  1.1  christos =item B<-mtu> I<size>
    469  1.1  christos 
    470  1.1  christos Set MTU of the link layer to the specified size.
    471  1.1  christos 
    472  1.1  christos =item B<-no_ems>
    473  1.1  christos 
    474  1.1  christos Disable Extended master secret negotiation.
    475  1.1  christos 
    476  1.1  christos =item B<-keymatexport> I<label>
    477  1.1  christos 
    478  1.1  christos Export keying material using the specified label.
    479  1.1  christos 
    480  1.1  christos =item B<-keymatexportlen> I<len>
    481  1.1  christos 
    482  1.1  christos Export the specified number of bytes of keying material; default is 20.
    483  1.1  christos 
    484  1.1  christos Show all protocol messages with hex dump.
    485  1.1  christos 
    486  1.1  christos =item B<-trace>
    487  1.1  christos 
    488  1.1  christos Show verbose trace output of protocol messages.
    489  1.1  christos 
    490  1.1  christos =item B<-msgfile> I<filename>
    491  1.1  christos 
    492  1.1  christos File to send output of B<-msg> or B<-trace> to, default standard output.
    493  1.1  christos 
    494  1.1  christos =item B<-nbio_test>
    495  1.1  christos 
    496  1.1  christos Tests nonblocking I/O
    497  1.1  christos 
    498  1.1  christos =item B<-nbio>
    499  1.1  christos 
    500  1.1  christos Turns on nonblocking I/O
    501  1.1  christos 
    502  1.1  christos =item B<-crlf>
    503  1.1  christos 
    504  1.1  christos This option translated a line feed from the terminal into CR+LF as required
    505  1.1  christos by some servers.
    506  1.1  christos 
    507  1.1  christos =item B<-ign_eof>
    508  1.1  christos 
    509  1.1  christos Inhibit shutting down the connection when end of file is reached in the
    510  1.1  christos input. This implicitly turns on B<-nocommands> as well.
    511  1.1  christos 
    512  1.1  christos =item B<-quiet>
    513  1.1  christos 
    514  1.1  christos Inhibit printing of session and certificate information.  This implicitly
    515  1.1  christos turns on B<-ign_eof> and B<-nocommands> as well.
    516  1.1  christos 
    517  1.1  christos =item B<-no_ign_eof>
    518  1.1  christos 
    519  1.1  christos Shut down the connection when end of file is reached in the input.
    520  1.1  christos Can be used to override the implicit B<-ign_eof> after B<-quiet>.
    521  1.1  christos 
    522  1.1  christos =item B<-psk_identity> I<identity>
    523  1.1  christos 
    524  1.1  christos Use the PSK identity I<identity> when using a PSK cipher suite.
    525  1.1  christos The default value is "Client_identity" (without the quotes).
    526  1.1  christos 
    527  1.1  christos =item B<-psk> I<key>
    528  1.1  christos 
    529  1.1  christos Use the PSK key I<key> when using a PSK cipher suite. The key is
    530  1.1  christos given as a hexadecimal number without leading 0x, for example -psk
    531  1.1  christos 1a2b3c4d.
    532  1.1  christos This option must be provided in order to use a PSK cipher.
    533  1.1  christos 
    534  1.1  christos =item B<-psk_session> I<file>
    535  1.1  christos 
    536  1.1  christos Use the pem encoded SSL_SESSION data stored in I<file> as the basis of a PSK.
    537  1.1  christos Note that this will only work if TLSv1.3 is negotiated.
    538  1.1  christos 
    539  1.1  christos =item B<-sctp>
    540  1.1  christos 
    541  1.1  christos Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
    542  1.1  christos conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
    543  1.1  christos available where OpenSSL has support for SCTP enabled.
    544  1.1  christos 
    545  1.1  christos =item B<-sctp_label_bug>
    546  1.1  christos 
    547  1.1  christos Use the incorrect behaviour of older OpenSSL implementations when computing
    548  1.1  christos endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
    549  1.1  christos older broken implementations but breaks interoperability with correct
    550  1.1  christos implementations. Must be used in conjunction with B<-sctp>. This option is only
    551  1.1  christos available where OpenSSL has support for SCTP enabled.
    552  1.1  christos 
    553  1.1  christos =item B<-fallback_scsv>
    554  1.1  christos 
    555  1.1  christos Send TLS_FALLBACK_SCSV in the ClientHello.
    556  1.1  christos 
    557  1.1  christos =item B<-async>
    558  1.1  christos 
    559  1.1  christos Switch on asynchronous mode. Cryptographic operations will be performed
    560  1.1  christos asynchronously. This will only have an effect if an asynchronous capable engine
    561  1.1  christos is also used via the B<-engine> option. For test purposes the dummy async engine
    562  1.1  christos (dasync) can be used (if available).
    563  1.1  christos 
    564  1.1  christos =item B<-maxfraglen> I<len>
    565  1.1  christos 
    566  1.1  christos Enable Maximum Fragment Length Negotiation; allowed values are
    567  1.1  christos C<512>, C<1024>, C<2048>, and C<4096>.
    568  1.1  christos 
    569  1.1  christos =item B<-max_send_frag> I<int>
    570  1.1  christos 
    571  1.1  christos The maximum size of data fragment to send.
    572  1.1  christos See L<SSL_CTX_set_max_send_fragment(3)> for further information.
    573  1.1  christos 
    574  1.1  christos =item B<-split_send_frag> I<int>
    575  1.1  christos 
    576  1.1  christos The size used to split data for encrypt pipelines. If more data is written in
    577  1.1  christos one go than this value then it will be split into multiple pipelines, up to the
    578  1.1  christos maximum number of pipelines defined by max_pipelines. This only has an effect if
    579  1.1  christos a suitable cipher suite has been negotiated, an engine that supports pipelining
    580  1.1  christos has been loaded, and max_pipelines is greater than 1. See
    581  1.1  christos L<SSL_CTX_set_split_send_fragment(3)> for further information.
    582  1.1  christos 
    583  1.1  christos =item B<-max_pipelines> I<int>
    584  1.1  christos 
    585  1.1  christos The maximum number of encrypt/decrypt pipelines to be used. This will only have
    586  1.1  christos an effect if an engine has been loaded that supports pipelining (e.g. the dasync
    587  1.1  christos engine) and a suitable cipher suite has been negotiated. The default value is 1.
    588  1.1  christos See L<SSL_CTX_set_max_pipelines(3)> for further information.
    589  1.1  christos 
    590  1.1  christos =item B<-read_buf> I<int>
    591  1.1  christos 
    592  1.1  christos The default read buffer size to be used for connections. This will only have an
    593  1.1  christos effect if the buffer size is larger than the size that would otherwise be used
    594  1.1  christos and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
    595  1.1  christos further information).
    596  1.1  christos 
    597  1.1  christos =item B<-ignore_unexpected_eof>
    598  1.1  christos 
    599  1.1  christos Some TLS implementations do not send the mandatory close_notify alert on
    600  1.1  christos shutdown. If the application tries to wait for the close_notify alert but the
    601  1.1  christos peer closes the connection without sending it, an error is generated. When this
    602  1.1  christos option is enabled the peer does not need to send the close_notify alert and a
    603  1.1  christos closed connection will be treated as if the close_notify alert was received.
    604  1.1  christos For more information on shutting down a connection, see L<SSL_shutdown(3)>.
    605  1.1  christos 
    606  1.1  christos =item B<-no_tx_cert_comp>
    607  1.1  christos 
    608  1.1  christos Disables support for sending TLSv1.3 compressed certificates.
    609  1.1  christos 
    610  1.1  christos =item B<-no_rx_cert_comp>
    611  1.1  christos 
    612  1.1  christos Disables support for receiving TLSv1.3 compressed certificate.
    613  1.1  christos 
    614  1.1  christos =item B<-brief>
    615  1.1  christos 
    616  1.1  christos Only provide a brief summary of connection parameters instead of the
    617  1.1  christos normal verbose output.
    618  1.1  christos 
    619  1.1  christos =item B<-starttls> I<protocol>
    620  1.1  christos 
    621  1.1  christos Send the protocol-specific message(s) to switch to TLS for communication.
    622  1.1  christos I<protocol> is a keyword for the intended protocol.  Currently, the only
    623  1.1  christos supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
    624  1.1  christos "irc", "postgres", "mysql", "lmtp", "nntp", "sieve" and "ldap".
    625  1.1  christos 
    626  1.1  christos =item B<-xmpphost> I<hostname>
    627  1.1  christos 
    628  1.1  christos This option, when used with "-starttls xmpp" or "-starttls xmpp-server",
    629  1.1  christos specifies the host for the "to" attribute of the stream element.
    630  1.1  christos If this option is not specified, then the host specified with "-connect"
    631  1.1  christos will be used.
    632  1.1  christos 
    633  1.1  christos This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
    634  1.1  christos 
    635  1.1  christos =item B<-name> I<hostname>
    636  1.1  christos 
    637  1.1  christos This option is used to specify hostname information for various protocols
    638  1.1  christos used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
    639  1.1  christos "smtp" and "lmtp" can utilize this B<-name> option.
    640  1.1  christos 
    641  1.1  christos If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
    642  1.1  christos if specifies the host for the "to" attribute of the stream element. If this
    643  1.1  christos option is not specified, then the host specified with "-connect" will be used.
    644  1.1  christos 
    645  1.1  christos If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
    646  1.1  christos the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
    647  1.1  christos this option is not specified, then "mail.example.com" will be used.
    648  1.1  christos 
    649  1.1  christos =item B<-tlsextdebug>
    650  1.1  christos 
    651  1.1  christos Print out a hex dump of any TLS extensions received from the server.
    652  1.1  christos 
    653  1.1  christos =item B<-sess_out> I<filename>
    654  1.1  christos 
    655  1.1  christos Output SSL session to I<filename>.
    656  1.1  christos 
    657  1.1  christos =item B<-sess_in> I<filename>
    658  1.1  christos 
    659  1.1  christos Load SSL session from I<filename>. The client will attempt to resume a
    660  1.1  christos connection from this session.
    661  1.1  christos 
    662  1.1  christos =item B<-serverinfo> I<types>
    663  1.1  christos 
    664  1.1  christos A list of comma-separated TLS Extension Types (numbers between 0 and
    665  1.1  christos 65535).  Each type will be sent as an empty ClientHello TLS Extension.
    666  1.1  christos The server's response (if any) will be encoded and displayed as a PEM
    667  1.1  christos file.
    668  1.1  christos 
    669  1.1  christos =item B<-status>
    670  1.1  christos 
    671  1.1  christos Sends a certificate status request to the server (OCSP stapling). The server
    672  1.1  christos response (if any) is printed out.
    673  1.1  christos 
    674  1.1  christos =item B<-alpn> I<protocols>, B<-nextprotoneg> I<protocols>
    675  1.1  christos 
    676  1.1  christos These flags enable the Enable the Application-Layer Protocol Negotiation
    677  1.1  christos or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
    678  1.1  christos IETF standard and replaces NPN.
    679  1.1  christos The I<protocols> list is a comma-separated list of protocol names that
    680  1.1  christos the client should advertise support for. The list should contain the most
    681  1.1  christos desirable protocols first.  Protocol names are printable ASCII strings,
    682  1.1  christos for example "http/1.1" or "spdy/3".
    683  1.1  christos An empty list of protocols is treated specially and will cause the
    684  1.1  christos client to advertise support for the TLS extension but disconnect just
    685  1.1  christos after receiving ServerHello with a list of server supported protocols.
    686  1.1  christos The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
    687  1.1  christos 
    688  1.1  christos =item B<-ct>, B<-noct>
    689  1.1  christos 
    690  1.1  christos Use one of these two options to control whether Certificate Transparency (CT)
    691  1.1  christos is enabled (B<-ct>) or disabled (B<-noct>).
    692  1.1  christos If CT is enabled, signed certificate timestamps (SCTs) will be requested from
    693  1.1  christos the server and reported at handshake completion.
    694  1.1  christos 
    695  1.1  christos Enabling CT also enables OCSP stapling, as this is one possible delivery method
    696  1.1  christos for SCTs.
    697  1.1  christos 
    698  1.1  christos =item B<-ctlogfile>
    699  1.1  christos 
    700  1.1  christos A file containing a list of known Certificate Transparency logs. See
    701  1.1  christos L<SSL_CTX_set_ctlog_list_file(3)> for the expected file format.
    702  1.1  christos 
    703  1.1  christos =item B<-keylogfile> I<file>
    704  1.1  christos 
    705  1.1  christos Appends TLS secrets to the specified keylog file such that external programs
    706  1.1  christos (like Wireshark) can decrypt TLS connections.
    707  1.1  christos 
    708  1.1  christos =item B<-early_data> I<file>
    709  1.1  christos 
    710  1.1  christos Reads the contents of the specified file and attempts to send it as early data
    711  1.1  christos to the server. This will only work with resumed sessions that support early
    712  1.1  christos data and when the server accepts the early data.
    713  1.1  christos 
    714  1.1  christos =item B<-enable_pha>
    715  1.1  christos 
    716  1.1  christos For TLSv1.3 only, send the Post-Handshake Authentication extension. This will
    717  1.1  christos happen whether or not a certificate has been provided via B<-cert>.
    718  1.1  christos 
    719  1.1  christos =item B<-use_srtp> I<value>
    720  1.1  christos 
    721  1.1  christos Offer SRTP key management, where B<value> is a colon-separated profile list.
    722  1.1  christos 
    723  1.1  christos =item B<-srpuser> I<value>
    724  1.1  christos 
    725  1.1  christos Set the SRP username to the specified value. This option is deprecated.
    726  1.1  christos 
    727  1.1  christos =item B<-srppass> I<value>
    728  1.1  christos 
    729  1.1  christos Set the SRP password to the specified value. This option is deprecated.
    730  1.1  christos 
    731  1.1  christos =item B<-srp_lateuser>
    732  1.1  christos 
    733  1.1  christos SRP username for the second ClientHello message. This option is deprecated.
    734  1.1  christos 
    735  1.1  christos =item B<-srp_moregroups>  This option is deprecated.
    736  1.1  christos 
    737  1.1  christos Tolerate other than the known B<g> and B<N> values.
    738  1.1  christos 
    739  1.1  christos =item B<-srp_strength> I<number>
    740  1.1  christos 
    741  1.1  christos Set the minimal acceptable length, in bits, for B<N>.  This option is
    742  1.1  christos deprecated.
    743  1.1  christos 
    744  1.1  christos =item B<-ktls>
    745  1.1  christos 
    746  1.1  christos Enable Kernel TLS for sending and receiving.
    747  1.1  christos This option was introduced in OpenSSL 3.2.0.
    748  1.1  christos Kernel TLS is off by default as of OpenSSL 3.2.0.
    749  1.1  christos 
    750  1.1  christos =item B<-tfo>
    751  1.1  christos 
    752  1.1  christos Enable creation of connections via TCP fast open (RFC7413).
    753  1.1  christos 
    754  1.1  christos {- $OpenSSL::safe::opt_version_item -}
    755  1.1  christos 
    756  1.1  christos {- $OpenSSL::safe::opt_name_item -}
    757  1.1  christos 
    758  1.1  christos {- $OpenSSL::safe::opt_x_item -}
    759  1.1  christos 
    760  1.1  christos {- $OpenSSL::safe::opt_trust_item -}
    761  1.1  christos 
    762  1.1  christos {- $OpenSSL::safe::opt_s_item -}
    763  1.1  christos 
    764  1.1  christos {- $OpenSSL::safe::opt_r_item -}
    765  1.1  christos 
    766  1.1  christos {- $OpenSSL::safe::opt_provider_item -}
    767  1.1  christos 
    768  1.1  christos {- $OpenSSL::safe::opt_engine_item -}
    769  1.1  christos 
    770  1.1  christos {- output_off() if $disabled{"deprecated-3.0"}; "" -}
    771  1.1  christos =item B<-ssl_client_engine> I<id>
    772  1.1  christos 
    773  1.1  christos Specify engine to be used for client certificate operations.
    774  1.1  christos {- output_on() if $disabled{"deprecated-3.0"}; "" -}
    775  1.1  christos 
    776  1.1  christos {- $OpenSSL::safe::opt_v_item -}
    777  1.1  christos 
    778  1.1  christos Verification errors are displayed, for debugging, but the command will
    779  1.1  christos proceed unless the B<-verify_return_error> option is used.
    780  1.1  christos 
    781  1.1  christos =item B<-enable_server_rpk>
    782  1.1  christos 
    783  1.1  christos Enable support for receiving raw public keys (RFC7250) from the server.
    784  1.1  christos Use of X.509 certificates by the server becomes optional, and servers that
    785  1.1  christos support raw public keys may elect to use them.
    786  1.1  christos Servers that don't support raw public keys or prefer to use X.509
    787  1.1  christos certificates can still elect to send X.509 certificates as usual.
    788  1.1  christos 
    789  1.1  christos =item B<-enable_client_rpk>
    790  1.1  christos 
    791  1.1  christos Enable support for sending raw public keys (RFC7250) to the server.
    792  1.1  christos A raw public key will be sent by the client, if solicited by the server,
    793  1.1  christos provided a suitable key and public certificate pair is configured.
    794  1.1  christos Some servers may nevertheless not request any client credentials,
    795  1.1  christos or may request a certificate.
    796  1.1  christos 
    797  1.1  christos =item I<host>:I<port>
    798  1.1  christos 
    799  1.1  christos Rather than providing B<-connect>, the target host and optional port may
    800  1.1  christos be provided as a single positional argument after all options. If neither this
    801  1.1  christos nor B<-connect> are provided, falls back to attempting to connect to
    802  1.1  christos I<localhost> on port I<4433>.
    803  1.1  christos If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>.
    804  1.1  christos 
    805  1.1  christos =back
    806  1.1  christos 
    807  1.1  christos =head1 CONNECTED COMMANDS (BASIC)
    808  1.1  christos 
    809  1.1  christos If a connection is established with an SSL/TLS server then any data received
    810  1.1  christos from the server is displayed and any key presses will be sent to the
    811  1.1  christos server. If end of file is reached then the connection will be closed down.
    812  1.1  christos 
    813  1.1  christos When used interactively (which means neither B<-quiet> nor B<-ign_eof> have been
    814  1.1  christos given), and neither of B<-adv> or B<-nocommands> are given then "Basic" command
    815  1.1  christos mode is entered. In this mode certain commands are recognized which perform
    816  1.1  christos special operations. These commands are a letter which must appear at the start
    817  1.1  christos of a line. All further data after the initial letter on the line is ignored.
    818  1.1  christos The commands are listed below.
    819  1.1  christos 
    820  1.1  christos =over 4
    821  1.1  christos 
    822  1.1  christos =item B<Q>
    823  1.1  christos 
    824  1.1  christos End the current SSL connection and exit.
    825  1.1  christos 
    826  1.1  christos =item B<R>
    827  1.1  christos 
    828  1.1  christos Renegotiate the SSL session (TLSv1.2 and below only).
    829  1.1  christos 
    830  1.1  christos =item B<C>
    831  1.1  christos 
    832  1.1  christos Attempt to reconnect to the server using a resumption handshake.
    833  1.1  christos 
    834  1.1  christos =item B<k>
    835  1.1  christos 
    836  1.1  christos Send a key update message to the server (TLSv1.3 only)
    837  1.1  christos 
    838  1.1  christos =item B<K>
    839  1.1  christos 
    840  1.1  christos Send a key update message to the server and request one back (TLSv1.3 only)
    841  1.1  christos 
    842  1.1  christos =back
    843  1.1  christos 
    844  1.1  christos =head1 CONNECTED COMMANDS (ADVANCED)
    845  1.1  christos 
    846  1.1  christos If B<-adv> has been given then "advanced" command mode is entered. As with basic
    847  1.1  christos mode, if a connection is established with an SSL/TLS server then any data
    848  1.1  christos received from the server is displayed and any key presses will be sent to the
    849  1.1  christos server. If end of file is reached then the connection will be closed down.
    850  1.1  christos 
    851  1.1  christos Special commands can be supplied by enclosing them in braces, e.g. "{help}" or
    852  1.1  christos "{quit}". These commands can appear anywhere in the text entered into s_client,
    853  1.1  christos but they are not sent to the server. Some commands can take an argument by
    854  1.1  christos ending the command name with ":" and then providing the argument, e.g.
    855  1.1  christos "{keyup:req}". Some commands are only available when certain protocol versions
    856  1.1  christos have been negotiated.
    857  1.1  christos 
    858  1.1  christos If a newline appears at the end of a line entered into s_client then this is
    859  1.1  christos also sent to the server. If a command appears on a line on its own with no other
    860  1.1  christos text on the same line, then the newline is suppressed and not sent to the
    861  1.1  christos server.
    862  1.1  christos 
    863  1.1  christos The following commands are recognised.
    864  1.1  christos 
    865  1.1  christos =over 4
    866  1.1  christos 
    867  1.1  christos =item B<help>
    868  1.1  christos 
    869  1.1  christos Prints out summary help text about the available commands.
    870  1.1  christos 
    871  1.1  christos =item B<quit>
    872  1.1  christos 
    873  1.1  christos Close the connection to the peer
    874  1.1  christos 
    875  1.1  christos =item B<reconnect>
    876  1.1  christos 
    877  1.1  christos Reconnect to the peer and attempt a resumption handshake
    878  1.1  christos 
    879  1.1  christos =item B<keyup>
    880  1.1  christos 
    881  1.1  christos Send a Key Update message. TLSv1.3 only. This command takes an optional
    882  1.1  christos argument. If the argument "req" is supplied then the peer is also requested to
    883  1.1  christos update its keys. Otherwise if "noreq" is supplied the peer is not requested
    884  1.1  christos to update its keys. The default is "req".
    885  1.1  christos 
    886  1.1  christos =item B<reneg>
    887  1.1  christos 
    888  1.1  christos Initiate a renegotiation with the server. (D)TLSv1.2 or below only.
    889  1.1  christos 
    890  1.1  christos =item B<fin>
    891  1.1  christos 
    892  1.1  christos Indicate FIN on the current stream. QUIC only. Once FIN has been sent any
    893  1.1  christos further text entered for this stream is ignored.
    894  1.1  christos 
    895  1.1  christos =back
    896  1.1  christos 
    897  1.1  christos =head1 NOTES
    898  1.1  christos 
    899  1.1  christos This command can be used to debug SSL servers. To connect to an SSL HTTP
    900  1.1  christos server the command:
    901  1.1  christos 
    902  1.1  christos  openssl s_client -connect servername:443
    903  1.1  christos 
    904  1.1  christos would typically be used (https uses port 443). If the connection succeeds
    905  1.1  christos then an HTTP command can be given such as "GET /" to retrieve a web page.
    906  1.1  christos 
    907  1.1  christos If the handshake fails then there are several possible causes, if it is
    908  1.1  christos nothing obvious like no client certificate then the B<-bugs>,
    909  1.1  christos B<-ssl3>, B<-tls1>, B<-no_ssl3>, B<-no_tls1> options can be tried
    910  1.1  christos in case it is a buggy server. In particular you should play with these
    911  1.1  christos options B<before> submitting a bug report to an OpenSSL mailing list.
    912  1.1  christos 
    913  1.1  christos A frequent problem when attempting to get client certificates working
    914  1.1  christos is that a web client complains it has no certificates or gives an empty
    915  1.1  christos list to choose from. This is normally because the server is not sending
    916  1.1  christos the clients certificate authority in its "acceptable CA list" when it
    917  1.1  christos requests a certificate. By using this command, the CA list can be viewed
    918  1.1  christos and checked. However, some servers only request client authentication
    919  1.1  christos after a specific URL is requested. To obtain the list in this case it
    920  1.1  christos is necessary to use the B<-prexit> option and send an HTTP request
    921  1.1  christos for an appropriate page.
    922  1.1  christos 
    923  1.1  christos If a certificate is specified on the command line using the B<-cert>
    924  1.1  christos option it will not be used unless the server specifically requests
    925  1.1  christos a client certificate. Therefore, merely including a client certificate
    926  1.1  christos on the command line is no guarantee that the certificate works.
    927  1.1  christos 
    928  1.1  christos If there are problems verifying a server certificate then the
    929  1.1  christos B<-showcerts> option can be used to show all the certificates sent by the
    930  1.1  christos server.
    931  1.1  christos 
    932  1.1  christos This command is a test tool and is designed to continue the
    933  1.1  christos handshake after any certificate verification errors. As a result it will
    934  1.1  christos accept any certificate chain (trusted or not) sent by the peer. Non-test
    935  1.1  christos applications should B<not> do this as it makes them vulnerable to a MITM
    936  1.1  christos attack. This behaviour can be changed by with the B<-verify_return_error>
    937  1.1  christos option: any verify errors are then returned aborting the handshake.
    938  1.1  christos 
    939  1.1  christos The B<-bind> option may be useful if the server or a firewall requires
    940  1.1  christos connections to come from some particular address and or port.
    941  1.1  christos 
    942  1.1  christos =head2 Note on Non-Interactive Use
    943  1.1  christos 
    944  1.1  christos When B<s_client> is run in a non-interactive environment (e.g., a cron job or
    945  1.1  christos a script without a valid I<stdin>), it may close the connection prematurely,
    946  1.1  christos especially with TLS 1.3. To prevent this, you can use the B<-ign_eof> flag,
    947  1.1  christos which keeps B<s_client> running even after reaching EOF from I<stdin>.
    948  1.1  christos 
    949  1.1  christos For example:
    950  1.1  christos 
    951  1.1  christos  openssl s_client -connect <server address>:443 -tls1_3
    952  1.1  christos                   -sess_out /path/to/tls_session_params_file
    953  1.1  christos                   -ign_eof </dev/null
    954  1.1  christos 
    955  1.1  christos However, relying solely on B<-ign_eof> can lead to issues if the server keeps
    956  1.1  christos the connection open, expecting the client to close first. In such cases, the
    957  1.1  christos client may hang indefinitely. This behavior is not uncommon, particularly with
    958  1.1  christos protocols where the server waits for a graceful disconnect from the client.
    959  1.1  christos 
    960  1.1  christos For example, when connecting to an SMTP server, the session may pause if the
    961  1.1  christos server expects a QUIT command before closing:
    962  1.1  christos 
    963  1.1  christos  $ openssl s_client -brief -ign_eof -starttls smtp
    964  1.1  christos                     -connect <server address>:25 </dev/null
    965  1.1  christos  CONNECTION ESTABLISHED
    966  1.1  christos  Protocol version: TLSv1.3
    967  1.1  christos  Ciphersuite: TLS_AES_256_GCM_SHA384
    968  1.1  christos  ...
    969  1.1  christos  250 CHUNKING
    970  1.1  christos  [long pause]
    971  1.1  christos 
    972  1.1  christos To avoid such hangs, it's better to use an application-level command to
    973  1.1  christos initiate a clean disconnect. For SMTP, you can send a QUIT command:
    974  1.1  christos 
    975  1.1  christos  printf 'QUIT\r\n' | openssl s_client -connect <server address>:25
    976  1.1  christos                                       -starttls smtp -brief -ign_eof
    977  1.1  christos 
    978  1.1  christos Similarly, for HTTP/1.1 connections, including a `Connection: close` header
    979  1.1  christos ensures the server closes the connection after responding:
    980  1.1  christos 
    981  1.1  christos  printf 'GET / HTTP/1.1\r\nHost: <server address>\r\nConnection: close\r\n\r\n'
    982  1.1  christos      | openssl s_client -connect <server address>:443 -brief
    983  1.1  christos 
    984  1.1  christos These approaches help manage the connection closure gracefully and prevent
    985  1.1  christos hangs caused by the server waiting for the client to initiate the disconnect.
    986  1.1  christos 
    987  1.1  christos =head1 BUGS
    988  1.1  christos 
    989  1.1  christos Because this program has a lot of options and also because some of the
    990  1.1  christos techniques used are rather old, the C source for this command is rather
    991  1.1  christos hard to read and not a model of how things should be done.
    992  1.1  christos A typical SSL client program would be much simpler.
    993  1.1  christos 
    994  1.1  christos The B<-prexit> option is a bit of a hack. We should really report
    995  1.1  christos information whenever a session is renegotiated.
    996  1.1  christos 
    997  1.1  christos =head1 SEE ALSO
    998  1.1  christos 
    999  1.1  christos L<openssl(1)>,
   1000  1.1  christos L<openssl-sess_id(1)>,
   1001  1.1  christos L<openssl-s_server(1)>,
   1002  1.1  christos L<openssl-ciphers(1)>,
   1003  1.1  christos L<SSL_CONF_cmd(3)>,
   1004  1.1  christos L<SSL_CTX_set_max_send_fragment(3)>,
   1005  1.1  christos L<SSL_CTX_set_split_send_fragment(3)>,
   1006  1.1  christos L<SSL_CTX_set_max_pipelines(3)>,
   1007  1.1  christos L<ossl_store-file(7)>
   1008  1.1  christos 
   1009  1.1  christos =head1 HISTORY
   1010  1.1  christos 
   1011  1.1  christos The B<-no_alt_chains> option was added in OpenSSL 1.1.0.
   1012  1.1  christos The B<-name> option was added in OpenSSL 1.1.1.
   1013  1.1  christos 
   1014  1.1  christos The B<-certform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
   1015  1.1  christos 
   1016  1.1  christos The B<-engine> option was deprecated in OpenSSL 3.0.
   1017  1.1  christos 
   1018  1.1  christos The
   1019  1.1  christos B<-enable_client_rpk>,
   1020  1.1  christos B<-enable_server_rpk>,
   1021  1.1  christos B<-no_rx_cert_comp>,
   1022  1.1  christos B<-no_tx_cert_comp>,
   1023  1.1  christos and B<-tfo>
   1024  1.1  christos options were added in OpenSSL 3.2.
   1025  1.1  christos 
   1026  1.1  christos =head1 COPYRIGHT
   1027  1.1  christos 
   1028  1.1  christos Copyright 2000-2025 The OpenSSL Project Authors. All Rights Reserved.
   1029  1.1  christos 
   1030  1.1  christos Licensed under the Apache License 2.0 (the "License").  You may not use
   1031  1.1  christos this file except in compliance with the License.  You can obtain a copy
   1032  1.1  christos in the file LICENSE in the source distribution or at
   1033  1.1  christos L<https://www.openssl.org/source/license.html>.
   1034  1.1  christos 
   1035  1.1  christos =cut
   1036