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