]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man1/openssl-s_client.pod.in
apps: make use of OSSL_STORE for generalized certs and CRLs loading
[thirdparty/openssl.git] / doc / man1 / openssl-s_client.pod.in
CommitLineData
c3ed3b6e 1=pod
625c781d 2{- OpenSSL::safe::output_do_not_edit_headers(); -}
9fcb9702 3
c3ed3b6e
DSH
4=head1 NAME
5
b6b66573 6openssl-s_client - SSL/TLS client program
c3ed3b6e
DSH
7
8=head1 SYNOPSIS
9
10B<openssl> B<s_client>
169394d4 11[B<-help>]
2a2b1e41 12[B<-ssl_config> I<section>]
e8769719 13[B<-connect> I<host:port>]
0dda37f5
RS
14[B<-host> I<hostname>]
15[B<-port> I<port>]
e8769719
RS
16[B<-bind> I<host:port>]
17[B<-proxy> I<host:port>]
18[B<-proxy_user> I<userid>]
19[B<-proxy_pass> I<arg>]
20[B<-unix> I<path>]
a22f9c84
E
21[B<-4>]
22[B<-6>]
e8769719 23[B<-servername> I<name>]
11ba87f2 24[B<-noservername>]
e8769719 25[B<-verify> I<depth>]
4e6c12f3 26[B<-verify_return_error>]
0dda37f5
RS
27[B<-verify_quiet>]
28[B<-verifyCAfile> I<filename>]
29[B<-verifyCApath> I<dir>]
30[B<-verifyCAstore> I<uri>]
e8769719 31[B<-cert> I<filename>]
6d382c74 32[B<-certform> B<DER>|B<PEM>|B<P12>]
2b264aee
DDO
33[B<-cert_chain> I<filename>]
34[B<-build_chain>]
0dda37f5 35[B<-CRL> I<filename>]
777182a0 36[B<-CRLform> B<DER>|B<PEM>]
0dda37f5 37[B<-crl_download>]
e8769719 38[B<-key> I<filename>]
6d382c74 39[B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>]
e8769719 40[B<-pass> I<arg>]
e8769719 41[B<-chainCAfile> I<filename>]
2b264aee 42[B<-chainCApath> I<directory>]
fd3397fc 43[B<-chainCAstore> I<uri>]
e8769719
RS
44[B<-requestCAfile> I<filename>]
45[B<-dane_tlsa_domain> I<domain>]
46[B<-dane_tlsa_rrdata> I<rrdata>]
c4fbed6c 47[B<-dane_ee_no_namechecks>]
c3ed3b6e 48[B<-reconnect>]
c3ed3b6e 49[B<-showcerts>]
0dda37f5 50[B<-prexit>]
c3ed3b6e 51[B<-debug>]
0dda37f5
RS
52[B<-trace>]
53[B<-nocommands>]
54[B<-security_debug>]
55[B<-security_debug_verbose>]
1d8634b1 56[B<-msg>]
0dda37f5
RS
57[B<-timeout>]
58[B<-mtu> I<size>]
59[B<-keymatexport> I<label>]
60[B<-keymatexportlen> I<len>]
61[B<-msgfile> I<filename>]
c3ed3b6e
DSH
62[B<-nbio_test>]
63[B<-state>]
64[B<-nbio>]
65[B<-crlf>]
ce301b6b 66[B<-ign_eof>]
fc1d88f0 67[B<-no_ign_eof>]
e8769719
RS
68[B<-psk_identity> I<identity>]
69[B<-psk> I<key>]
70[B<-psk_session> I<file>]
c3ed3b6e 71[B<-quiet>]
19044d3c 72[B<-sctp>]
09d62b33 73[B<-sctp_label_bug>]
fb0e87fb 74[B<-fallback_scsv>]
bc8857bf 75[B<-async>]
0dda37f5 76[B<-maxfraglen> I<len>]
28e5ea88 77[B<-max_send_frag>]
0df80881
MC
78[B<-split_send_frag>]
79[B<-max_pipelines>]
80[B<-read_buf>]
09b90e0e 81[B<-ignore_unexpected_eof>]
c3ed3b6e 82[B<-bugs>]
cc5a9ba4
VD
83[B<-comp>]
84[B<-no_comp>]
0dda37f5 85[B<-brief>]
4e2bd9cb 86[B<-allow_no_dhe_kex>]
e8769719
RS
87[B<-sigalgs> I<sigalglist>]
88[B<-curves> I<curvelist>]
89[B<-cipher> I<cipherlist>]
90[B<-ciphersuites> I<val>]
fc1d88f0 91[B<-serverpref>]
e8769719 92[B<-starttls> I<protocol>]
0dda37f5 93[B<-name> I<hostname>]
e8769719
RS
94[B<-xmpphost> I<hostname>]
95[B<-name> I<hostname>]
d24a9c8f
DSH
96[B<-tlsextdebug>]
97[B<-no_ticket>]
e8769719 98[B<-sess_out> I<filename>]
0dda37f5 99[B<-serverinfo> I<types>]
e8769719 100[B<-sess_in> I<filename>]
e8769719 101[B<-serverinfo> I<types>]
cba3f1c7 102[B<-status>]
e8769719
RS
103[B<-alpn> I<protocols>]
104[B<-nextprotoneg> I<protocols>]
e75138ab
RS
105[B<-ct>]
106[B<-noct>]
eb64a6c6 107[B<-ctlogfile>]
e8769719
RS
108[B<-keylogfile> I<file>]
109[B<-early_data> I<file>]
32097b33 110[B<-enable_pha>]
0dda37f5
RS
111[B<-use_srtp> I<value>]
112[B<-srpuser> I<value>]
113[B<-srppass> I<value>]
114[B<-srp_lateuser>]
115[B<-srp_moregroups>]
116[B<-srp_strength> I<number>]
bc24e3ee 117{- $OpenSSL::safe::opt_name_synopsis -}
d4bff20d 118{- $OpenSSL::safe::opt_version_synopsis -}
9fcb9702
RS
119{- $OpenSSL::safe::opt_x_synopsis -}
120{- $OpenSSL::safe::opt_trust_synopsis -}
0dda37f5 121{- $OpenSSL::safe::opt_s_synopsis -}
9fcb9702 122{- $OpenSSL::safe::opt_r_synopsis -}
6bd4e3f2 123{- $OpenSSL::safe::opt_provider_synopsis -}
018aaeb4 124{- $OpenSSL::safe::opt_engine_synopsis -}
0dda37f5 125[B<-ssl_client_engine> I<id>]
21d08b9e 126{- $OpenSSL::safe::opt_v_synopsis -}
e8769719 127[I<host>:I<port>]
c3ed3b6e 128
9f3c076b 129=for openssl ifdef engine ssl_client_engine ct noct ctlogfile
1738c0ce 130
9f3c076b 131=for openssl ifdef ssl3 unix 4 6 use_srtp status trace wdebug nextprotoneg
1738c0ce 132
9f3c076b 133=for openssl ifdef ssl3 tls1 tls1_1 tls1_2 tls1_3 dtls mtu dtls1 dtls1_2
1738c0ce 134
9f3c076b 135=for openssl ifdef sctp_label_bug sctp
1738c0ce 136
9f3c076b 137=for openssl ifdef srpuser srppass srp_lateuser srp_moregroups srp_strength
1738c0ce 138
c3ed3b6e
DSH
139=head1 DESCRIPTION
140
35a810bb
RL
141This command implements a generic SSL/TLS client which
142connects to a remote host using SSL/TLS. It is a I<very> useful diagnostic
143tool for SSL servers.
c3ed3b6e
DSH
144
145=head1 OPTIONS
146
35a810bb 147In addition to the options below, this command also supports the
3c74e77b 148common and client only options documented
6f0ac0e2 149in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
13cfb043 150manual page.
765b4137 151
c3ed3b6e
DSH
152=over 4
153
169394d4
MR
154=item B<-help>
155
156Print out a usage message.
157
2a2b1e41 158=item B<-ssl_config> I<section>
0dda37f5 159
2a2b1e41 160Use the specified section of the configuration file to configure the B<SSL_CTX> object.
0dda37f5 161
e8769719 162=item B<-connect> I<host>:I<port>
c3ed3b6e 163
729ef856
CB
164This specifies the host and optional port to connect to. It is possible to
165select the host and port using the optional target positional argument instead.
ce3dcdc9 166If neither this nor the target positional argument are specified then an attempt
729ef856 167is made to connect to the local host on port 4433.
c3ed3b6e 168
0dda37f5
RS
169=item B<-host> I<hostname>
170
171Host to connect to; use B<-connect> instead.
172
173=item B<-port> I<port>
174
175Connect to the specified port; use B<-connect> instead.
176
9fcb9702 177=item B<-bind> I<host:port>
ebc01683
JH
178
179This specifies the host address and or port to bind as the source for the
180connection. For Unix-domain sockets the port is ignored and the host is
181used as the source socket address.
182
e8769719 183=item B<-proxy> I<host:port>
552bf8ec
MT
184
185When used with the B<-connect> flag, the program uses the host and port
186specified with this flag and issues an HTTP CONNECT command to connect
187to the desired server.
188
e8769719 189=item B<-proxy_user> I<userid>
69738dad
M
190
191When used with the B<-proxy> flag, the program will attempt to authenticate
192with the specified proxy using basic (base64) authentication.
193NB: Basic authentication is insecure; the credentials are sent to the proxy
194in easily reversible base64 encoding before any TLS/SSL session is established.
8c1cbc72 195Therefore, these credentials are easily recovered by anyone able to sniff/trace
69738dad
M
196the network. Use with caution.
197
e8769719 198=item B<-proxy_pass> I<arg>
69738dad
M
199
200The proxy password source, used with the B<-proxy_user> flag.
e8769719 201For more information about the format of B<arg>
3a4e43de 202see L<openssl(1)/Pass Phrase Options>.
69738dad 203
e8769719 204=item B<-unix> I<path>
a22f9c84
E
205
206Connect over the specified Unix-domain socket.
207
208=item B<-4>
209
210Use IPv4 only.
211
212=item B<-6>
213
214Use IPv6 only.
215
e8769719 216=item B<-servername> I<name>
fc1d88f0 217
11ba87f2 218Set the TLS SNI (Server Name Indication) extension in the ClientHello message to
9fcb9702
RS
219the given value.
220If B<-servername> is not provided, the TLS SNI extension will be populated with
221the name given to B<-connect> if it follows a DNS name format. If B<-connect> is
8e981051
IM
222not provided either, the SNI is set to "localhost".
223This is the default since OpenSSL 1.1.1.
224
9fcb9702
RS
225Even though SNI should normally be a DNS name and not an IP address, if
226B<-servername> is provided then that name will be sent, regardless of whether
8e981051
IM
227it is a DNS name or not.
228
3dcbb6c4 229This option cannot be used in conjunction with B<-noservername>.
11ba87f2
MC
230
231=item B<-noservername>
232
233Suppresses sending of the SNI (Server Name Indication) extension in the
234ClientHello message. Cannot be used in conjunction with the B<-servername> or
481afe2a 235<-dane_tlsa_domain> options.
fc1d88f0 236
e8769719 237=item B<-cert> I<certname>
c3ed3b6e 238
2b264aee
DDO
239The client certificate to use, if one is requested by the server.
240The default is not to use a certificate.
c3ed3b6e 241
2b264aee 242The chain for the client certificate may be specified using B<-cert_chain>.
826a42a0 243
6d382c74 244=item B<-certform> B<DER>|B<PEM>|B<P12>
2b264aee
DDO
245
246The client certificate file format to use; the default is B<PEM>.
6d382c74 247This option has no effect and is retained for backward compatibility only.
2b264aee
DDO
248
249=item B<-cert_chain>
250
b3c5aadf 251A file or URI of untrusted certificates to use when attempting to build the
2b264aee 252certificate chain related to the certificate specified via the B<-cert> option.
b3c5aadf 253The input can be in PEM, DER, or PKCS#12 format.
2b264aee
DDO
254
255=item B<-build_chain>
256
257Specify whether the application should build the client certificate chain to be
258provided to the server.
826a42a0 259
0dda37f5
RS
260=item B<-CRL> I<filename>
261
262CRL file to use to check the server's certificate.
263
777182a0
RS
264=item B<-CRLform> B<DER>|B<PEM>
265
2b264aee 266The CRL file format; the default is B<PEM>.
777182a0
RS
267See L<openssl(1)/Format Options> for details.
268
0dda37f5
RS
269=item B<-crl_download>
270
271Download CRL from distribution points in the certificate.
272
e8769719 273=item B<-key> I<keyfile>
c3ed3b6e 274
2b264aee
DDO
275The client private key file to use.
276If not specified then the certificate file will be used to read also the key.
c3ed3b6e 277
6d382c74 278=item B<-keyform> B<DER>|B<PEM>|B<P12>|B<ENGINE>
826a42a0 279
777182a0 280The key format; the default is B<PEM>.
6d382c74 281The only value with effect is B<ENGINE>; all others have become obsolete.
777182a0 282See L<openssl(1)/Format Options> for details.
826a42a0 283
e8769719 284=item B<-pass> I<arg>
826a42a0 285
2f0ea936 286the private key password source. For more information about the format of I<arg>
f5c14c63 287see L<openssl(1)/Pass phrase options>.
826a42a0 288
e8769719 289=item B<-verify> I<depth>
c3ed3b6e
DSH
290
291The verify depth to use. This specifies the maximum length of the
292server certificate chain and turns on server certificate verification.
293Currently the verify operation continues after errors so all the problems
294with a certificate chain can be seen. As a side effect the connection
295will never fail due to a server certificate verify failure.
296
4e6c12f3
DSH
297=item B<-verify_return_error>
298
299Return verification errors instead of continuing. This will typically
300abort the handshake with a fatal error.
301
0dda37f5
RS
302=item B<-verify_quiet>
303
304Limit verify output to only errors.
305
306=item B<-verifyCAfile> I<filename>
307
2b264aee
DDO
308A file in PEM format containing trusted certificates to use
309for verifying the server's certificate.
0dda37f5
RS
310
311=item B<-verifyCApath> I<dir>
312
2b264aee
DDO
313A directory containing trusted certificates to use
314for verifying the server's certificate.
315This directory must be in "hash format",
316see L<openssl-verify(1)> for more information.
0dda37f5
RS
317
318=item B<-verifyCAstore> I<uri>
319
2b264aee
DDO
320The URI of a store containing trusted certificates to use
321for verifying the server's certificate.
0dda37f5 322
2b264aee 323=item B<-chainCAfile> I<file>
7cacbe9d 324
2b264aee
DDO
325A file in PEM format containing trusted certificates to use
326when attempting to build the client certificate chain.
7cacbe9d 327
2b264aee 328=item B<-chainCApath> I<directory>
7cacbe9d 329
2b264aee
DDO
330A directory containing trusted certificates to use
331for building the client certificate chain provided to the server.
332This directory must be in "hash format",
333see L<openssl-verify(1)> for more information.
7cacbe9d 334
fd3397fc
RL
335=item B<-chainCAstore> I<uri>
336
2b264aee
DDO
337The URI of a store containing trusted certificates to use
338when attempting to build the client certificate chain.
339The URI may indicate a single certificate, as well as a collection of them.
340With URIs in the C<file:> scheme, this acts as B<-chainCAfile> or
341B<-chainCApath>, depending on if the URI indicates a directory or a
342single file.
343See L<ossl_store-file(7)> for more information on the C<file:> scheme.
fd3397fc 344
e8769719 345=item B<-requestCAfile> I<file>
5a185729
DSH
346
347A file containing a list of certificates whose subject names will be sent
348to the server in the B<certificate_authorities> extension. Only supported
349for TLS 1.3
350
e8769719 351=item B<-dane_tlsa_domain> I<domain>
cddd424a
VD
352
353Enable RFC6698/RFC7671 DANE TLSA authentication and specify the
354TLSA base domain which becomes the default SNI hint and the primary
355reference identifier for hostname checks. This must be used in
356combination with at least one instance of the B<-dane_tlsa_rrdata>
357option below.
358
359When DANE authentication succeeds, the diagnostic output will include
360the lowest (closest to 0) depth at which a TLSA record authenticated
361a chain certificate. When that TLSA record is a "2 1 0" trust
362anchor public key that signed (rather than matched) the top-most
363certificate of the chain, the result is reported as "TA public key
364verified". Otherwise, either the TLSA record "matched TA certificate"
365at a positive depth or else "matched EE certificate" at depth 0.
366
e8769719 367=item B<-dane_tlsa_rrdata> I<rrdata>
cddd424a
VD
368
369Use one or more times to specify the RRDATA fields of the DANE TLSA
2f0ea936 370RRset associated with the target service. The I<rrdata> value is
7fa8bcfe 371specified in "presentation form", that is four whitespace separated
cddd424a
VD
372fields that specify the usage, selector, matching type and associated
373data, with the last of these encoded in hexadecimal. Optional
374whitespace is ignored in the associated data field. For example:
375
c0a445a9
VD
376 $ openssl s_client -brief -starttls smtp \
377 -connect smtp.example.com:25 \
cddd424a
VD
378 -dane_tlsa_domain smtp.example.com \
379 -dane_tlsa_rrdata "2 1 1
380 B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
381 -dane_tlsa_rrdata "2 1 1
382 60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
cddd424a 383 ...
c0a445a9 384 Verification: OK
cddd424a 385 Verified peername: smtp.example.com
c0a445a9 386 DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
cddd424a
VD
387 ...
388
c4fbed6c
VD
389=item B<-dane_ee_no_namechecks>
390
391This disables server name checks when authenticating via DANE-EE(3) TLSA
392records.
393For some applications, primarily web browsers, it is not safe to disable name
394checks due to "unknown key share" attacks, in which a malicious server can
395convince a client that a connection to a victim server is instead a secure
396connection to the malicious server.
397The malicious server may then be able to violate cross-origin scripting
398restrictions.
399Thus, despite the text of RFC7671, name checks are by default enabled for
400DANE-EE(3) TLSA records, and can be disabled in applications where it is safe
401to do so.
402In particular, SMTP and XMPP clients should set this option as SRV and MX
403records already make it possible for a remote domain to redirect client
404connections to any server of its choice, and in any case SMTP and XMPP clients
405do not execute scripts downloaded from remote servers.
406
c3ed3b6e
DSH
407=item B<-reconnect>
408
c4de074e 409Reconnects to the same server 5 times using the same session ID, this can
c3ed3b6e
DSH
410be used as a test that session caching is working.
411
c3ed3b6e
DSH
412=item B<-showcerts>
413
bdb59d97
MC
414Displays the server certificate list as sent by the server: it only consists of
415certificates the server has sent (in the order the server has sent them). It is
416B<not> a verified chain.
c3ed3b6e
DSH
417
418=item B<-prexit>
419
c4de074e 420Print session information when the program exits. This will always attempt
c3ed3b6e
DSH
421to print out information even if the connection fails. Normally information
422will only be printed out once if the connection succeeds. This option is useful
423because the cipher in use may be renegotiated or the connection may fail
424because a client certificate is required or is requested only after an
425attempt is made to access a certain URL. Note: the output produced by this
426option is not always accurate because a connection might never have been
427established.
428
429=item B<-state>
430
c4de074e 431Prints out the SSL session states.
c3ed3b6e
DSH
432
433=item B<-debug>
434
c4de074e 435Print extensive debugging information including a hex dump of all traffic.
c3ed3b6e 436
0dda37f5
RS
437=item B<-nocommands>
438
439Do not use interactive command letters.
440
441=item B<-security_debug>
442
443Enable security debug messages.
444
445=item B<-security_debug_verbose>
446
447Output more security debug output.
448
1d8634b1
BM
449=item B<-msg>
450
0dda37f5
RS
451Show protocol messages.
452
453=item B<-timeout>
454
455Enable send/receive timeout on DTLS connections.
456
457=item B<-mtu> I<size>
458
459Set MTU of the link layer to the specified size.
460
461=item B<-keymatexport> I<label>
462
463Export keying material using the specified label.
464
465=item B<-keymatexportlen> I<len>
466
912f8a98 467Export the specified number of bytes of keying material; default is 20.
0dda37f5 468
c4de074e 469Show all protocol messages with hex dump.
1d8634b1 470
8dbeb110
DSH
471=item B<-trace>
472
c4de074e 473Show verbose trace output of protocol messages. OpenSSL needs to be compiled
8dbeb110
DSH
474with B<enable-ssl-trace> for this option to work.
475
0dda37f5 476=item B<-msgfile> I<filename>
8dbeb110 477
c4de074e 478File to send output of B<-msg> or B<-trace> to, default standard output.
8dbeb110 479
c3ed3b6e
DSH
480=item B<-nbio_test>
481
490c8711 482Tests nonblocking I/O
c3ed3b6e
DSH
483
484=item B<-nbio>
485
490c8711 486Turns on nonblocking I/O
c3ed3b6e
DSH
487
488=item B<-crlf>
489
c4de074e 490This option translated a line feed from the terminal into CR+LF as required
c3ed3b6e
DSH
491by some servers.
492
ce301b6b
RL
493=item B<-ign_eof>
494
c4de074e 495Inhibit shutting down the connection when end of file is reached in the
ce301b6b
RL
496input.
497
c3ed3b6e
DSH
498=item B<-quiet>
499
c4de074e 500Inhibit printing of session and certificate information. This implicitly
ce301b6b 501turns on B<-ign_eof> as well.
c3ed3b6e 502
fc1d88f0
RS
503=item B<-no_ign_eof>
504
c4de074e 505Shut down the connection when end of file is reached in the input.
fc1d88f0
RS
506Can be used to override the implicit B<-ign_eof> after B<-quiet>.
507
e8769719 508=item B<-psk_identity> I<identity>
ddac1974 509
2f0ea936 510Use the PSK identity I<identity> when using a PSK cipher suite.
9d772829 511The default value is "Client_identity" (without the quotes).
ddac1974 512
e8769719 513=item B<-psk> I<key>
ddac1974 514
2f0ea936 515Use the PSK key I<key> when using a PSK cipher suite. The key is
ddac1974
NL
516given as a hexadecimal number without leading 0x, for example -psk
5171a2b3c4d.
9d772829 518This option must be provided in order to use a PSK cipher.
ddac1974 519
e8769719 520=item B<-psk_session> I<file>
9e064bc1 521
2f0ea936 522Use the pem encoded SSL_SESSION data stored in I<file> as the basis of a PSK.
9e064bc1
MC
523Note that this will only work if TLSv1.3 is negotiated.
524
19044d3c
MC
525=item B<-sctp>
526
527Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
528conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
529available where OpenSSL has support for SCTP enabled.
530
09d62b33
MT
531=item B<-sctp_label_bug>
532
533Use the incorrect behaviour of older OpenSSL implementations when computing
534endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
535older broken implementations but breaks interoperability with correct
536implementations. Must be used in conjunction with B<-sctp>. This option is only
537available where OpenSSL has support for SCTP enabled.
538
fb0e87fb
BM
539=item B<-fallback_scsv>
540
541Send TLS_FALLBACK_SCSV in the ClientHello.
c3ed3b6e 542
bc8857bf
MC
543=item B<-async>
544
c4de074e 545Switch on asynchronous mode. Cryptographic operations will be performed
bc8857bf
MC
546asynchronously. This will only have an effect if an asynchronous capable engine
547is also used via the B<-engine> option. For test purposes the dummy async engine
548(dasync) can be used (if available).
549
0dda37f5
RS
550=item B<-maxfraglen> I<len>
551
552Enable Maximum Fragment Length Negotiation; allowed values are
553C<512>, C<1024>, C<2048>, and C<4096>.
554
e8769719 555=item B<-max_send_frag> I<int>
28e5ea88
F
556
557The maximum size of data fragment to send.
558See L<SSL_CTX_set_max_send_fragment(3)> for further information.
559
e8769719 560=item B<-split_send_frag> I<int>
0df80881
MC
561
562The size used to split data for encrypt pipelines. If more data is written in
563one go than this value then it will be split into multiple pipelines, up to the
564maximum number of pipelines defined by max_pipelines. This only has an effect if
c4de074e 565a suitable cipher suite has been negotiated, an engine that supports pipelining
0df80881
MC
566has been loaded, and max_pipelines is greater than 1. See
567L<SSL_CTX_set_split_send_fragment(3)> for further information.
568
e8769719 569=item B<-max_pipelines> I<int>
0df80881
MC
570
571The maximum number of encrypt/decrypt pipelines to be used. This will only have
572an effect if an engine has been loaded that supports pipelining (e.g. the dasync
c4de074e 573engine) and a suitable cipher suite has been negotiated. The default value is 1.
0df80881
MC
574See L<SSL_CTX_set_max_pipelines(3)> for further information.
575
e8769719 576=item B<-read_buf> I<int>
0df80881
MC
577
578The default read buffer size to be used for connections. This will only have an
579effect if the buffer size is larger than the size that would otherwise be used
580and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
581further information).
582
09b90e0e
DB
583=item B<-ignore_unexpected_eof>
584
585Some TLS implementations do not send the mandatory close_notify alert on
586shutdown. If the application tries to wait for the close_notify alert but the
587peer closes the connection without sending it, an error is generated. When this
588option is enabled the peer does not need to send the close_notify alert and a
589closed connection will be treated as if the close_notify alert was received.
590For more information on shutting down a connection, see L<SSL_shutdown(3)>.
591
c3ed3b6e
DSH
592=item B<-bugs>
593
fc4e500b 594There are several known bugs in SSL and TLS implementations. Adding this
c3ed3b6e
DSH
595option enables various workarounds.
596
cc5a9ba4
VD
597=item B<-comp>
598
599Enables support for SSL/TLS compression.
600This option was introduced in OpenSSL 1.1.0.
601TLS compression is not recommended and is off by default as of
602OpenSSL 1.1.0.
603
604=item B<-no_comp>
605
606Disables support for SSL/TLS compression.
607TLS compression is not recommended and is off by default as of
608OpenSSL 1.1.0.
609
765b4137
DSH
610=item B<-brief>
611
c4de074e 612Only provide a brief summary of connection parameters instead of the
765b4137
DSH
613normal verbose output.
614
e8769719 615=item B<-sigalgs> I<sigalglist>
254b58fd
SC
616
617Specifies the list of signature algorithms that are sent by the client.
618The server selects one entry in the list based on its preferences.
619For example strings, see L<SSL_CTX_set1_sigalgs(3)>
620
e8769719 621=item B<-curves> I<curvelist>
254b58fd
SC
622
623Specifies the list of supported curves to be sent by the client. The curve is
ce3dcdc9 624ultimately selected by the server. For a list of all curves, use:
254b58fd
SC
625
626 $ openssl ecparam -list_curves
627
e8769719 628=item B<-cipher> I<cipherlist>
c3ed3b6e 629
9d2674cd
MC
630This allows the TLSv1.2 and below cipher list sent by the client to be modified.
631This list will be combined with any TLSv1.3 ciphersuites that have been
632configured. Although the server determines which ciphersuite is used it should
35a810bb
RL
633take the first supported cipher in the list sent by the client. See
634L<openssl-ciphers(1)> for more information.
9d2674cd 635
e8769719 636=item B<-ciphersuites> I<val>
9d2674cd
MC
637
638This allows the TLSv1.3 ciphersuites sent by the client to be modified. This
639list will be combined with any TLSv1.2 and below ciphersuites that have been
640configured. Although the server determines which cipher suite is used it should
35a810bb
RL
641take the first supported cipher in the list sent by the client. See
642L<openssl-ciphers(1)> for more information. The format for this list is a simple
9d2674cd 643colon (":") separated list of TLSv1.3 ciphersuite names.
c3ed3b6e 644
e8769719 645=item B<-starttls> I<protocol>
e986704d 646
c4de074e 647Send the protocol-specific message(s) to switch to TLS for communication.
2f0ea936 648I<protocol> is a keyword for the intended protocol. Currently, the only
cfb4f1ef 649supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
a2d9cfba 650"irc", "postgres", "mysql", "lmtp", "nntp", "sieve" and "ldap".
e986704d 651
e8769719 652=item B<-xmpphost> I<hostname>
b98af49d 653
898ea7b8
KE
654This option, when used with "-starttls xmpp" or "-starttls xmpp-server",
655specifies the host for the "to" attribute of the stream element.
b98af49d
CALP
656If this option is not specified, then the host specified with "-connect"
657will be used.
658
8176431d
PY
659This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
660
e8769719 661=item B<-name> I<hostname>
8176431d
PY
662
663This option is used to specify hostname information for various protocols
664used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
665"smtp" and "lmtp" can utilize this B<-name> option.
666
667If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
668if specifies the host for the "to" attribute of the stream element. If this
669option is not specified, then the host specified with "-connect" will be used.
670
671If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
672the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
673this option is not specified, then "mail.example.com" will be used.
674
d24a9c8f
DSH
675=item B<-tlsextdebug>
676
c4de074e 677Print out a hex dump of any TLS extensions received from the server.
d24a9c8f
DSH
678
679=item B<-no_ticket>
680
c4de074e 681Disable RFC4507bis session ticket support.
d24a9c8f 682
e8769719 683=item B<-sess_out> I<filename>
d24a9c8f 684
2f0ea936 685Output SSL session to I<filename>.
d24a9c8f 686
2f0ea936 687=item B<-sess_in> I<filename>
d24a9c8f 688
2f0ea936 689Load SSL session from I<filename>. The client will attempt to resume a
d24a9c8f
DSH
690connection from this session.
691
e8769719 692=item B<-serverinfo> I<types>
9cd50f73 693
c4de074e 694A list of comma-separated TLS Extension Types (numbers between 0 and
9cd50f73
T
69565535). Each type will be sent as an empty ClientHello TLS Extension.
696The server's response (if any) will be encoded and displayed as a PEM
697file.
698
cba3f1c7
DSH
699=item B<-status>
700
c4de074e 701Sends a certificate status request to the server (OCSP stapling). The server
cba3f1c7
DSH
702response (if any) is printed out.
703
e8769719 704=item B<-alpn> I<protocols>, B<-nextprotoneg> I<protocols>
7efd0e77 705
c4de074e
P
706These flags enable the Enable the Application-Layer Protocol Negotiation
707or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
708IETF standard and replaces NPN.
2f0ea936 709The I<protocols> list is a comma-separated list of protocol names that
c4de074e
P
710the client should advertise support for. The list should contain the most
711desirable protocols first. Protocol names are printable ASCII strings,
712for example "http/1.1" or "spdy/3".
713An empty list of protocols is treated specially and will cause the
714client to advertise support for the TLS extension but disconnect just
715after receiving ServerHello with a list of server supported protocols.
837f87c2 716The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
7efd0e77 717
e75138ab 718=item B<-ct>, B<-noct>
eb64a6c6 719
43341433
VD
720Use one of these two options to control whether Certificate Transparency (CT)
721is enabled (B<-ct>) or disabled (B<-noct>).
722If CT is enabled, signed certificate timestamps (SCTs) will be requested from
723the server and reported at handshake completion.
eb64a6c6
RP
724
725Enabling CT also enables OCSP stapling, as this is one possible delivery method
726for SCTs.
727
728=item B<-ctlogfile>
729
730A file containing a list of known Certificate Transparency logs. See
731L<SSL_CTX_set_ctlog_list_file(3)> for the expected file format.
732
e8769719 733=item B<-keylogfile> I<file>
4bf73e9f
PW
734
735Appends TLS secrets to the specified keylog file such that external programs
736(like Wireshark) can decrypt TLS connections.
737
e8769719 738=item B<-early_data> I<file>
6437b802
MC
739
740Reads the contents of the specified file and attempts to send it as early data
741to the server. This will only work with resumed sessions that support early
742data and when the server accepts the early data.
743
32097b33 744=item B<-enable_pha>
9d75dce3 745
32097b33
MC
746For TLSv1.3 only, send the Post-Handshake Authentication extension. This will
747happen whether or not a certificate has been provided via B<-cert>.
9d75dce3 748
0dda37f5
RS
749=item B<-use_srtp> I<value>
750
751Offer SRTP key management, where B<value> is a colon-separated profile list.
752
753=item B<-srpuser> I<value>
754
755Set the SRP username to the specified value.
756
757=item B<-srppass> I<value>
758
759Set the SRP password to the specified value.
760
761=item B<-srp_lateuser>
762
763SRP username for the second ClientHello message.
764
765=item B<-srp_moregroups>
766
767Tolerate other than the known B<g> and B<N> values.
768
769=item B<-srp_strength> I<number>
770
771Set the minimal acceptable length, in bits, for B<N>.
772
d4bff20d 773{- $OpenSSL::safe::opt_version_item -}
729ef856 774
bc24e3ee
RS
775{- $OpenSSL::safe::opt_name_item -}
776
9fcb9702
RS
777{- $OpenSSL::safe::opt_x_item -}
778
779{- $OpenSSL::safe::opt_trust_item -}
780
0dda37f5
RS
781{- $OpenSSL::safe::opt_s_item -}
782
9fcb9702
RS
783{- $OpenSSL::safe::opt_r_item -}
784
6bd4e3f2
P
785{- $OpenSSL::safe::opt_provider_item -}
786
018aaeb4
RS
787{- $OpenSSL::safe::opt_engine_item -}
788
0dda37f5
RS
789=item B<-ssl_client_engine> I<id>
790
791Specify engine to be used for client certificate operations.
792
21d08b9e
RS
793{- $OpenSSL::safe::opt_v_item -}
794
795Verification errors are displayed, for debugging, but the command will
796proceed unless the B<-verify_return_error> option is used.
797
d4bff20d
RS
798=item I<host>:I<port>
799
800Rather than providing B<-connect>, the target hostname and optional port may
801be provided as a single positional argument after all options. If neither this
802nor B<-connect> are provided, falls back to attempting to connect to
803I<localhost> on port I<4433>.
804
efeca6aa
UM
805=back
806
c3ed3b6e
DSH
807=head1 CONNECTED COMMANDS
808
809If a connection is established with an SSL server then any data received
810from the server is displayed and any key presses will be sent to the
3d0dde84
MC
811server. If end of file is reached then the connection will be closed down. When
812used interactively (which means neither B<-quiet> nor B<-ign_eof> have been
813given), then certain commands are also recognized which perform special
814operations. These commands are a letter which must appear at the start of a
815line. They are listed below.
816
817=over 4
818
819=item B<Q>
820
821End the current SSL connection and exit.
822
823=item B<R>
824
825Renegotiate the SSL session (TLSv1.2 and below only).
826
3d0dde84
MC
827=item B<k>
828
829Send a key update message to the server (TLSv1.3 only)
830
831=item B<K>
832
833Send a key update message to the server and request one back (TLSv1.3 only)
834
835=back
c3ed3b6e
DSH
836
837=head1 NOTES
838
35a810bb 839This command can be used to debug SSL servers. To connect to an SSL HTTP
c3ed3b6e
DSH
840server the command:
841
842 openssl s_client -connect servername:443
843
844would typically be used (https uses port 443). If the connection succeeds
845then an HTTP command can be given such as "GET /" to retrieve a web page.
846
847If the handshake fails then there are several possible causes, if it is
45f55f6a
KR
848nothing obvious like no client certificate then the B<-bugs>,
849B<-ssl3>, B<-tls1>, B<-no_ssl3>, B<-no_tls1> options can be tried
c3ed3b6e
DSH
850in case it is a buggy server. In particular you should play with these
851options B<before> submitting a bug report to an OpenSSL mailing list.
852
853A frequent problem when attempting to get client certificates working
854is that a web client complains it has no certificates or gives an empty
855list to choose from. This is normally because the server is not sending
856the clients certificate authority in its "acceptable CA list" when it
35a810bb 857requests a certificate. By using this command, the CA list can be viewed
8c1cbc72 858and checked. However, some servers only request client authentication
c3ed3b6e 859after a specific URL is requested. To obtain the list in this case it
a32fc687 860is necessary to use the B<-prexit> option and send an HTTP request
c3ed3b6e
DSH
861for an appropriate page.
862
863If a certificate is specified on the command line using the B<-cert>
864option it will not be used unless the server specifically requests
8c1cbc72 865a client certificate. Therefore, merely including a client certificate
c3ed3b6e
DSH
866on the command line is no guarantee that the certificate works.
867
868If there are problems verifying a server certificate then the
bdb59d97
MC
869B<-showcerts> option can be used to show all the certificates sent by the
870server.
c3ed3b6e 871
35a810bb 872This command is a test tool and is designed to continue the
4e6c12f3
DSH
873handshake after any certificate verification errors. As a result it will
874accept any certificate chain (trusted or not) sent by the peer. None test
875applications should B<not> do this as it makes them vulnerable to a MITM
876attack. This behaviour can be changed by with the B<-verify_return_error>
877option: any verify errors are then returned aborting the handshake.
878
ebc01683
JH
879The B<-bind> option may be useful if the server or a firewall requires
880connections to come from some particular address and or port.
881
c3ed3b6e
DSH
882=head1 BUGS
883
8c73aeb6 884Because this program has a lot of options and also because some of the
35a810bb
RL
885techniques used are rather old, the C source for this command is rather
886hard to read and not a model of how things should be done.
8c73aeb6 887A typical SSL client program would be much simpler.
c3ed3b6e 888
c3ed3b6e
DSH
889The B<-prexit> option is a bit of a hack. We should really report
890information whenever a session is renegotiated.
891
892=head1 SEE ALSO
893
b6b66573
DMSP
894L<openssl(1)>,
895L<openssl-sess_id(1)>,
896L<openssl-s_server(1)>,
897L<openssl-ciphers(1)>,
898L<SSL_CONF_cmd(3)>,
899L<SSL_CTX_set_max_send_fragment(3)>,
900L<SSL_CTX_set_split_send_fragment(3)>,
fd3397fc
RL
901L<SSL_CTX_set_max_pipelines(3)>,
902L<ossl_store-file(7)>
c3ed3b6e 903
fa7b0111
MC
904=head1 HISTORY
905
fc5ecadd 906The B<-no_alt_chains> option was added in OpenSSL 1.1.0.
8176431d 907The B<-name> option was added in OpenSSL 1.1.1.
fa7b0111 908
6d382c74
DDO
909The B<-certform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
910
911All B<-keyform> values except B<ENGINE> have become obsolete in OpenSSL 3.0.0
912and have no effect.
913
0f221d9c
P
914The B<-engine> option was deprecated in OpenSSL 3.0.
915
e2f92610
RS
916=head1 COPYRIGHT
917
33388b44 918Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 919
449040b4 920Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
921this file except in compliance with the License. You can obtain a copy
922in the file LICENSE in the source distribution or at
923L<https://www.openssl.org/source/license.html>.
924
925=cut