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