]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man1/openssl-s_client.pod.in
Make better use of new load_cert_pass() variant of load_cert() in apps/
[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
2a33470b 237=item B<-cert> I<filename>
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
2a33470b
DDO
286the private key and certifiate file password source.
287For more information about the format of I<arg>
f5c14c63 288see L<openssl(1)/Pass phrase options>.
826a42a0 289
e8769719 290=item B<-verify> I<depth>
c3ed3b6e
DSH
291
292The verify depth to use. This specifies the maximum length of the
293server certificate chain and turns on server certificate verification.
294Currently the verify operation continues after errors so all the problems
295with a certificate chain can be seen. As a side effect the connection
296will never fail due to a server certificate verify failure.
297
4e6c12f3
DSH
298=item B<-verify_return_error>
299
300Return verification errors instead of continuing. This will typically
301abort the handshake with a fatal error.
302
0dda37f5
RS
303=item B<-verify_quiet>
304
305Limit verify output to only errors.
306
307=item B<-verifyCAfile> I<filename>
308
2b264aee
DDO
309A file in PEM format containing trusted certificates to use
310for verifying the server's certificate.
0dda37f5
RS
311
312=item B<-verifyCApath> I<dir>
313
2b264aee
DDO
314A directory containing trusted certificates to use
315for verifying the server's certificate.
316This directory must be in "hash format",
317see L<openssl-verify(1)> for more information.
0dda37f5
RS
318
319=item B<-verifyCAstore> I<uri>
320
2b264aee
DDO
321The URI of a store containing trusted certificates to use
322for verifying the server's certificate.
0dda37f5 323
2b264aee 324=item B<-chainCAfile> I<file>
7cacbe9d 325
2b264aee
DDO
326A file in PEM format containing trusted certificates to use
327when attempting to build the client certificate chain.
7cacbe9d 328
2b264aee 329=item B<-chainCApath> I<directory>
7cacbe9d 330
2b264aee
DDO
331A directory containing trusted certificates to use
332for building the client certificate chain provided to the server.
333This directory must be in "hash format",
334see L<openssl-verify(1)> for more information.
7cacbe9d 335
fd3397fc
RL
336=item B<-chainCAstore> I<uri>
337
2b264aee
DDO
338The URI of a store containing trusted certificates to use
339when attempting to build the client certificate chain.
340The URI may indicate a single certificate, as well as a collection of them.
341With URIs in the C<file:> scheme, this acts as B<-chainCAfile> or
342B<-chainCApath>, depending on if the URI indicates a directory or a
343single file.
344See L<ossl_store-file(7)> for more information on the C<file:> scheme.
fd3397fc 345
e8769719 346=item B<-requestCAfile> I<file>
5a185729
DSH
347
348A file containing a list of certificates whose subject names will be sent
349to the server in the B<certificate_authorities> extension. Only supported
350for TLS 1.3
351
e8769719 352=item B<-dane_tlsa_domain> I<domain>
cddd424a
VD
353
354Enable RFC6698/RFC7671 DANE TLSA authentication and specify the
355TLSA base domain which becomes the default SNI hint and the primary
356reference identifier for hostname checks. This must be used in
357combination with at least one instance of the B<-dane_tlsa_rrdata>
358option below.
359
360When DANE authentication succeeds, the diagnostic output will include
361the lowest (closest to 0) depth at which a TLSA record authenticated
362a chain certificate. When that TLSA record is a "2 1 0" trust
363anchor public key that signed (rather than matched) the top-most
364certificate of the chain, the result is reported as "TA public key
365verified". Otherwise, either the TLSA record "matched TA certificate"
366at a positive depth or else "matched EE certificate" at depth 0.
367
e8769719 368=item B<-dane_tlsa_rrdata> I<rrdata>
cddd424a
VD
369
370Use one or more times to specify the RRDATA fields of the DANE TLSA
2f0ea936 371RRset associated with the target service. The I<rrdata> value is
7fa8bcfe 372specified in "presentation form", that is four whitespace separated
cddd424a
VD
373fields that specify the usage, selector, matching type and associated
374data, with the last of these encoded in hexadecimal. Optional
375whitespace is ignored in the associated data field. For example:
376
c0a445a9
VD
377 $ openssl s_client -brief -starttls smtp \
378 -connect smtp.example.com:25 \
cddd424a
VD
379 -dane_tlsa_domain smtp.example.com \
380 -dane_tlsa_rrdata "2 1 1
381 B111DD8A1C2091A89BD4FD60C57F0716CCE50FEEFF8137CDBEE0326E 02CF362B" \
382 -dane_tlsa_rrdata "2 1 1
383 60B87575447DCBA2A36B7D11AC09FB24A9DB406FEE12D2CC90180517 616E8A18"
cddd424a 384 ...
c0a445a9 385 Verification: OK
cddd424a 386 Verified peername: smtp.example.com
c0a445a9 387 DANE TLSA 2 1 1 ...ee12d2cc90180517616e8a18 matched TA certificate at depth 1
cddd424a
VD
388 ...
389
c4fbed6c
VD
390=item B<-dane_ee_no_namechecks>
391
392This disables server name checks when authenticating via DANE-EE(3) TLSA
393records.
394For some applications, primarily web browsers, it is not safe to disable name
395checks due to "unknown key share" attacks, in which a malicious server can
396convince a client that a connection to a victim server is instead a secure
397connection to the malicious server.
398The malicious server may then be able to violate cross-origin scripting
399restrictions.
400Thus, despite the text of RFC7671, name checks are by default enabled for
401DANE-EE(3) TLSA records, and can be disabled in applications where it is safe
402to do so.
403In particular, SMTP and XMPP clients should set this option as SRV and MX
404records already make it possible for a remote domain to redirect client
405connections to any server of its choice, and in any case SMTP and XMPP clients
406do not execute scripts downloaded from remote servers.
407
c3ed3b6e
DSH
408=item B<-reconnect>
409
c4de074e 410Reconnects to the same server 5 times using the same session ID, this can
c3ed3b6e
DSH
411be used as a test that session caching is working.
412
c3ed3b6e
DSH
413=item B<-showcerts>
414
bdb59d97
MC
415Displays the server certificate list as sent by the server: it only consists of
416certificates the server has sent (in the order the server has sent them). It is
417B<not> a verified chain.
c3ed3b6e
DSH
418
419=item B<-prexit>
420
c4de074e 421Print session information when the program exits. This will always attempt
c3ed3b6e
DSH
422to print out information even if the connection fails. Normally information
423will only be printed out once if the connection succeeds. This option is useful
424because the cipher in use may be renegotiated or the connection may fail
425because a client certificate is required or is requested only after an
426attempt is made to access a certain URL. Note: the output produced by this
427option is not always accurate because a connection might never have been
428established.
429
430=item B<-state>
431
c4de074e 432Prints out the SSL session states.
c3ed3b6e
DSH
433
434=item B<-debug>
435
c4de074e 436Print extensive debugging information including a hex dump of all traffic.
c3ed3b6e 437
0dda37f5
RS
438=item B<-nocommands>
439
440Do not use interactive command letters.
441
442=item B<-security_debug>
443
444Enable security debug messages.
445
446=item B<-security_debug_verbose>
447
448Output more security debug output.
449
1d8634b1
BM
450=item B<-msg>
451
0dda37f5
RS
452Show protocol messages.
453
454=item B<-timeout>
455
456Enable send/receive timeout on DTLS connections.
457
458=item B<-mtu> I<size>
459
460Set MTU of the link layer to the specified size.
461
462=item B<-keymatexport> I<label>
463
464Export keying material using the specified label.
465
466=item B<-keymatexportlen> I<len>
467
912f8a98 468Export the specified number of bytes of keying material; default is 20.
0dda37f5 469
c4de074e 470Show all protocol messages with hex dump.
1d8634b1 471
8dbeb110
DSH
472=item B<-trace>
473
c4de074e 474Show verbose trace output of protocol messages. OpenSSL needs to be compiled
8dbeb110
DSH
475with B<enable-ssl-trace> for this option to work.
476
0dda37f5 477=item B<-msgfile> I<filename>
8dbeb110 478
c4de074e 479File to send output of B<-msg> or B<-trace> to, default standard output.
8dbeb110 480
c3ed3b6e
DSH
481=item B<-nbio_test>
482
490c8711 483Tests nonblocking I/O
c3ed3b6e
DSH
484
485=item B<-nbio>
486
490c8711 487Turns on nonblocking I/O
c3ed3b6e
DSH
488
489=item B<-crlf>
490
c4de074e 491This option translated a line feed from the terminal into CR+LF as required
c3ed3b6e
DSH
492by some servers.
493
ce301b6b
RL
494=item B<-ign_eof>
495
c4de074e 496Inhibit shutting down the connection when end of file is reached in the
ce301b6b
RL
497input.
498
c3ed3b6e
DSH
499=item B<-quiet>
500
c4de074e 501Inhibit printing of session and certificate information. This implicitly
ce301b6b 502turns on B<-ign_eof> as well.
c3ed3b6e 503
fc1d88f0
RS
504=item B<-no_ign_eof>
505
c4de074e 506Shut down the connection when end of file is reached in the input.
fc1d88f0
RS
507Can be used to override the implicit B<-ign_eof> after B<-quiet>.
508
e8769719 509=item B<-psk_identity> I<identity>
ddac1974 510
2f0ea936 511Use the PSK identity I<identity> when using a PSK cipher suite.
9d772829 512The default value is "Client_identity" (without the quotes).
ddac1974 513
e8769719 514=item B<-psk> I<key>
ddac1974 515
2f0ea936 516Use the PSK key I<key> when using a PSK cipher suite. The key is
ddac1974
NL
517given as a hexadecimal number without leading 0x, for example -psk
5181a2b3c4d.
9d772829 519This option must be provided in order to use a PSK cipher.
ddac1974 520
e8769719 521=item B<-psk_session> I<file>
9e064bc1 522
2f0ea936 523Use the pem encoded SSL_SESSION data stored in I<file> as the basis of a PSK.
9e064bc1
MC
524Note that this will only work if TLSv1.3 is negotiated.
525
19044d3c
MC
526=item B<-sctp>
527
528Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
529conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
530available where OpenSSL has support for SCTP enabled.
531
09d62b33
MT
532=item B<-sctp_label_bug>
533
534Use the incorrect behaviour of older OpenSSL implementations when computing
535endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
536older broken implementations but breaks interoperability with correct
537implementations. Must be used in conjunction with B<-sctp>. This option is only
538available where OpenSSL has support for SCTP enabled.
539
fb0e87fb
BM
540=item B<-fallback_scsv>
541
542Send TLS_FALLBACK_SCSV in the ClientHello.
c3ed3b6e 543
bc8857bf
MC
544=item B<-async>
545
c4de074e 546Switch on asynchronous mode. Cryptographic operations will be performed
bc8857bf
MC
547asynchronously. This will only have an effect if an asynchronous capable engine
548is also used via the B<-engine> option. For test purposes the dummy async engine
549(dasync) can be used (if available).
550
0dda37f5
RS
551=item B<-maxfraglen> I<len>
552
553Enable Maximum Fragment Length Negotiation; allowed values are
554C<512>, C<1024>, C<2048>, and C<4096>.
555
e8769719 556=item B<-max_send_frag> I<int>
28e5ea88
F
557
558The maximum size of data fragment to send.
559See L<SSL_CTX_set_max_send_fragment(3)> for further information.
560
e8769719 561=item B<-split_send_frag> I<int>
0df80881
MC
562
563The size used to split data for encrypt pipelines. If more data is written in
564one go than this value then it will be split into multiple pipelines, up to the
565maximum number of pipelines defined by max_pipelines. This only has an effect if
c4de074e 566a suitable cipher suite has been negotiated, an engine that supports pipelining
0df80881
MC
567has been loaded, and max_pipelines is greater than 1. See
568L<SSL_CTX_set_split_send_fragment(3)> for further information.
569
e8769719 570=item B<-max_pipelines> I<int>
0df80881
MC
571
572The maximum number of encrypt/decrypt pipelines to be used. This will only have
573an effect if an engine has been loaded that supports pipelining (e.g. the dasync
c4de074e 574engine) and a suitable cipher suite has been negotiated. The default value is 1.
0df80881
MC
575See L<SSL_CTX_set_max_pipelines(3)> for further information.
576
e8769719 577=item B<-read_buf> I<int>
0df80881
MC
578
579The default read buffer size to be used for connections. This will only have an
580effect if the buffer size is larger than the size that would otherwise be used
581and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
582further information).
583
09b90e0e
DB
584=item B<-ignore_unexpected_eof>
585
586Some TLS implementations do not send the mandatory close_notify alert on
587shutdown. If the application tries to wait for the close_notify alert but the
588peer closes the connection without sending it, an error is generated. When this
589option is enabled the peer does not need to send the close_notify alert and a
590closed connection will be treated as if the close_notify alert was received.
591For more information on shutting down a connection, see L<SSL_shutdown(3)>.
592
c3ed3b6e
DSH
593=item B<-bugs>
594
fc4e500b 595There are several known bugs in SSL and TLS implementations. Adding this
c3ed3b6e
DSH
596option enables various workarounds.
597
cc5a9ba4
VD
598=item B<-comp>
599
600Enables support for SSL/TLS compression.
601This option was introduced in OpenSSL 1.1.0.
602TLS compression is not recommended and is off by default as of
603OpenSSL 1.1.0.
604
605=item B<-no_comp>
606
607Disables support for SSL/TLS compression.
608TLS compression is not recommended and is off by default as of
609OpenSSL 1.1.0.
610
765b4137
DSH
611=item B<-brief>
612
c4de074e 613Only provide a brief summary of connection parameters instead of the
765b4137
DSH
614normal verbose output.
615
e8769719 616=item B<-sigalgs> I<sigalglist>
254b58fd
SC
617
618Specifies the list of signature algorithms that are sent by the client.
619The server selects one entry in the list based on its preferences.
620For example strings, see L<SSL_CTX_set1_sigalgs(3)>
621
e8769719 622=item B<-curves> I<curvelist>
254b58fd
SC
623
624Specifies the list of supported curves to be sent by the client. The curve is
ce3dcdc9 625ultimately selected by the server. For a list of all curves, use:
254b58fd
SC
626
627 $ openssl ecparam -list_curves
628
e8769719 629=item B<-cipher> I<cipherlist>
c3ed3b6e 630
9d2674cd
MC
631This allows the TLSv1.2 and below cipher list sent by the client to be modified.
632This list will be combined with any TLSv1.3 ciphersuites that have been
633configured. Although the server determines which ciphersuite is used it should
35a810bb
RL
634take the first supported cipher in the list sent by the client. See
635L<openssl-ciphers(1)> for more information.
9d2674cd 636
e8769719 637=item B<-ciphersuites> I<val>
9d2674cd
MC
638
639This allows the TLSv1.3 ciphersuites sent by the client to be modified. This
640list will be combined with any TLSv1.2 and below ciphersuites that have been
641configured. Although the server determines which cipher suite is used it should
35a810bb
RL
642take the first supported cipher in the list sent by the client. See
643L<openssl-ciphers(1)> for more information. The format for this list is a simple
9d2674cd 644colon (":") separated list of TLSv1.3 ciphersuite names.
c3ed3b6e 645
e8769719 646=item B<-starttls> I<protocol>
e986704d 647
c4de074e 648Send the protocol-specific message(s) to switch to TLS for communication.
2f0ea936 649I<protocol> is a keyword for the intended protocol. Currently, the only
cfb4f1ef 650supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
a2d9cfba 651"irc", "postgres", "mysql", "lmtp", "nntp", "sieve" and "ldap".
e986704d 652
e8769719 653=item B<-xmpphost> I<hostname>
b98af49d 654
898ea7b8
KE
655This option, when used with "-starttls xmpp" or "-starttls xmpp-server",
656specifies the host for the "to" attribute of the stream element.
b98af49d
CALP
657If this option is not specified, then the host specified with "-connect"
658will be used.
659
8176431d
PY
660This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
661
e8769719 662=item B<-name> I<hostname>
8176431d
PY
663
664This option is used to specify hostname information for various protocols
665used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
666"smtp" and "lmtp" can utilize this B<-name> option.
667
668If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
669if specifies the host for the "to" attribute of the stream element. If this
670option is not specified, then the host specified with "-connect" will be used.
671
672If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
673the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
674this option is not specified, then "mail.example.com" will be used.
675
d24a9c8f
DSH
676=item B<-tlsextdebug>
677
c4de074e 678Print out a hex dump of any TLS extensions received from the server.
d24a9c8f
DSH
679
680=item B<-no_ticket>
681
c4de074e 682Disable RFC4507bis session ticket support.
d24a9c8f 683
e8769719 684=item B<-sess_out> I<filename>
d24a9c8f 685
2f0ea936 686Output SSL session to I<filename>.
d24a9c8f 687
2f0ea936 688=item B<-sess_in> I<filename>
d24a9c8f 689
2f0ea936 690Load SSL session from I<filename>. The client will attempt to resume a
d24a9c8f
DSH
691connection from this session.
692
e8769719 693=item B<-serverinfo> I<types>
9cd50f73 694
c4de074e 695A list of comma-separated TLS Extension Types (numbers between 0 and
9cd50f73
T
69665535). Each type will be sent as an empty ClientHello TLS Extension.
697The server's response (if any) will be encoded and displayed as a PEM
698file.
699
cba3f1c7
DSH
700=item B<-status>
701
c4de074e 702Sends a certificate status request to the server (OCSP stapling). The server
cba3f1c7
DSH
703response (if any) is printed out.
704
e8769719 705=item B<-alpn> I<protocols>, B<-nextprotoneg> I<protocols>
7efd0e77 706
c4de074e
P
707These flags enable the Enable the Application-Layer Protocol Negotiation
708or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
709IETF standard and replaces NPN.
2f0ea936 710The I<protocols> list is a comma-separated list of protocol names that
c4de074e
P
711the client should advertise support for. The list should contain the most
712desirable protocols first. Protocol names are printable ASCII strings,
713for example "http/1.1" or "spdy/3".
714An empty list of protocols is treated specially and will cause the
715client to advertise support for the TLS extension but disconnect just
716after receiving ServerHello with a list of server supported protocols.
837f87c2 717The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
7efd0e77 718
e75138ab 719=item B<-ct>, B<-noct>
eb64a6c6 720
43341433
VD
721Use one of these two options to control whether Certificate Transparency (CT)
722is enabled (B<-ct>) or disabled (B<-noct>).
723If CT is enabled, signed certificate timestamps (SCTs) will be requested from
724the server and reported at handshake completion.
eb64a6c6
RP
725
726Enabling CT also enables OCSP stapling, as this is one possible delivery method
727for SCTs.
728
729=item B<-ctlogfile>
730
731A file containing a list of known Certificate Transparency logs. See
732L<SSL_CTX_set_ctlog_list_file(3)> for the expected file format.
733
e8769719 734=item B<-keylogfile> I<file>
4bf73e9f
PW
735
736Appends TLS secrets to the specified keylog file such that external programs
737(like Wireshark) can decrypt TLS connections.
738
e8769719 739=item B<-early_data> I<file>
6437b802
MC
740
741Reads the contents of the specified file and attempts to send it as early data
742to the server. This will only work with resumed sessions that support early
743data and when the server accepts the early data.
744
32097b33 745=item B<-enable_pha>
9d75dce3 746
32097b33
MC
747For TLSv1.3 only, send the Post-Handshake Authentication extension. This will
748happen whether or not a certificate has been provided via B<-cert>.
9d75dce3 749
0dda37f5
RS
750=item B<-use_srtp> I<value>
751
752Offer SRTP key management, where B<value> is a colon-separated profile list.
753
754=item B<-srpuser> I<value>
755
756Set the SRP username to the specified value.
757
758=item B<-srppass> I<value>
759
760Set the SRP password to the specified value.
761
762=item B<-srp_lateuser>
763
764SRP username for the second ClientHello message.
765
766=item B<-srp_moregroups>
767
768Tolerate other than the known B<g> and B<N> values.
769
770=item B<-srp_strength> I<number>
771
772Set the minimal acceptable length, in bits, for B<N>.
773
d4bff20d 774{- $OpenSSL::safe::opt_version_item -}
729ef856 775
bc24e3ee
RS
776{- $OpenSSL::safe::opt_name_item -}
777
9fcb9702
RS
778{- $OpenSSL::safe::opt_x_item -}
779
780{- $OpenSSL::safe::opt_trust_item -}
781
0dda37f5
RS
782{- $OpenSSL::safe::opt_s_item -}
783
9fcb9702
RS
784{- $OpenSSL::safe::opt_r_item -}
785
6bd4e3f2
P
786{- $OpenSSL::safe::opt_provider_item -}
787
018aaeb4
RS
788{- $OpenSSL::safe::opt_engine_item -}
789
0dda37f5
RS
790=item B<-ssl_client_engine> I<id>
791
792Specify engine to be used for client certificate operations.
793
21d08b9e
RS
794{- $OpenSSL::safe::opt_v_item -}
795
796Verification errors are displayed, for debugging, but the command will
797proceed unless the B<-verify_return_error> option is used.
798
d4bff20d
RS
799=item I<host>:I<port>
800
801Rather than providing B<-connect>, the target hostname and optional port may
802be provided as a single positional argument after all options. If neither this
803nor B<-connect> are provided, falls back to attempting to connect to
804I<localhost> on port I<4433>.
805
efeca6aa
UM
806=back
807
c3ed3b6e
DSH
808=head1 CONNECTED COMMANDS
809
810If a connection is established with an SSL server then any data received
811from the server is displayed and any key presses will be sent to the
3d0dde84
MC
812server. If end of file is reached then the connection will be closed down. When
813used interactively (which means neither B<-quiet> nor B<-ign_eof> have been
814given), then certain commands are also recognized which perform special
815operations. These commands are a letter which must appear at the start of a
816line. They are listed below.
817
818=over 4
819
820=item B<Q>
821
822End the current SSL connection and exit.
823
824=item B<R>
825
826Renegotiate the SSL session (TLSv1.2 and below only).
827
3d0dde84
MC
828=item B<k>
829
830Send a key update message to the server (TLSv1.3 only)
831
832=item B<K>
833
834Send a key update message to the server and request one back (TLSv1.3 only)
835
836=back
c3ed3b6e
DSH
837
838=head1 NOTES
839
35a810bb 840This command can be used to debug SSL servers. To connect to an SSL HTTP
c3ed3b6e
DSH
841server the command:
842
843 openssl s_client -connect servername:443
844
845would typically be used (https uses port 443). If the connection succeeds
846then an HTTP command can be given such as "GET /" to retrieve a web page.
847
848If the handshake fails then there are several possible causes, if it is
45f55f6a
KR
849nothing obvious like no client certificate then the B<-bugs>,
850B<-ssl3>, B<-tls1>, B<-no_ssl3>, B<-no_tls1> options can be tried
c3ed3b6e
DSH
851in case it is a buggy server. In particular you should play with these
852options B<before> submitting a bug report to an OpenSSL mailing list.
853
854A frequent problem when attempting to get client certificates working
855is that a web client complains it has no certificates or gives an empty
856list to choose from. This is normally because the server is not sending
857the clients certificate authority in its "acceptable CA list" when it
35a810bb 858requests a certificate. By using this command, the CA list can be viewed
8c1cbc72 859and checked. However, some servers only request client authentication
c3ed3b6e 860after a specific URL is requested. To obtain the list in this case it
a32fc687 861is necessary to use the B<-prexit> option and send an HTTP request
c3ed3b6e
DSH
862for an appropriate page.
863
864If a certificate is specified on the command line using the B<-cert>
865option it will not be used unless the server specifically requests
8c1cbc72 866a client certificate. Therefore, merely including a client certificate
c3ed3b6e
DSH
867on the command line is no guarantee that the certificate works.
868
869If there are problems verifying a server certificate then the
bdb59d97
MC
870B<-showcerts> option can be used to show all the certificates sent by the
871server.
c3ed3b6e 872
35a810bb 873This command is a test tool and is designed to continue the
4e6c12f3
DSH
874handshake after any certificate verification errors. As a result it will
875accept any certificate chain (trusted or not) sent by the peer. None test
876applications should B<not> do this as it makes them vulnerable to a MITM
877attack. This behaviour can be changed by with the B<-verify_return_error>
878option: any verify errors are then returned aborting the handshake.
879
ebc01683
JH
880The B<-bind> option may be useful if the server or a firewall requires
881connections to come from some particular address and or port.
882
c3ed3b6e
DSH
883=head1 BUGS
884
8c73aeb6 885Because this program has a lot of options and also because some of the
35a810bb
RL
886techniques used are rather old, the C source for this command is rather
887hard to read and not a model of how things should be done.
8c73aeb6 888A typical SSL client program would be much simpler.
c3ed3b6e 889
c3ed3b6e
DSH
890The B<-prexit> option is a bit of a hack. We should really report
891information whenever a session is renegotiated.
892
893=head1 SEE ALSO
894
b6b66573
DMSP
895L<openssl(1)>,
896L<openssl-sess_id(1)>,
897L<openssl-s_server(1)>,
898L<openssl-ciphers(1)>,
899L<SSL_CONF_cmd(3)>,
900L<SSL_CTX_set_max_send_fragment(3)>,
901L<SSL_CTX_set_split_send_fragment(3)>,
fd3397fc
RL
902L<SSL_CTX_set_max_pipelines(3)>,
903L<ossl_store-file(7)>
c3ed3b6e 904
fa7b0111
MC
905=head1 HISTORY
906
fc5ecadd 907The B<-no_alt_chains> option was added in OpenSSL 1.1.0.
8176431d 908The B<-name> option was added in OpenSSL 1.1.1.
fa7b0111 909
6d382c74
DDO
910The B<-certform> option has become obsolete in OpenSSL 3.0.0 and has no effect.
911
912All B<-keyform> values except B<ENGINE> have become obsolete in OpenSSL 3.0.0
913and have no effect.
914
0f221d9c
P
915The B<-engine> option was deprecated in OpenSSL 3.0.
916
e2f92610
RS
917=head1 COPYRIGHT
918
33388b44 919Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 920
449040b4 921Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
922this file except in compliance with the License. You can obtain a copy
923in the file LICENSE in the source distribution or at
924L<https://www.openssl.org/source/license.html>.
925
926=cut