s_server.pod 20.3 KB
Newer Older
D
Dr. Stephen Henson 已提交
1 2 3 4 5 6 7 8
=pod

=head1 NAME

s_server - SSL/TLS server program

=head1 SYNOPSIS

U
Ulf Möller 已提交
9
B<openssl> B<s_server>
10
[B<-help>]
M
Matt Caswell 已提交
11
[B<-port +int>]
12 13 14 15
[B<-accept val>]
[B<-unix val>]
[B<-4>]
[B<-6>]
M
Matt Caswell 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
[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 已提交
33 34 35
[B<-nbio_test>]
[B<-crlf>]
[B<-debug>]
B
Bodo Möller 已提交
36
[B<-msg>]
M
Matt Caswell 已提交
37
[B<-msgfile outfile>]
D
Dr. Stephen Henson 已提交
38
[B<-state>]
M
Matt Caswell 已提交
39 40
[B<-CAfile infile>]
[B<-CApath dir>]
41 42
[B<-no-CAfile>]
[B<-no-CApath>]
M
Matt Caswell 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
[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>]
[B<-rand val>]
[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>]
[B<-strict>]
[B<-sigalgs val>]
[B<-client_sigalgs val>]
[B<-groups val>]
[B<-curves val>]
[B<-named_curve val>]
[B<-cipher val>]
[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>]
124
[B<-ignore_critical>]
M
Matt Caswell 已提交
125 126 127 128 129
[B<-issuer_checks>]
[B<-crl_check>]
[B<-crl_check_all>]
[B<-policy_check>]
[B<-explicit_policy>]
130 131
[B<-inhibit_any>]
[B<-inhibit_map>]
M
Matt Caswell 已提交
132 133 134
[B<-x509_strict>]
[B<-extended_crl>]
[B<-use_deltas>]
135
[B<-policy_print>]
M
Matt Caswell 已提交
136 137
[B<-check_ss_sig>]
[B<-trusted_first>]
138
[B<-suiteB_128_only>]
M
Matt Caswell 已提交
139
[B<-suiteB_128>]
140
[B<-suiteB_192>]
M
Matt Caswell 已提交
141
[B<-partial_chain>]
142
[B<-no_alt_chains>]
M
Matt Caswell 已提交
143 144 145 146 147 148 149 150 151 152 153 154 155 156
[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>]
[B<-srpvfile infile>]
[B<-srpuserseed val>]
D
Dr. Stephen Henson 已提交
157 158
[B<-ssl3>]
[B<-tls1>]
159 160 161
[B<-tls1_1>]
[B<-tls1_2>]
[B<-tls1_3>]
M
Matt Caswell 已提交
162
[B<-dtls>]
M
Matt Caswell 已提交
163 164 165
[B<-timeout>]
[B<-mtu +int>]
[B<-listen>]
M
Matt Caswell 已提交
166 167
[B<-dtls1>]
[B<-dtls1_2>]
168
[B<-sctp>]
D
Dr. Stephen Henson 已提交
169
[B<-no_dhe>]
M
Matt Caswell 已提交
170 171 172 173 174 175
[B<-nextprotoneg val>]
[B<-use_srtp val>]
[B<-alpn val>]
[B<-engine val>]
[B<-keylogfile outfile>]
[B<-max_early_data int>]
176
[B<-early_data>]
177

D
Dr. Stephen Henson 已提交
178 179 180 181 182 183 184
=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

185 186
In addition to the options below the B<s_server> utility also supports the
common and server only options documented in the
187 188
in the "Supported Command Line Commands" section of the L<SSL_CONF_cmd(3)>
manual page.
189

D
Dr. Stephen Henson 已提交
190 191
=over 4

192 193 194 195
=item B<-help>

Print out a usage message.

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

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

200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
=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 已提交
216 217 218 219 220
=item B<-unlink>

For -unix, unlink any existing socket first.

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

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

M
Matt Caswell 已提交
225 226 227 228 229 230 231 232 233 234 235 236
=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 已提交
237 238 239 240 241 242

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 已提交
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
=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 已提交
264 265 266

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

M
Matt Caswell 已提交
267
=item B<-key infile>
D
Dr. Stephen Henson 已提交
268 269 270 271

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

D
PR: 910  
Dr. Stephen Henson 已提交
272 273 274 275
=item B<-keyform format>

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

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

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

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

283
Specify an additional certificate and private key, these behave in the
D
Dr. Stephen Henson 已提交
284 285 286 287 288 289 290 291
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 已提交
292
=item B<-dcertform PEM|DER>, B<-dkeyform PEM|DER>, B<-dpass val>
D
PR: 910  
Dr. Stephen Henson 已提交
293

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

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

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

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

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

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

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

M
Matt Caswell 已提交
308
=item B<-msg>
309

M
Matt Caswell 已提交
310
Show all protocol messages with hex dump.
311

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

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

M
Matt Caswell 已提交
316 317 318 319 320
=item B<-state>

Prints the SSL session states.

=item B<-CAfile infile>
D
Dr. Stephen Henson 已提交
321 322 323 324 325 326

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 已提交
327 328 329 330 331 332
=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.

333 334
=item B<-no-CAfile>

P
Pauli 已提交
335
Do not load the trusted CA certificates from the default file location.
336 337 338

=item B<-no-CApath>

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

M
Matt Caswell 已提交
341
=item B<-nocert>
342

M
Matt Caswell 已提交
343 344 345
If this option is set then no certificate is used. This restricts the
cipher suites available to the anonymous ones (currently just anonymous
DH).
346

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

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

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

M
Matt Caswell 已提交
353 354 355 356
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 已提交
357

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

M
Matt Caswell 已提交
360 361 362
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 已提交
363

M
Matt Caswell 已提交
364
=item B<-tlsextdebug>
365

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

M
Matt Caswell 已提交
368
=item B<-HTTP>
369

M
Matt Caswell 已提交
370 371 372 373 374
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).
375

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

M
Matt Caswell 已提交
378 379 380 381
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 已提交
382

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

M
Matt Caswell 已提交
385 386 387 388 389
A file or files containing random data used to seed the random number
generator, or an EGD socket (see L<RAND_egd(3)>).
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 已提交
390

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

M
Matt Caswell 已提交
393 394 395
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 已提交
396

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

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

M
Matt Caswell 已提交
401
=item B<-status_verbose>
402

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

M
Matt Caswell 已提交
406
=item B<-status_timeout int>
407

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

M
Matt Caswell 已提交
410
=item B<-status_url val>
411

M
Matt Caswell 已提交
412 413 414
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.
415

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

M
Matt Caswell 已提交
418 419
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 已提交
420

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

M
Matt Caswell 已提交
423 424
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 已提交
425

M
Matt Caswell 已提交
426
=item B<-brief>
M
Matt Caswell 已提交
427

M
Matt Caswell 已提交
428 429
Provide a brief summary of connection parameters instead of the normal verbose
output.
M
Matt Caswell 已提交
430

M
Matt Caswell 已提交
431
=item B<-rev>
432

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

M
Matt Caswell 已提交
436 437
=item B<-async>

438
Switch on asynchronous mode. Cryptographic operations will be performed
M
Matt Caswell 已提交
439 440 441 442
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 已提交
443
=item B<-max_send_frag +int>
444 445 446 447

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

M
Matt Caswell 已提交
448
=item B<-split_send_frag +int>
449 450 451 452

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 已提交
453
a suitable cipher suite has been negotiated, an engine that supports pipelining
454 455 456
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 已提交
457
=item B<-max_pipelines +int>
458 459 460

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 已提交
461
engine) and a suitable cipher suite has been negotiated. The default value is 1.
462 463
See L<SSL_CTX_set_max_pipelines(3)> for further information.

M
Matt Caswell 已提交
464
=item B<-read_buf +int>
465 466 467 468 469 470

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 已提交
471 472 473 474 475 476 477 478
=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 已提交
479 480
=item B<-bugs>

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

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

490 491 492 493 494 495 496
=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 已提交
497
=item B<-no_ticket>
498

M
Matt Caswell 已提交
499
Disable RFC4507bis session ticket support.
500

M
Matt Caswell 已提交
501
=item B<-serverpref>
502

M
Matt Caswell 已提交
503 504 505 506 507
Use the server's cipher preferences, rather than the client's preferences.

=item B<-no_resumption_on_reneg>

Set the B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> option.
508

M
Matt Caswell 已提交
509
=item B<-client_sigalgs val>
510 511

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

M
Matt Caswell 已提交
514
=item B<-named_curve val>
515 516 517 518 519 520

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 已提交
521
=item B<-cipher val>
D
Dr. Stephen Henson 已提交
522

523
This allows the cipher list used by the server to be modified.  When
524 525 526 527
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 irrelevant. See
the B<ciphers> command for more information.
D
Dr. Stephen Henson 已提交
528

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

M
Matt Caswell 已提交
531 532 533 534 535
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.
536

M
Matt Caswell 已提交
537 538 539 540 541 542 543
=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>
544

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

M
Matt Caswell 已提交
548
=item B<-crl_check>, B<-crl_check_all>
549

M
Matt Caswell 已提交
550 551 552
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.
553

M
Matt Caswell 已提交
554
=item B<-nbio>
555

M
Matt Caswell 已提交
556
Turns on non blocking I/O.
557

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

M
Matt Caswell 已提交
560 561 562
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 已提交
563

M
Matt Caswell 已提交
564
=item B<-psk_hint val>
565

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

M
Matt Caswell 已提交
568
=item B<-psk val>
569

M
Matt Caswell 已提交
570 571 572 573
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.
574

M
Matt Caswell 已提交
575
=item B<-listen>
576

M
Matt Caswell 已提交
577 578 579 580 581 582 583
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.
584

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

M
Matt Caswell 已提交
587 588 589 590
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.
591

M
Matt Caswell 已提交
592
=item B<-sctp>
593

M
Matt Caswell 已提交
594 595 596
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.
597

M
Matt Caswell 已提交
598
=item B<-no_dhe>
599

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

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

P
Pauli 已提交
605 606 607
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 已提交
608
The B<val> list is a comma-separated list of supported protocol
P
Pauli 已提交
609
names.  The list should contain the most desirable protocols first.
610 611 612
Protocol names are printable ASCII strings, for example "http/1.1" or
"spdy/3".

M
Matt Caswell 已提交
613 614 615 616 617 618 619 620
=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 已提交
621 622 623 624

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

M
Matt Caswell 已提交
625
=item B<-max_early_data int>
626 627 628

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>
629 630
flag). The default value is approximately 16k. The argument must be an integer
greater than or equal to 0.
631 632 633 634 635

=item B<-early_data>

Accept early data where possible.

D
Dr. Stephen Henson 已提交
636 637 638 639 640
=back

=head1 CONNECTED COMMANDS

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

U
Ulf Möller 已提交
644
Certain single letter commands are also recognized which perform special
D
Dr. Stephen Henson 已提交
645 646 647 648 649 650
operations: these are listed below.

=over 4

=item B<q>

P
Pauli 已提交
651
End the current SSL connection but still accept new connections.
D
Dr. Stephen Henson 已提交
652 653 654

=item B<Q>

P
Pauli 已提交
655
End the current SSL connection and exit.
D
Dr. Stephen Henson 已提交
656 657 658

=item B<r>

P
Pauli 已提交
659
Renegotiate the SSL session.
D
Dr. Stephen Henson 已提交
660 661 662

=item B<R>

P
Pauli 已提交
663
Renegotiate the SSL session and request a client certificate.
D
Dr. Stephen Henson 已提交
664 665 666

=item B<P>

P
Pauli 已提交
667
Send some plain text down the underlying TCP connection: this should
D
Dr. Stephen Henson 已提交
668 669 670 671
cause the client to disconnect due to a protocol violation.

=item B<S>

P
Pauli 已提交
672
Print out some session cache status information.
D
Dr. Stephen Henson 已提交
673 674

=back
D
Dr. Stephen Henson 已提交
675 676 677 678 679 680 681 682 683 684 685

=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 已提交
686 687
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 已提交
688 689 690 691 692

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

=head1 BUGS

693 694 695 696
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 已提交
697 698

The output of common ciphers is wrong: it just gives the list of ciphers that
D
Dr. Stephen Henson 已提交
699
OpenSSL recognizes and the client supports.
D
Dr. Stephen Henson 已提交
700 701 702 703 704 705

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

706 707 708
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 已提交
709

710 711 712 713
=head1 HISTORY

The -no_alt_chains options was first added to OpenSSL 1.1.0.

R
Rich Salz 已提交
714 715
=head1 COPYRIGHT

P
Pauli 已提交
716
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
R
Rich Salz 已提交
717 718 719 720 721 722 723

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