s_server.pod 20.4 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
[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>]
105
[B<-allow_no_dhe_kex>]
M
Matt Caswell 已提交
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
[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>]
125
[B<-ignore_critical>]
M
Matt Caswell 已提交
126 127 128 129 130
[B<-issuer_checks>]
[B<-crl_check>]
[B<-crl_check_all>]
[B<-policy_check>]
[B<-explicit_policy>]
131 132
[B<-inhibit_any>]
[B<-inhibit_map>]
M
Matt Caswell 已提交
133 134 135
[B<-x509_strict>]
[B<-extended_crl>]
[B<-use_deltas>]
136
[B<-policy_print>]
M
Matt Caswell 已提交
137 138
[B<-check_ss_sig>]
[B<-trusted_first>]
139
[B<-suiteB_128_only>]
M
Matt Caswell 已提交
140
[B<-suiteB_128>]
141
[B<-suiteB_192>]
M
Matt Caswell 已提交
142
[B<-partial_chain>]
143
[B<-no_alt_chains>]
M
Matt Caswell 已提交
144 145 146 147 148 149 150 151 152 153 154 155 156 157
[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 已提交
158 159
[B<-ssl3>]
[B<-tls1>]
160 161 162
[B<-tls1_1>]
[B<-tls1_2>]
[B<-tls1_3>]
M
Matt Caswell 已提交
163
[B<-dtls>]
M
Matt Caswell 已提交
164 165 166
[B<-timeout>]
[B<-mtu +int>]
[B<-listen>]
M
Matt Caswell 已提交
167 168
[B<-dtls1>]
[B<-dtls1_2>]
169
[B<-sctp>]
D
Dr. Stephen Henson 已提交
170
[B<-no_dhe>]
M
Matt Caswell 已提交
171 172 173 174 175 176
[B<-nextprotoneg val>]
[B<-use_srtp val>]
[B<-alpn val>]
[B<-engine val>]
[B<-keylogfile outfile>]
[B<-max_early_data int>]
177
[B<-early_data>]
178

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

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

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

193 194 195 196
=item B<-help>

Print out a usage message.

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

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

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

For -unix, unlink any existing socket first.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Prints the SSL session states.

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

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

334 335
=item B<-no-CAfile>

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

=item B<-no-CApath>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

M
Matt Caswell 已提交
386 387 388 389 390
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 已提交
391

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

M
Matt Caswell 已提交
504 505 506 507 508
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.
509

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

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

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

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

524
This allows the cipher list used by the server to be modified.  When
525 526 527 528
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 已提交
529

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

=item B<-early_data>

Accept early data where possible.

D
Dr. Stephen Henson 已提交
638 639 640 641 642
=back

=head1 CONNECTED COMMANDS

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

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

=over 4

=item B<q>

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

=item B<Q>

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

=item B<r>

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

=item B<R>

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

=item B<P>

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

=item B<S>

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

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

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

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

=head1 BUGS

695 696 697 698
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 已提交
699 700

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

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

708 709 710
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 已提交
711

712 713 714 715
=head1 HISTORY

The -no_alt_chains options was first added to OpenSSL 1.1.0.

R
Rich Salz 已提交
716 717
=head1 COPYRIGHT

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

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