s_server.pod 21.6 KB
Newer Older
D
Dr. Stephen Henson 已提交
1 2 3 4
=pod

=head1 NAME

R
Rich Salz 已提交
5
openssl-s_server,
D
Dr. Stephen Henson 已提交
6 7 8 9
s_server - SSL/TLS server program

=head1 SYNOPSIS

U
Ulf Möller 已提交
10
B<openssl> B<s_server>
11
[B<-help>]
M
Matt Caswell 已提交
12
[B<-port +int>]
13 14 15 16
[B<-accept val>]
[B<-unix val>]
[B<-4>]
[B<-6>]
M
Matt Caswell 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
[B<-unlink>]
[B<-context val>]
[B<-verify int>]
[B<-Verify int>]
[B<-cert infile>]
[B<-nameopt val>]
[B<-naccept +int>]
[B<-serverinfo val>]
[B<-certform PEM|DER>]
[B<-key infile>]
[B<-keyform format>]
[B<-pass val>]
[B<-dcert infile>]
[B<-dcertform PEM|DER>]
[B<-dkey infile>]
[B<-dkeyform PEM|DER>]
[B<-dpass val>]
D
Dr. Stephen Henson 已提交
34 35 36
[B<-nbio_test>]
[B<-crlf>]
[B<-debug>]
B
Bodo Möller 已提交
37
[B<-msg>]
M
Matt Caswell 已提交
38
[B<-msgfile outfile>]
D
Dr. Stephen Henson 已提交
39
[B<-state>]
M
Matt Caswell 已提交
40 41
[B<-CAfile infile>]
[B<-CApath dir>]
42 43
[B<-no-CAfile>]
[B<-no-CApath>]
M
Matt Caswell 已提交
44 45 46 47 48 49 50 51 52 53 54 55
[B<-nocert>]
[B<-quiet>]
[B<-no_resume_ephemeral>]
[B<-www>]
[B<-WWW>]
[B<-servername>]
[B<-servername_fatal>]
[B<-cert2 infile>]
[B<-key2 infile>]
[B<-tlsextdebug>]
[B<-HTTP>]
[B<-id_prefix val>]
R
Rich Salz 已提交
56 57
[B<-rand file...>]
[B<-writerand file>]
M
Matt Caswell 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
[B<-keymatexport val>]
[B<-keymatexportlen +int>]
[B<-CRL infile>]
[B<-crl_download>]
[B<-cert_chain infile>]
[B<-dcert_chain infile>]
[B<-chainCApath dir>]
[B<-verifyCApath dir>]
[B<-no_cache>]
[B<-ext_cache>]
[B<-CRLform PEM|DER>]
[B<-verify_return_error>]
[B<-verify_quiet>]
[B<-build_chain>]
[B<-chainCAfile infile>]
[B<-verifyCAfile infile>]
[B<-ign_eof>]
[B<-no_ign_eof>]
[B<-status>]
[B<-status_verbose>]
[B<-status_timeout int>]
[B<-status_url val>]
[B<-status_file infile>]
[B<-trace>]
[B<-security_debug>]
[B<-security_debug_verbose>]
[B<-brief>]
[B<-rev>]
[B<-async>]
[B<-ssl_config val>]
[B<-max_send_frag +int>]
[B<-split_send_frag +int>]
[B<-max_pipelines +int>]
[B<-read_buf +int>]
[B<-no_ssl3>]
[B<-no_tls1>]
[B<-no_tls1_1>]
[B<-no_tls1_2>]
[B<-no_tls1_3>]
[B<-bugs>]
[B<-no_comp>]
[B<-comp>]
[B<-no_ticket>]
[B<-serverpref>]
[B<-legacy_renegotiation>]
[B<-no_renegotiation>]
[B<-legacy_server_connect>]
[B<-no_resumption_on_reneg>]
[B<-no_legacy_server_connect>]
107
[B<-allow_no_dhe_kex>]
108
[B<-prioritize_chacha>]
M
Matt Caswell 已提交
109 110 111 112 113 114 115
[B<-strict>]
[B<-sigalgs val>]
[B<-client_sigalgs val>]
[B<-groups val>]
[B<-curves val>]
[B<-named_curve val>]
[B<-cipher val>]
116
[B<-ciphersuites val>]
M
Matt Caswell 已提交
117 118 119 120 121 122 123 124 125 126 127 128
[B<-dhparam infile>]
[B<-record_padding val>]
[B<-debug_broken_protocol>]
[B<-policy val>]
[B<-purpose val>]
[B<-verify_name val>]
[B<-verify_depth int>]
[B<-auth_level int>]
[B<-attime intmax>]
[B<-verify_hostname val>]
[B<-verify_email val>]
[B<-verify_ip>]
129
[B<-ignore_critical>]
M
Matt Caswell 已提交
130 131 132 133 134
[B<-issuer_checks>]
[B<-crl_check>]
[B<-crl_check_all>]
[B<-policy_check>]
[B<-explicit_policy>]
135 136
[B<-inhibit_any>]
[B<-inhibit_map>]
M
Matt Caswell 已提交
137 138 139
[B<-x509_strict>]
[B<-extended_crl>]
[B<-use_deltas>]
140
[B<-policy_print>]
M
Matt Caswell 已提交
141 142
[B<-check_ss_sig>]
[B<-trusted_first>]
143
[B<-suiteB_128_only>]
M
Matt Caswell 已提交
144
[B<-suiteB_128>]
145
[B<-suiteB_192>]
M
Matt Caswell 已提交
146
[B<-partial_chain>]
147
[B<-no_alt_chains>]
M
Matt Caswell 已提交
148 149 150 151 152 153 154 155 156 157 158 159
[B<-no_check_time>]
[B<-allow_proxy_certs>]
[B<-xkey>]
[B<-xcert>]
[B<-xchain>]
[B<-xchain_build>]
[B<-xcertform PEM|DER>]
[B<-xkeyform PEM|DER>]
[B<-nbio>]
[B<-psk_identity val>]
[B<-psk_hint val>]
[B<-psk val>]
160
[B<-psk_session file>]
M
Matt Caswell 已提交
161 162
[B<-srpvfile infile>]
[B<-srpuserseed val>]
D
Dr. Stephen Henson 已提交
163 164
[B<-ssl3>]
[B<-tls1>]
165 166 167
[B<-tls1_1>]
[B<-tls1_2>]
[B<-tls1_3>]
M
Matt Caswell 已提交
168
[B<-dtls>]
M
Matt Caswell 已提交
169 170 171
[B<-timeout>]
[B<-mtu +int>]
[B<-listen>]
M
Matt Caswell 已提交
172 173
[B<-dtls1>]
[B<-dtls1_2>]
174
[B<-sctp>]
D
Dr. Stephen Henson 已提交
175
[B<-no_dhe>]
M
Matt Caswell 已提交
176 177 178 179 180 181
[B<-nextprotoneg val>]
[B<-use_srtp val>]
[B<-alpn val>]
[B<-engine val>]
[B<-keylogfile outfile>]
[B<-max_early_data int>]
182
[B<-early_data>]
183

D
Dr. Stephen Henson 已提交
184 185 186 187 188 189 190
=head1 DESCRIPTION

The B<s_server> command implements a generic SSL/TLS server which listens
for connections on a given port using SSL/TLS.

=head1 OPTIONS

191 192
In addition to the options below the B<s_server> utility also supports the
common and server only options documented in the
193 194
in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
manual page.
195

D
Dr. Stephen Henson 已提交
196 197
=over 4

198 199 200 201
=item B<-help>

Print out a usage message.

M
Matt Caswell 已提交
202
=item B<-port +int>
D
Dr. Stephen Henson 已提交
203

204
The TCP port to listen on for connections. If not specified 4433 is used.
D
Dr. Stephen Henson 已提交
205

206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
=item B<-accept val>

The optional TCP host and port to listen on for connections. If not specified, *:4433 is used.

=item B<-unix val>

Unix domain socket to accept on.

=item B<-4>

Use IPv4 only.

=item B<-6>

Use IPv6 only.

M
Matt Caswell 已提交
222 223 224 225 226
=item B<-unlink>

For -unix, unlink any existing socket first.

=item B<-context val>
D
Dr. Stephen Henson 已提交
227

228
Sets the SSL context id. It can be given any string value. If this option
D
Dr. Stephen Henson 已提交
229
is not present a default value will be used.
D
Dr. Stephen Henson 已提交
230

M
Matt Caswell 已提交
231 232 233 234 235 236 237 238 239 240 241 242
=item B<-verify int>, B<-Verify int>

The verify depth to use. This specifies the maximum length of the
client certificate chain and makes the server request a certificate from
the client. With the B<-verify> option a certificate is requested but the
client does not have to send one, with the B<-Verify> option the client
must supply a certificate or an error occurs.

If the cipher suite cannot request a client certificate (for example an
anonymous cipher suite or PSK) this option has no effect.

=item B<-cert infile>
D
Dr. Stephen Henson 已提交
243 244 245 246 247 248

The certificate to use, most servers cipher suites require the use of a
certificate and some require a certificate with a certain public key type:
for example the DSS cipher suites require a certificate containing a DSS
(DSA) key. If not specified then the filename "server.pem" will be used.

M
Matt Caswell 已提交
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
=item B<-nameopt val>

Option which determines how the subject or issuer names are displayed. The
B<val> argument can be a single option or multiple options separated by
commas.  Alternatively the B<-nameopt> switch may be used more than once to
set multiple options. See the L<x509(1)> manual page for details.

=item B<-naccept +int>

The server will exit after receiving the specified number of connections,
default unlimited.

=item B<-serverinfo val>

A file containing one or more blocks of PEM data.  Each PEM block
must encode a TLS ServerHello extension (2 bytes type, 2 bytes length,
followed by "length" bytes of extension data).  If the client sends
an empty TLS ClientHello extension matching the type, the corresponding
ServerHello extension will be returned.

=item B<-certform PEM|DER>
D
PR: 910  
Dr. Stephen Henson 已提交
270 271 272

The certificate format to use: DER or PEM. PEM is the default.

M
Matt Caswell 已提交
273
=item B<-key infile>
D
Dr. Stephen Henson 已提交
274 275 276 277

The private key to use. If not specified then the certificate file will
be used.

D
PR: 910  
Dr. Stephen Henson 已提交
278 279 280 281
=item B<-keyform format>

The private format to use: DER or PEM. PEM is the default.

M
Matt Caswell 已提交
282
=item B<-pass val>
D
PR: 910  
Dr. Stephen Henson 已提交
283

M
Matt Caswell 已提交
284
The private key password source. For more information about the format of B<val>
R
Rich Salz 已提交
285
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)>.
D
PR: 910  
Dr. Stephen Henson 已提交
286

M
Matt Caswell 已提交
287
=item B<-dcert infile>, B<-dkey infile>
D
Dr. Stephen Henson 已提交
288

289
Specify an additional certificate and private key, these behave in the
D
Dr. Stephen Henson 已提交
290 291 292 293 294 295 296 297
same manner as the B<-cert> and B<-key> options except there is no default
if they are not specified (no additional certificate and key is used). As
noted above some cipher suites require a certificate containing a key of
a certain type. Some cipher suites need a certificate carrying an RSA key
and some a DSS (DSA) key. By using RSA and DSS certificates and keys
a server can support clients which only support RSA or DSS cipher suites
by using an appropriate certificate.

M
Matt Caswell 已提交
298
=item B<-dcertform PEM|DER>, B<-dkeyform PEM|DER>, B<-dpass val>
D
PR: 910  
Dr. Stephen Henson 已提交
299

300
Additional certificate and private key format and passphrase respectively.
D
PR: 910  
Dr. Stephen Henson 已提交
301

M
Matt Caswell 已提交
302
=item B<-nbio_test>
D
Dr. Stephen Henson 已提交
303

M
Matt Caswell 已提交
304
Tests non blocking I/O.
D
Dr. Stephen Henson 已提交
305

M
Matt Caswell 已提交
306
=item B<-crlf>
D
Dr. Stephen Henson 已提交
307

M
Matt Caswell 已提交
308
This option translated a line feed from the terminal into CR+LF.
D
Dr. Stephen Henson 已提交
309

M
Matt Caswell 已提交
310
=item B<-debug>
D
Dr. Stephen Henson 已提交
311

M
Matt Caswell 已提交
312
Print extensive debugging information including a hex dump of all traffic.
D
Dr. Stephen Henson 已提交
313

M
Matt Caswell 已提交
314
=item B<-msg>
315

M
Matt Caswell 已提交
316
Show all protocol messages with hex dump.
317

M
Matt Caswell 已提交
318
=item B<-msgfile outfile>
D
Dr. Stephen Henson 已提交
319

M
Matt Caswell 已提交
320
File to send output of B<-msg> or B<-trace> to, default standard output.
D
Dr. Stephen Henson 已提交
321

M
Matt Caswell 已提交
322 323 324 325 326
=item B<-state>

Prints the SSL session states.

=item B<-CAfile infile>
D
Dr. Stephen Henson 已提交
327 328 329 330 331 332

A file containing trusted certificates to use during client authentication
and to use when attempting to build the server certificate chain. The list
is also used in the list of acceptable client CAs passed to the client when
a certificate is requested.

M
Matt Caswell 已提交
333 334 335 336 337 338
=item B<-CApath dir>

The directory to use for client certificate verification. This directory
must be in "hash format", see B<verify> for more information. These are
also used when building the server certificate chain.

339 340
=item B<-no-CAfile>

P
Pauli 已提交
341
Do not load the trusted CA certificates from the default file location.
342 343 344

=item B<-no-CApath>

P
Pauli 已提交
345
Do not load the trusted CA certificates from the default directory location.
346

M
Matt Caswell 已提交
347
=item B<-nocert>
348

M
Matt Caswell 已提交
349 350 351
If this option is set then no certificate is used. This restricts the
cipher suites available to the anonymous ones (currently just anonymous
DH).
352

M
Matt Caswell 已提交
353
=item B<-quiet>
D
Dr. Stephen Henson 已提交
354

M
Matt Caswell 已提交
355
Inhibit printing of session and certificate information.
D
Dr. Stephen Henson 已提交
356

M
Matt Caswell 已提交
357
=item B<-www>
D
Dr. Stephen Henson 已提交
358

M
Matt Caswell 已提交
359 360 361 362
Sends a status message back to the client when it connects. This includes
information about the ciphers used and various session parameters.
The output is in HTML format so this option will normally be used with a
web browser.
D
Dr. Stephen Henson 已提交
363

M
Matt Caswell 已提交
364
=item B<-WWW>
B
Bodo Möller 已提交
365

M
Matt Caswell 已提交
366 367 368
Emulates a simple web server. Pages will be resolved relative to the
current directory, for example if the URL https://myhost/page.html is
requested the file ./page.html will be loaded.
B
Bodo Möller 已提交
369

M
Matt Caswell 已提交
370
=item B<-tlsextdebug>
371

M
Matt Caswell 已提交
372
Print a hex dump of any TLS extensions received from the server.
373

M
Matt Caswell 已提交
374
=item B<-HTTP>
375

M
Matt Caswell 已提交
376 377 378 379 380
Emulates a simple web server. Pages will be resolved relative to the
current directory, for example if the URL https://myhost/page.html is
requested the file ./page.html will be loaded. The files loaded are
assumed to contain a complete and correct HTTP response (lines that
are part of the HTTP response line and headers must end with CRLF).
381

M
Matt Caswell 已提交
382
=item B<-id_prefix val>
D
Dr. Stephen Henson 已提交
383

M
Matt Caswell 已提交
384 385 386 387
Generate SSL/TLS session IDs prefixed by B<val>. This is mostly useful
for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
servers, when each of which might be generating a unique range of session
IDs (eg. with a certain prefix).
D
Dr. Stephen Henson 已提交
388

R
Rich Salz 已提交
389
=item B<-rand file...>
D
Dr. Stephen Henson 已提交
390

M
Matt Caswell 已提交
391
A file or files containing random data used to seed the random number
R
Rich Salz 已提交
392
generator.
M
Matt Caswell 已提交
393 394 395
Multiple files can be specified separated by an OS-dependent character.
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
all others.
D
Dr. Stephen Henson 已提交
396

R
Rich Salz 已提交
397 398 399 400 401
=item [B<-writerand file>]

Writes random data to the specified I<file> upon exit.
This can be used with a subsequent B<-rand> flag.

M
Matt Caswell 已提交
402
=item B<-verify_return_error>
D
Dr. Stephen Henson 已提交
403

M
Matt Caswell 已提交
404 405 406
Verification errors normally just print a message but allow the
connection to continue, for debugging purposes.
If this option is used, then verification errors close the connection.
D
Dr. Stephen Henson 已提交
407

M
Matt Caswell 已提交
408
=item B<-status>
D
Dr. Stephen Henson 已提交
409

M
Matt Caswell 已提交
410
Enables certificate status request support (aka OCSP stapling).
D
Dr. Stephen Henson 已提交
411

M
Matt Caswell 已提交
412
=item B<-status_verbose>
413

M
Matt Caswell 已提交
414 415
Enables certificate status request support (aka OCSP stapling) and gives
a verbose printout of the OCSP response.
416

M
Matt Caswell 已提交
417
=item B<-status_timeout int>
418

M
Matt Caswell 已提交
419
Sets the timeout for OCSP response to B<int> seconds.
420

M
Matt Caswell 已提交
421
=item B<-status_url val>
422

M
Matt Caswell 已提交
423 424 425
Sets a fallback responder URL to use if no responder URL is present in the
server certificate. Without this option an error is returned if the server
certificate does not contain a responder address.
426

M
Matt Caswell 已提交
427
=item B<-status_file infile>
D
Dr. Stephen Henson 已提交
428

M
Matt Caswell 已提交
429 430
Overrides any OCSP responder URLs from the certificate and always provides the
OCSP Response stored in the file. The file must be in DER format.
D
Dr. Stephen Henson 已提交
431

M
Matt Caswell 已提交
432
=item B<-trace>
M
Matt Caswell 已提交
433

M
Matt Caswell 已提交
434 435
Show verbose trace output of protocol messages. OpenSSL needs to be compiled
with B<enable-ssl-trace> for this option to work.
M
Matt Caswell 已提交
436

M
Matt Caswell 已提交
437
=item B<-brief>
M
Matt Caswell 已提交
438

M
Matt Caswell 已提交
439 440
Provide a brief summary of connection parameters instead of the normal verbose
output.
M
Matt Caswell 已提交
441

M
Matt Caswell 已提交
442
=item B<-rev>
443

M
Matt Caswell 已提交
444 445
Simple test server which just reverses the text received from the client
and sends it back to the server. Also sets B<-brief>.
446

M
Matt Caswell 已提交
447 448
=item B<-async>

449
Switch on asynchronous mode. Cryptographic operations will be performed
M
Matt Caswell 已提交
450 451 452 453
asynchronously. This will only have an effect if an asynchronous capable engine
is also used via the B<-engine> option. For test purposes the dummy async engine
(dasync) can be used (if available).

M
Matt Caswell 已提交
454
=item B<-max_send_frag +int>
455 456 457 458

The maximum size of data fragment to send.
See L<SSL_CTX_set_max_send_fragment(3)> for further information.

M
Matt Caswell 已提交
459
=item B<-split_send_frag +int>
460 461 462 463

The size used to split data for encrypt pipelines. If more data is written in
one go than this value then it will be split into multiple pipelines, up to the
maximum number of pipelines defined by max_pipelines. This only has an effect if
P
Pauli 已提交
464
a suitable cipher suite has been negotiated, an engine that supports pipelining
465 466 467
has been loaded, and max_pipelines is greater than 1. See
L<SSL_CTX_set_split_send_fragment(3)> for further information.

M
Matt Caswell 已提交
468
=item B<-max_pipelines +int>
469 470 471

The maximum number of encrypt/decrypt pipelines to be used. This will only have
an effect if an engine has been loaded that supports pipelining (e.g. the dasync
P
Pauli 已提交
472
engine) and a suitable cipher suite has been negotiated. The default value is 1.
473 474
See L<SSL_CTX_set_max_pipelines(3)> for further information.

M
Matt Caswell 已提交
475
=item B<-read_buf +int>
476 477 478 479 480 481

The default read buffer size to be used for connections. This will only have an
effect if the buffer size is larger than the size that would otherwise be used
and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
further information).

M
Matt Caswell 已提交
482 483 484 485 486 487 488 489
=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>

These options require or disable the use of the specified SSL or TLS protocols.
By default B<s_server> will negotiate the highest mutually supported protocol
version.
When a specific TLS version is required, only that version will be accepted
from the client.

D
Dr. Stephen Henson 已提交
490 491
=item B<-bugs>

492
There are several known bug in SSL and TLS implementations. Adding this
D
Dr. Stephen Henson 已提交
493 494
option enables various workarounds.

M
Matt Caswell 已提交
495 496 497 498 499 500
=item B<-no_comp>

Disable negotiation of TLS compression.
TLS compression is not recommended and is off by default as of
OpenSSL 1.1.0.

501 502 503 504 505 506 507
=item B<-comp>

Enable negotiation of TLS compression.
This option was introduced in OpenSSL 1.1.0.
TLS compression is not recommended and is off by default as of
OpenSSL 1.1.0.

M
Matt Caswell 已提交
508
=item B<-no_ticket>
509

M
Matt Caswell 已提交
510
Disable RFC4507bis session ticket support.
511

M
Matt Caswell 已提交
512
=item B<-serverpref>
513

M
Matt Caswell 已提交
514 515
Use the server's cipher preferences, rather than the client's preferences.

516 517 518 519
=item B<-prioritize_chacha>

Prioritize ChaCha ciphers when preferred by clients. Requires B<-serverpref>.

M
Matt Caswell 已提交
520 521 522
=item B<-no_resumption_on_reneg>

Set the B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> option.
523

M
Matt Caswell 已提交
524
=item B<-client_sigalgs val>
525 526

Signature algorithms to support for client certificate authentication
P
Pauli 已提交
527
(colon-separated list).
528

M
Matt Caswell 已提交
529
=item B<-named_curve val>
530 531 532 533 534 535

Specifies the elliptic curve to use. NOTE: this is single curve, not a list.
For a list of all possible curves, use:

    $ openssl ecparam -list_curves

M
Matt Caswell 已提交
536
=item B<-cipher val>
D
Dr. Stephen Henson 已提交
537

538 539 540 541 542
This allows the list of TLSv1.2 and below ciphersuites used by the server to be
modified. This list is combined with any TLSv1.3 ciphersuites that have been
configured. When the client sends a list of supported ciphers the first client
cipher also included in the server list is used. Because the client specifies
the preference order, the order of the server cipherlist is irrelevant. See
543
the B<ciphers> command for more information.
D
Dr. Stephen Henson 已提交
544

545 546 547 548 549 550 551 552 553 554
=item B<-ciphersuites val>

This allows the list of TLSv1.3 ciphersuites used by the server to be modified.
This list is combined with any TLSv1.2 and below ciphersuites that have been
configured. When the client sends a list of supported ciphers the first client
cipher also included in the server list is used. Because the client specifies
the preference order, the order of the server cipherlist is irrelevant. See
the B<ciphers> command for more information. The format for this list is a
simple colon (":") separated list of TLSv1.3 ciphersuite names.

M
Matt Caswell 已提交
555
=item B<-dhparam infile>
R
Richard Levitte 已提交
556

M
Matt Caswell 已提交
557 558 559 560 561
The DH parameter file to use. The ephemeral DH cipher suites generate keys
using a set of DH parameters. If not specified then an attempt is made to
load the parameters from the server certificate file.
If this fails then a static set of parameters hard coded into the B<s_server>
program will be used.
562

M
Matt Caswell 已提交
563 564 565 566 567 568 569
=item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
B<-verify_ip>, B<-verify_name>, B<-x509_strict>
570

M
Matt Caswell 已提交
571 572
Set different peer certificate verification options.
See the L<verify(1)> manual page for details.
573

M
Matt Caswell 已提交
574
=item B<-crl_check>, B<-crl_check_all>
575

M
Matt Caswell 已提交
576 577 578
Check the peer certificate has not been revoked by its CA.
The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
option all CRLs of all CAs in the chain are checked.
579

M
Matt Caswell 已提交
580
=item B<-nbio>
581

M
Matt Caswell 已提交
582
Turns on non blocking I/O.
583

M
Matt Caswell 已提交
584
=item B<-psk_identity val>
T
Trevor 已提交
585

M
Matt Caswell 已提交
586 587 588
Expect the client to send PSK identity B<val> when using a PSK
cipher suite, and warn if they do not.  By default, the expected PSK
identity is the string "Client_identity".
T
Trevor 已提交
589

M
Matt Caswell 已提交
590
=item B<-psk_hint val>
591

M
Matt Caswell 已提交
592
Use the PSK identity hint B<val> when using a PSK cipher suite.
593

M
Matt Caswell 已提交
594
=item B<-psk val>
595

M
Matt Caswell 已提交
596 597 598 599
Use the PSK key B<val> when using a PSK cipher suite. The key is
given as a hexadecimal number without leading 0x, for example -psk
1a2b3c4d.
This option must be provided in order to use a PSK cipher.
600

601 602 603 604 605
=item B<-psk_session file>

Use the pem encoded SSL_SESSION data stored in B<file> as the basis of a PSK.
Note that this will only work if TLSv1.3 is negotiated.

M
Matt Caswell 已提交
606
=item B<-listen>
607

M
Matt Caswell 已提交
608 609 610 611 612 613 614
This option can only be used in conjunction with one of the DTLS options above.
With this option B<s_server> will listen on a UDP port for incoming connections.
Any ClientHellos that arrive will be checked to see if they have a cookie in
them or not.
Any without a cookie will be responded to with a HelloVerifyRequest.
If a ClientHello with a cookie is received then B<s_server> will connect to
that peer and complete the handshake.
615

M
Matt Caswell 已提交
616
=item B<-dtls>, B<-dtls1>, B<-dtls1_2>
617

M
Matt Caswell 已提交
618 619 620 621
These options make B<s_server> use DTLS protocols instead of TLS.
With B<-dtls>, B<s_server> will negotiate any supported DTLS protocol version,
whilst B<-dtls1> and B<-dtls1_2> will only support DTLSv1.0 and DTLSv1.2
respectively.
622

M
Matt Caswell 已提交
623
=item B<-sctp>
624

M
Matt Caswell 已提交
625 626 627
Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
available where OpenSSL has support for SCTP enabled.
628

M
Matt Caswell 已提交
629
=item B<-no_dhe>
630

M
Matt Caswell 已提交
631 632
If this option is set then no DH parameters will be loaded effectively
disabling the ephemeral DH cipher suites.
633

M
Matt Caswell 已提交
634
=item B<-alpn val>, B<-nextprotoneg val>
635

P
Pauli 已提交
636 637 638
These flags enable the Enable the Application-Layer Protocol Negotiation
or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
IETF standard and replaces NPN.
M
Matt Caswell 已提交
639
The B<val> list is a comma-separated list of supported protocol
P
Pauli 已提交
640
names.  The list should contain the most desirable protocols first.
641 642
Protocol names are printable ASCII strings, for example "http/1.1" or
"spdy/3".
643
The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
644

M
Matt Caswell 已提交
645 646 647 648 649 650 651 652
=item B<-engine val>

Specifying an engine (by its unique id string in B<val>) will cause B<s_server>
to attempt to obtain a functional reference to the specified engine,
thus initialising it if needed. The engine will then be set as the default
for all available algorithms.

=item B<-keylogfile outfile>
P
Peter Wu 已提交
653 654 655 656

Appends TLS secrets to the specified keylog file such that external programs
(like Wireshark) can decrypt TLS connections.

M
Matt Caswell 已提交
657
=item B<-max_early_data int>
658 659 660

Change the default maximum early data bytes that are specified for new sessions
and any incoming early data (when used in conjunction with the B<-early_data>
661 662
flag). The default value is approximately 16k. The argument must be an integer
greater than or equal to 0.
663 664 665 666 667

=item B<-early_data>

Accept early data where possible.

D
Dr. Stephen Henson 已提交
668 669 670 671 672
=back

=head1 CONNECTED COMMANDS

If a connection request is established with an SSL client and neither the
D
Dr. Stephen Henson 已提交
673
B<-www> nor the B<-WWW> option has been used then normally any data received
674
from the client is displayed and any key presses will be sent to the client.
D
Dr. Stephen Henson 已提交
675

U
Ulf Möller 已提交
676
Certain single letter commands are also recognized which perform special
D
Dr. Stephen Henson 已提交
677 678 679 680 681 682
operations: these are listed below.

=over 4

=item B<q>

P
Pauli 已提交
683
End the current SSL connection but still accept new connections.
D
Dr. Stephen Henson 已提交
684 685 686

=item B<Q>

P
Pauli 已提交
687
End the current SSL connection and exit.
D
Dr. Stephen Henson 已提交
688 689 690

=item B<r>

P
Pauli 已提交
691
Renegotiate the SSL session.
D
Dr. Stephen Henson 已提交
692 693 694

=item B<R>

P
Pauli 已提交
695
Renegotiate the SSL session and request a client certificate.
D
Dr. Stephen Henson 已提交
696 697 698

=item B<P>

P
Pauli 已提交
699
Send some plain text down the underlying TCP connection: this should
D
Dr. Stephen Henson 已提交
700 701 702 703
cause the client to disconnect due to a protocol violation.

=item B<S>

P
Pauli 已提交
704
Print out some session cache status information.
D
Dr. Stephen Henson 已提交
705 706

=back
D
Dr. Stephen Henson 已提交
707 708 709 710 711 712 713 714 715 716 717

=head1 NOTES

B<s_server> can be used to debug SSL clients. To accept connections from
a web browser the command:

 openssl s_server -accept 443 -www

can be used for example.

Although specifying an empty list of CAs when requesting a client certificate
D
Dr. Stephen Henson 已提交
718 719
is strictly speaking a protocol violation, some SSL clients interpret this to
mean any CA is acceptable. This is useful for debugging purposes.
D
Dr. Stephen Henson 已提交
720 721 722 723 724

The session parameters can printed out using the B<sess_id> program.

=head1 BUGS

725 726 727 728
Because this program has a lot of options and also because some of the
techniques used are rather old, the C source of B<s_server> is rather hard to
read and not a model of how things should be done.
A typical SSL server program would be much simpler.
D
Dr. Stephen Henson 已提交
729 730

The output of common ciphers is wrong: it just gives the list of ciphers that
D
Dr. Stephen Henson 已提交
731
OpenSSL recognizes and the client supports.
D
Dr. Stephen Henson 已提交
732 733 734 735 736 737

There should be a way for the B<s_server> program to print out details of any
unknown cipher suites a client says it supports.

=head1 SEE ALSO

738 739 740
L<SSL_CONF_cmd(3)>, L<sess_id(1)>, L<s_client(1)>, L<ciphers(1)>
L<SSL_CTX_set_max_send_fragment(3)>, L<SSL_CTX_set_split_send_fragment(3)>
L<SSL_CTX_set_max_pipelines(3)> 
D
Dr. Stephen Henson 已提交
741

742 743
=head1 HISTORY

744 745 746 747
The -no_alt_chains option was first added to OpenSSL 1.1.0.

The -allow-no-dhe-kex and -prioritize_chacha options were first added to
OpenSSL 1.1.1.
748

R
Rich Salz 已提交
749 750
=head1 COPYRIGHT

M
Matt Caswell 已提交
751
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
R
Rich Salz 已提交
752 753 754 755 756 757 758

Licensed under the OpenSSL license (the "License").  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
L<https://www.openssl.org/source/license.html>.

=cut