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