df613311ed3323e9a2c723ede337639b455caa5b
[openssl.git] / doc / man1 / openssl-s_server.pod
1 =pod
2
3 =head1 NAME
4
5 openssl-s_server - SSL/TLS server program
6
7 =head1 SYNOPSIS
8
9 B<openssl> B<s_server>
10 [B<-help>]
11 [B<-port> I<+int>]
12 [B<-accept> I<val>]
13 [B<-unix> I<val>]
14 [B<-4>]
15 [B<-6>]
16 [B<-unlink>]
17 [B<-context> I<val>]
18 [B<-verify> I<int>]
19 [B<-Verify> I<int>]
20 [B<-cert> I<infile>]
21 [B<-nameopt> I<val>]
22 [B<-naccept> I<+int>]
23 [B<-serverinfo> I<val>]
24 [B<-certform> B<DER>|B<PEM>]
25 [B<-key> I<infile>]
26 [B<-keyform> I<format>]
27 [B<-pass> I<val>]
28 [B<-dcert> I<infile>]
29 [B<-dcertform> B<DER>|B<PEM>]
30 [B<-dkey> I<infile>]
31 [B<-dkeyform> B<DER>|B<PEM>]
32 [B<-dpass> I<val>]
33 [B<-nbio_test>]
34 [B<-crlf>]
35 [B<-debug>]
36 [B<-msg>]
37 [B<-msgfile> I<outfile>]
38 [B<-state>]
39 [B<-CAfile> I<infile>]
40 [B<-CApath> I<dir>]
41 [B<-no-CAfile>]
42 [B<-no-CApath>]
43 [B<-nocert>]
44 [B<-quiet>]
45 [B<-no_resume_ephemeral>]
46 [B<-www>]
47 [B<-WWW>]
48 [B<-servername>]
49 [B<-servername_fatal>]
50 [B<-cert2 infile>]
51 [B<-key2 infile>]
52 [B<-tlsextdebug>]
53 [B<-HTTP>]
54 [B<-id_prefix> I<val>]
55 [B<-rand> I<file...>]
56 [B<-writerand> I<file>]
57 [B<-keymatexport> I<val>]
58 [B<-keymatexportlen> I<+int>]
59 [B<-CRL> I<infile>]
60 [B<-crl_download>]
61 [B<-cert_chain> I<infile>]
62 [B<-dcert_chain> I<infile>]
63 [B<-chainCApath> I<dir>]
64 [B<-verifyCApath> I<dir>]
65 [B<-no_cache>]
66 [B<-ext_cache>]
67 [B<-CRLform> B<DER>|B<PEM>]
68 [B<-verify_return_error>]
69 [B<-verify_quiet>]
70 [B<-build_chain>]
71 [B<-chainCAfile> I<infile>]
72 [B<-verifyCAfile> I<infile>]
73 [B<-ign_eof>]
74 [B<-no_ign_eof>]
75 [B<-status>]
76 [B<-status_verbose>]
77 [B<-status_timeout> I<int>]
78 [B<-status_url> I<val>]
79 [B<-status_file> I<infile>]
80 [B<-trace>]
81 [B<-security_debug>]
82 [B<-security_debug_verbose>]
83 [B<-brief>]
84 [B<-rev>]
85 [B<-async>]
86 [B<-ssl_config> I<val>]
87 [B<-max_send_frag> I<+int>]
88 [B<-split_send_frag> I<+int>]
89 [B<-max_pipelines> I<+int>]
90 [B<-read_buf> I<+int>]
91 [B<-no_ssl3>]
92 [B<-no_tls1>]
93 [B<-no_tls1_1>]
94 [B<-no_tls1_2>]
95 [B<-no_tls1_3>]
96 [B<-bugs>]
97 [B<-no_comp>]
98 [B<-comp>]
99 [B<-no_ticket>]
100 [B<-num_tickets>]
101 [B<-serverpref>]
102 [B<-legacy_renegotiation>]
103 [B<-no_renegotiation>]
104 [B<-legacy_server_connect>]
105 [B<-no_resumption_on_reneg>]
106 [B<-no_legacy_server_connect>]
107 [B<-allow_no_dhe_kex>]
108 [B<-prioritize_chacha>]
109 [B<-strict>]
110 [B<-sigalgs> I<val>]
111 [B<-client_sigalgs> I<val>]
112 [B<-groups> I<val>]
113 [B<-curves> I<val>]
114 [B<-named_curve> I<val>]
115 [B<-cipher> I<val>]
116 [B<-ciphersuites> I<val>]
117 [B<-dhparam> I<infile>]
118 [B<-record_padding> I<val>]
119 [B<-debug_broken_protocol>]
120 [B<-policy> I<val>]
121 [B<-purpose> I<val>]
122 [B<-verify_name> I<val>]
123 [B<-verify_depth> I<int>]
124 [B<-auth_level> I<int>]
125 [B<-attime> I<intmax>]
126 [B<-verify_hostname> I<val>]
127 [B<-verify_email> I<val>]
128 [B<-verify_ip>]
129 [B<-ignore_critical>]
130 [B<-issuer_checks>]
131 [B<-crl_check>]
132 [B<-crl_check_all>]
133 [B<-policy_check>]
134 [B<-explicit_policy>]
135 [B<-inhibit_any>]
136 [B<-inhibit_map>]
137 [B<-x509_strict>]
138 [B<-extended_crl>]
139 [B<-use_deltas>]
140 [B<-policy_print>]
141 [B<-check_ss_sig>]
142 [B<-trusted_first>]
143 [B<-suiteB_128_only>]
144 [B<-suiteB_128>]
145 [B<-suiteB_192>]
146 [B<-partial_chain>]
147 [B<-no_alt_chains>]
148 [B<-no_check_time>]
149 [B<-allow_proxy_certs>]
150 [B<-xkey>]
151 [B<-xcert>]
152 [B<-xchain>]
153 [B<-xchain_build>]
154 [B<-xcertform> B<DER>|B<PEM>]
155 [B<-xkeyform> B<DER>|B<PEM>]
156 [B<-nbio>]
157 [B<-psk_identity> I<val>]
158 [B<-psk_hint> I<val>]
159 [B<-psk> I<val>]
160 [B<-psk_session> I<file>]
161 [B<-srpvfile> I<infile>]
162 [B<-srpuserseed> I<val>]
163 [B<-ssl3>]
164 [B<-tls1>]
165 [B<-tls1_1>]
166 [B<-tls1_2>]
167 [B<-tls1_3>]
168 [B<-dtls>]
169 [B<-timeout>]
170 [B<-mtu> I<+int>]
171 [B<-listen>]
172 [B<-dtls1>]
173 [B<-dtls1_2>]
174 [B<-sctp>]
175 [B<-sctp_label_bug>]
176 [B<-no_dhe>]
177 [B<-nextprotoneg> I<val>]
178 [B<-use_srtp> I<val>]
179 [B<-alpn> I<val>]
180 [B<-engine> I<val>]
181 [B<-keylogfile> I<outfile>]
182 [B<-max_early_data> I<int>]
183 [B<-early_data>]
184 [B<-anti_replay>]
185 [B<-no_anti_replay>]
186 [B<-http_server_binmode>]
187
188 =for comment ifdef unix 4 6 unlink no_dhe nextprotoneg use_srtp engine
189
190 =for comment ifdef status status_verbose status_timeout status_url status_file
191
192 =for comment ifdef psk_hint srpvfile srpuserseed sctp sctp_label_bug
193
194 =for comment ifdef sctp sctp_label_bug trace mtu timeout listen
195
196 =for comment ifdef ssl3 tls1 tls1_1 tls1_2 tls1_3 dtls mtu dtls1 dtls1_2
197
198 =head1 DESCRIPTION
199
200 The B<s_server> command implements a generic SSL/TLS server which listens
201 for connections on a given port using SSL/TLS.
202
203 =head1 OPTIONS
204
205 In addition to the options below the B<s_server> utility also supports the
206 common and server only options documented
207 in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
208 manual page.
209
210 =over 4
211
212 =item B<-help>
213
214 Print out a usage message.
215
216 =item B<-port> I<+int>
217
218 The TCP port to listen on for connections. If not specified 4433 is used.
219
220 =item B<-accept> I<val>
221
222 The optional TCP host and port to listen on for connections. If not specified, *:4433 is used.
223
224 =item B<-unix> I<val>
225
226 Unix domain socket to accept on.
227
228 =item B<-4>
229
230 Use IPv4 only.
231
232 =item B<-6>
233
234 Use IPv6 only.
235
236 =item B<-unlink>
237
238 For -unix, unlink any existing socket first.
239
240 =item B<-context> I<val>
241
242 Sets the SSL context id. It can be given any string value. If this option
243 is not present a default value will be used.
244
245 =item B<-verify> I<int>, B<-Verify> I<int>
246
247 The verify depth to use. This specifies the maximum length of the
248 client certificate chain and makes the server request a certificate from
249 the client. With the B<-verify> option a certificate is requested but the
250 client does not have to send one, with the B<-Verify> option the client
251 must supply a certificate or an error occurs.
252
253 If the cipher suite cannot request a client certificate (for example an
254 anonymous cipher suite or PSK) this option has no effect.
255
256 =item B<-cert> I<infile>
257
258 The certificate to use, most servers cipher suites require the use of a
259 certificate and some require a certificate with a certain public key type:
260 for example the DSS cipher suites require a certificate containing a DSS
261 (DSA) key. If not specified then the filename "server.pem" will be used.
262
263 =item B<-cert_chain>
264
265 A file containing trusted certificates to use when attempting to build the
266 client/server certificate chain related to the certificate specified via the
267 B<-cert> option.
268
269 =item B<-build_chain>
270
271 Specify whether the application should build the certificate chain to be
272 provided to the client.
273
274 =item B<-nameopt> I<val>
275
276 Option which determines how the subject or issuer names are displayed. The
277 B<val> argument can be a single option or multiple options separated by
278 commas.  Alternatively the B<-nameopt> switch may be used more than once to
279 set multiple options. See the L<x509(1)> manual page for details.
280
281 =item B<-naccept> I<+int>
282
283 The server will exit after receiving the specified number of connections,
284 default unlimited.
285
286 =item B<-serverinfo> I<val>
287
288 A file containing one or more blocks of PEM data.  Each PEM block
289 must encode a TLS ServerHello extension (2 bytes type, 2 bytes length,
290 followed by "length" bytes of extension data).  If the client sends
291 an empty TLS ClientHello extension matching the type, the corresponding
292 ServerHello extension will be returned.
293
294 =item B<-certform> B<DER>|B<PEM>
295
296 The certificate format to use: DER or PEM. PEM is the default.
297
298 =item B<-key> I<infile>
299
300 The private key to use. If not specified then the certificate file will
301 be used.
302
303 =item B<-keyform> I<format>
304
305 The private format to use: DER or PEM. PEM is the default.
306
307 =item B<-pass> I<val>
308
309 The private key password source. For more information about the format of B<val>
310 see L<openssl(1)/Pass phrase options>.
311
312 =item B<-dcert> I<infile>, B<-dkey> I<infile>
313
314 Specify an additional certificate and private key, these behave in the
315 same manner as the B<-cert> and B<-key> options except there is no default
316 if they are not specified (no additional certificate and key is used). As
317 noted above some cipher suites require a certificate containing a key of
318 a certain type. Some cipher suites need a certificate carrying an RSA key
319 and some a DSS (DSA) key. By using RSA and DSS certificates and keys
320 a server can support clients which only support RSA or DSS cipher suites
321 by using an appropriate certificate.
322
323 =item B<-dcert_chain>
324
325 A file containing trusted certificates to use when attempting to build the
326 server certificate chain when a certificate specified via the B<-dcert> option
327 is in use.
328
329 =item B<-dcertform> B<DER>|B<PEM>, B<-dkeyform> B<DER>|B<PEM>, B<-dpass> I<val>
330
331 Additional certificate and private key format and passphrase respectively.
332
333 =item B<-xkey> I<infile>, B<-xcert> I<infile>, B<-xchain>
334
335 Specify an extra certificate, private key and certificate chain. These behave
336 in the same manner as the B<-cert>, B<-key> and B<-cert_chain> options.  When
337 specified, the callback returning the first valid chain will be in use by
338 the server.
339
340 =item B<-xchain_build>
341
342 Specify whether the application should build the certificate chain to be
343 provided to the client for the extra certificates provided via B<-xkey> I<infile>,
344 B<-xcert> I<infile>, B<-xchain> options.
345
346 =item B<-xcertform> B<DER>|B<PEM>, B<-xkeyform> B<DER>|B<PEM>
347
348 Extra certificate and private key format respectively.
349
350 =item B<-nbio_test>
351
352 Tests non blocking I/O.
353
354 =item B<-crlf>
355
356 This option translated a line feed from the terminal into CR+LF.
357
358 =item B<-debug>
359
360 Print extensive debugging information including a hex dump of all traffic.
361
362 =item B<-msg>
363
364 Show all protocol messages with hex dump.
365
366 =item B<-msgfile> I<outfile>
367
368 File to send output of B<-msg> or B<-trace> to, default standard output.
369
370 =item B<-state>
371
372 Prints the SSL session states.
373
374 =item B<-CAfile> I<infile>
375
376 A file containing trusted certificates to use during client authentication
377 and to use when attempting to build the server certificate chain. The list
378 is also used in the list of acceptable client CAs passed to the client when
379 a certificate is requested.
380
381 =item B<-CApath> I<dir>
382
383 The directory to use for client certificate verification. This directory
384 must be in "hash format", see L<verify(1)> for more information. These are
385 also used when building the server certificate chain.
386
387 =item B<-chainCApath> I<dir>
388
389 The directory to use for building the chain provided to the client. This
390 directory must be in "hash format", see L<verify(1)> for more information.
391
392 =item B<-chainCAfile> I<file>
393
394 A file containing trusted certificates to use when attempting to build the
395 server certificate chain.
396
397 =item B<-no-CAfile>
398
399 Do not load the trusted CA certificates from the default file location.
400
401 =item B<-no-CApath>
402
403 Do not load the trusted CA certificates from the default directory location.
404
405 =item B<-nocert>
406
407 If this option is set then no certificate is used. This restricts the
408 cipher suites available to the anonymous ones (currently just anonymous
409 DH).
410
411 =item B<-quiet>
412
413 Inhibit printing of session and certificate information.
414
415 =item B<-www>
416
417 Sends a status message back to the client when it connects. This includes
418 information about the ciphers used and various session parameters.
419 The output is in HTML format so this option will normally be used with a
420 web browser. Cannot be used in conjunction with B<-early_data>.
421
422 =item B<-WWW>
423
424 Emulates a simple web server. Pages will be resolved relative to the
425 current directory, for example if the URL https://myhost/page.html is
426 requested the file ./page.html will be loaded. Cannot be used in conjunction
427 with B<-early_data>.
428
429 =item B<-tlsextdebug>
430
431 Print a hex dump of any TLS extensions received from the server.
432
433 =item B<-HTTP>
434
435 Emulates a simple web server. Pages will be resolved relative to the
436 current directory, for example if the URL https://myhost/page.html is
437 requested the file ./page.html will be loaded. The files loaded are
438 assumed to contain a complete and correct HTTP response (lines that
439 are part of the HTTP response line and headers must end with CRLF). Cannot be
440 used in conjunction with B<-early_data>.
441
442 =item B<-id_prefix> I<val>
443
444 Generate SSL/TLS session IDs prefixed by B<val>. This is mostly useful
445 for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
446 servers, when each of which might be generating a unique range of session
447 IDs (eg. with a certain prefix).
448
449 =item B<-rand> I<file...>
450
451 A file or files containing random data used to seed the random number
452 generator.
453 Multiple files can be specified separated by an OS-dependent character.
454 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
455 all others.
456
457 =item B<-writerand> I<file>
458
459 Writes random data to the specified I<file> upon exit.
460 This can be used with a subsequent B<-rand> flag.
461
462 =item B<-verify_return_error>
463
464 Verification errors normally just print a message but allow the
465 connection to continue, for debugging purposes.
466 If this option is used, then verification errors close the connection.
467
468 =item B<-status>
469
470 Enables certificate status request support (aka OCSP stapling).
471
472 =item B<-status_verbose>
473
474 Enables certificate status request support (aka OCSP stapling) and gives
475 a verbose printout of the OCSP response.
476
477 =item B<-status_timeout> I<int>
478
479 Sets the timeout for OCSP response to B<int> seconds.
480
481 =item B<-status_url> I<val>
482
483 Sets a fallback responder URL to use if no responder URL is present in the
484 server certificate. Without this option an error is returned if the server
485 certificate does not contain a responder address.
486
487 =item B<-status_file> I<infile>
488
489 Overrides any OCSP responder URLs from the certificate and always provides the
490 OCSP Response stored in the file. The file must be in DER format.
491
492 =item B<-trace>
493
494 Show verbose trace output of protocol messages. OpenSSL needs to be compiled
495 with B<enable-ssl-trace> for this option to work.
496
497 =item B<-brief>
498
499 Provide a brief summary of connection parameters instead of the normal verbose
500 output.
501
502 =item B<-rev>
503
504 Simple test server which just reverses the text received from the client
505 and sends it back to the server. Also sets B<-brief>. Cannot be used in
506 conjunction with B<-early_data>.
507
508 =item B<-async>
509
510 Switch on asynchronous mode. Cryptographic operations will be performed
511 asynchronously. This will only have an effect if an asynchronous capable engine
512 is also used via the B<-engine> option. For test purposes the dummy async engine
513 (dasync) can be used (if available).
514
515 =item B<-max_send_frag> I<+int>
516
517 The maximum size of data fragment to send.
518 See L<SSL_CTX_set_max_send_fragment(3)> for further information.
519
520 =item B<-split_send_frag> I<+int>
521
522 The size used to split data for encrypt pipelines. If more data is written in
523 one go than this value then it will be split into multiple pipelines, up to the
524 maximum number of pipelines defined by max_pipelines. This only has an effect if
525 a suitable cipher suite has been negotiated, an engine that supports pipelining
526 has been loaded, and max_pipelines is greater than 1. See
527 L<SSL_CTX_set_split_send_fragment(3)> for further information.
528
529 =item B<-max_pipelines> I<+int>
530
531 The maximum number of encrypt/decrypt pipelines to be used. This will only have
532 an effect if an engine has been loaded that supports pipelining (e.g. the dasync
533 engine) and a suitable cipher suite has been negotiated. The default value is 1.
534 See L<SSL_CTX_set_max_pipelines(3)> for further information.
535
536 =item B<-read_buf> I<+int>
537
538 The default read buffer size to be used for connections. This will only have an
539 effect if the buffer size is larger than the size that would otherwise be used
540 and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
541 further information).
542
543 =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-tls1_3>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2>, B<-no_tls1_3>
544
545 These options require or disable the use of the specified SSL or TLS protocols.
546 By default B<s_server> will negotiate the highest mutually supported protocol
547 version.
548 When a specific TLS version is required, only that version will be accepted
549 from the client.
550 Note that not all protocols and flags may be available, depending on how
551 OpenSSL was built.
552
553 =item B<-bugs>
554
555 There are several known bugs in SSL and TLS implementations. Adding this
556 option enables various workarounds.
557
558 =item B<-no_comp>
559
560 Disable negotiation of TLS compression.
561 TLS compression is not recommended and is off by default as of
562 OpenSSL 1.1.0.
563
564 =item B<-comp>
565
566 Enable negotiation of TLS compression.
567 This option was introduced in OpenSSL 1.1.0.
568 TLS compression is not recommended and is off by default as of
569 OpenSSL 1.1.0.
570
571 =item B<-no_ticket>
572
573 Disable RFC4507bis session ticket support. This option has no effect if TLSv1.3
574 is negotiated. See B<-num_tickets>.
575
576 =item B<-num_tickets>
577
578 Control the number of tickets that will be sent to the client after a full
579 handshake in TLSv1.3. The default number of tickets is 2. This option does not
580 affect the number of tickets sent after a resumption handshake.
581
582 =item B<-serverpref>
583
584 Use the server's cipher preferences, rather than the client's preferences.
585
586 =item B<-prioritize_chacha>
587
588 Prioritize ChaCha ciphers when preferred by clients. Requires B<-serverpref>.
589
590 =item B<-no_resumption_on_reneg>
591
592 Set the B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> option.
593
594 =item B<-client_sigalgs> I<val>
595
596 Signature algorithms to support for client certificate authentication
597 (colon-separated list).
598
599 =item B<-named_curve> I<val>
600
601 Specifies the elliptic curve to use. NOTE: this is single curve, not a list.
602 For a list of all possible curves, use:
603
604     $ openssl ecparam -list_curves
605
606 =item B<-cipher> I<val>
607
608 This allows the list of TLSv1.2 and below ciphersuites used by the server to be
609 modified. This list is combined with any TLSv1.3 ciphersuites that have been
610 configured. When the client sends a list of supported ciphers the first client
611 cipher also included in the server list is used. Because the client specifies
612 the preference order, the order of the server cipherlist is irrelevant. See
613 the B<ciphers> command for more information.
614
615 =item B<-ciphersuites> I<val>
616
617 This allows the list of TLSv1.3 ciphersuites used by the server to be modified.
618 This list is combined with any TLSv1.2 and below ciphersuites that have been
619 configured. When the client sends a list of supported ciphers the first client
620 cipher also included in the server list is used. Because the client specifies
621 the preference order, the order of the server cipherlist is irrelevant. See
622 the B<ciphers> command for more information. The format for this list is a
623 simple colon (":") separated list of TLSv1.3 ciphersuite names.
624
625 =item B<-dhparam> I<infile>
626
627 The DH parameter file to use. The ephemeral DH cipher suites generate keys
628 using a set of DH parameters. If not specified then an attempt is made to
629 load the parameters from the server certificate file.
630 If this fails then a static set of parameters hard coded into the B<s_server>
631 program will be used.
632
633 =item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
634 B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
635 B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
636 B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
637 B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
638 B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
639 B<-verify_ip>, B<-verify_name>, B<-x509_strict>
640
641 Set different peer certificate verification options.
642 See the L<verify(1)> manual page for details.
643
644 =item B<-crl_check>, B<-crl_check_all>
645
646 Check the peer certificate has not been revoked by its CA.
647 The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
648 option all CRLs of all CAs in the chain are checked.
649
650 =item B<-nbio>
651
652 Turns on non blocking I/O.
653
654 =item B<-psk_identity> I<val>
655
656 Expect the client to send PSK identity B<val> when using a PSK
657 cipher suite, and warn if they do not.  By default, the expected PSK
658 identity is the string "Client_identity".
659
660 =item B<-psk_hint> I<val>
661
662 Use the PSK identity hint B<val> when using a PSK cipher suite.
663
664 =item B<-psk> I<val>
665
666 Use the PSK key B<val> when using a PSK cipher suite. The key is
667 given as a hexadecimal number without leading 0x, for example -psk
668 1a2b3c4d.
669 This option must be provided in order to use a PSK cipher.
670
671 =item B<-psk_session> I<file>
672
673 Use the pem encoded SSL_SESSION data stored in B<file> as the basis of a PSK.
674 Note that this will only work if TLSv1.3 is negotiated.
675
676 =item B<-listen>
677
678 This option can only be used in conjunction with one of the DTLS options above.
679 With this option B<s_server> will listen on a UDP port for incoming connections.
680 Any ClientHellos that arrive will be checked to see if they have a cookie in
681 them or not.
682 Any without a cookie will be responded to with a HelloVerifyRequest.
683 If a ClientHello with a cookie is received then B<s_server> will connect to
684 that peer and complete the handshake.
685
686 =item B<-dtls>, B<-dtls1>, B<-dtls1_2>
687
688 These options make B<s_server> use DTLS protocols instead of TLS.
689 With B<-dtls>, B<s_server> will negotiate any supported DTLS protocol version,
690 whilst B<-dtls1> and B<-dtls1_2> will only support DTLSv1.0 and DTLSv1.2
691 respectively.
692
693 =item B<-sctp>
694
695 Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
696 conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
697 available where OpenSSL has support for SCTP enabled.
698
699 =item B<-sctp_label_bug>
700
701 Use the incorrect behaviour of older OpenSSL implementations when computing
702 endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
703 older broken implementations but breaks interoperability with correct
704 implementations. Must be used in conjunction with B<-sctp>. This option is only
705 available where OpenSSL has support for SCTP enabled.
706
707 =item B<-no_dhe>
708
709 If this option is set then no DH parameters will be loaded effectively
710 disabling the ephemeral DH cipher suites.
711
712 =item B<-alpn> I<val>, B<-nextprotoneg> I<val>
713
714 These flags enable the Enable the Application-Layer Protocol Negotiation
715 or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
716 IETF standard and replaces NPN.
717 The B<val> list is a comma-separated list of supported protocol
718 names.  The list should contain the most desirable protocols first.
719 Protocol names are printable ASCII strings, for example "http/1.1" or
720 "spdy/3".
721 The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
722
723 =item B<-engine> I<val>
724
725 Specifying an engine (by its unique id string in B<val>) will cause B<s_server>
726 to attempt to obtain a functional reference to the specified engine,
727 thus initialising it if needed. The engine will then be set as the default
728 for all available algorithms.
729
730 =item B<-keylogfile> I<outfile>
731
732 Appends TLS secrets to the specified keylog file such that external programs
733 (like Wireshark) can decrypt TLS connections.
734
735 =item B<-max_early_data> I<int>
736
737 Change the default maximum early data bytes that are specified for new sessions
738 and any incoming early data (when used in conjunction with the B<-early_data>
739 flag). The default value is approximately 16k. The argument must be an integer
740 greater than or equal to 0.
741
742 =item B<-early_data>
743
744 Accept early data where possible. Cannot be used in conjunction with B<-www>,
745 B<-WWW>, B<-HTTP> or B<-rev>.
746
747 =item B<-anti_replay>, B<-no_anti_replay>
748
749 Switches replay protection on or off, respectively. Replay protection is on by
750 default unless overridden by a configuration file. When it is on, OpenSSL will
751 automatically detect if a session ticket has been used more than once, TLSv1.3
752 has been negotiated, and early data is enabled on the server. A full handshake
753 is forced if a session ticket is used a second or subsequent time. Any early
754 data that was sent will be rejected.
755
756 =item B<-http_server_binmode>
757
758 When acting as web-server (using option B<-WWW> or B<-HTTP>) open files requested
759 by the client in binary mode.
760
761 =back
762
763 =head1 CONNECTED COMMANDS
764
765 If a connection request is established with an SSL client and neither the
766 B<-www> nor the B<-WWW> option has been used then normally any data received
767 from the client is displayed and any key presses will be sent to the client.
768
769 Certain commands are also recognized which perform special operations. These
770 commands are a letter which must appear at the start of a line. They are listed
771 below.
772
773 =over 4
774
775 =item B<q>
776
777 End the current SSL connection but still accept new connections.
778
779 =item B<Q>
780
781 End the current SSL connection and exit.
782
783 =item B<r>
784
785 Renegotiate the SSL session (TLSv1.2 and below only).
786
787 =item B<R>
788
789 Renegotiate the SSL session and request a client certificate (TLSv1.2 and below
790 only).
791
792 =item B<P>
793
794 Send some plain text down the underlying TCP connection: this should
795 cause the client to disconnect due to a protocol violation.
796
797 =item B<S>
798
799 Print out some session cache status information.
800
801 =item B<k>
802
803 Send a key update message to the client (TLSv1.3 only)
804
805 =item B<K>
806
807 Send a key update message to the client and request one back (TLSv1.3 only)
808
809 =item B<c>
810
811 Send a certificate request to the client (TLSv1.3 only)
812
813 =back
814
815 =head1 NOTES
816
817 B<s_server> can be used to debug SSL clients. To accept connections from
818 a web browser the command:
819
820  openssl s_server -accept 443 -www
821
822 can be used for example.
823
824 Although specifying an empty list of CAs when requesting a client certificate
825 is strictly speaking a protocol violation, some SSL clients interpret this to
826 mean any CA is acceptable. This is useful for debugging purposes.
827
828 The session parameters can printed out using the B<sess_id> program.
829
830 =head1 BUGS
831
832 Because this program has a lot of options and also because some of the
833 techniques used are rather old, the C source of B<s_server> is rather hard to
834 read and not a model of how things should be done.
835 A typical SSL server program would be much simpler.
836
837 The output of common ciphers is wrong: it just gives the list of ciphers that
838 OpenSSL recognizes and the client supports.
839
840 There should be a way for the B<s_server> program to print out details of any
841 unknown cipher suites a client says it supports.
842
843 =head1 SEE ALSO
844
845 L<openssl(1)>,
846 L<openssl-sess_id(1)>,
847 L<openssl-s_client(1)>,
848 L<openssl-ciphers(1)>,
849 L<SSL_CONF_cmd(3)>,
850 L<SSL_CTX_set_max_send_fragment(3)>,
851 L<SSL_CTX_set_split_send_fragment(3)>,
852 L<SSL_CTX_set_max_pipelines(3)>
853
854 =head1 HISTORY
855
856 The -no_alt_chains option was added in OpenSSL 1.1.0.
857
858 The
859 -allow-no-dhe-kex and -prioritize_chacha options were added in OpenSSL 1.1.1.
860
861 =head1 COPYRIGHT
862
863 Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
864
865 Licensed under the Apache License 2.0 (the "License").  You may not use
866 this file except in compliance with the License.  You can obtain a copy
867 in the file LICENSE in the source distribution or at
868 L<https://www.openssl.org/source/license.html>.
869
870 =cut