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