4 {- join("\n", @autowarntext) -}
10 openssl-s_server - SSL/TLS server program
14 B<openssl> B<s_server>
28 [B<-serverinfo> I<val>]
29 [B<-certform> B<DER>|B<PEM>]
31 [B<-keyform> B<DER>|B<PEM>]
34 [B<-dcertform> B<DER>|B<PEM>]
36 [B<-dkeyform> B<DER>|B<PEM>]
42 [B<-msgfile> I<outfile>]
46 [B<-no_resume_ephemeral>]
50 [B<-servername_fatal>]
55 [B<-id_prefix> I<val>]
56 [B<-keymatexport> I<val>]
57 [B<-keymatexportlen> I<+int>]
60 [B<-cert_chain> I<infile>]
61 [B<-dcert_chain> I<infile>]
62 [B<-chainCApath> I<dir>]
63 [B<-verifyCApath> I<dir>]
64 [B<-chainCAstore> I<uri>]
65 [B<-verifyCAstore> I<uri>]
68 [B<-verify_return_error>]
71 [B<-chainCAfile> I<infile>]
72 [B<-verifyCAfile> I<infile>]
77 [B<-status_timeout> I<int>]
78 [B<-status_url> I<val>]
79 [B<-status_file> I<infile>]
82 [B<-security_debug_verbose>]
86 [B<-ssl_config> I<val>]
87 [B<-max_send_frag> I<+int>]
88 [B<-split_send_frag> I<+int>]
89 [B<-max_pipelines> I<+int>]
90 [B<-read_buf> I<+int>]
102 [B<-legacy_renegotiation>]
103 [B<-no_renegotiation>]
104 [B<-legacy_server_connect>]
105 [B<-no_resumption_on_reneg>]
106 [B<-no_legacy_server_connect>]
107 [B<-allow_no_dhe_kex>]
108 [B<-prioritize_chacha>]
111 [B<-client_sigalgs> I<val>]
114 [B<-named_curve> I<val>]
116 [B<-ciphersuites> I<val>]
117 [B<-dhparam> I<infile>]
118 [B<-record_padding> I<val>]
119 [B<-debug_broken_protocol>]
122 [B<-verify_name> I<val>]
123 [B<-verify_depth> I<int>]
124 [B<-auth_level> I<int>]
125 [B<-attime> I<intmax>]
126 [B<-verify_hostname> I<val>]
127 [B<-verify_email> I<val>]
129 [B<-ignore_critical>]
134 [B<-explicit_policy>]
143 [B<-suiteB_128_only>]
149 [B<-allow_proxy_certs>]
151 [B<-psk_identity> I<val>]
152 [B<-psk_hint> I<val>]
154 [B<-psk_session> I<file>]
155 [B<-srpvfile> I<infile>]
156 [B<-srpuserseed> I<val>]
171 [B<-nextprotoneg> I<val>]
172 [B<-use_srtp> I<val>]
175 [B<-keylogfile> I<outfile>]
176 [B<-max_early_data> I<int>]
180 [B<-http_server_binmode>]
181 {- $OpenSSL::safe::opt_x_synopsis -}
182 {- $OpenSSL::safe::opt_trust_synopsis -}
183 {- $OpenSSL::safe::opt_r_synopsis -}
185 =for openssl ifdef unix 4 6 unlink no_dhe nextprotoneg use_srtp engine
187 =for openssl ifdef status status_verbose status_timeout status_url status_file
189 =for openssl ifdef psk_hint srpvfile srpuserseed sctp sctp_label_bug
191 =for openssl ifdef sctp sctp_label_bug trace mtu timeout listen
193 =for openssl ifdef ssl3 tls1 tls1_1 tls1_2 tls1_3 dtls mtu dtls1 dtls1_2
197 This command implements a generic SSL/TLS server which
198 listens for connections on a given port using SSL/TLS.
202 In addition to the options below, this command also supports
203 the common and server only options documented
204 L<SSL_CONF_cmd(3)/Supported Command Line Commands>
210 Print out a usage message.
212 =item B<-port> I<+int>
214 The TCP port to listen on for connections. If not specified 4433 is used.
216 =item B<-accept> I<val>
218 The optional TCP host and port to listen on for connections. If not specified, *:4433 is used.
220 =item B<-unix> I<val>
222 Unix domain socket to accept on.
234 For -unix, unlink any existing socket first.
236 =item B<-context> I<val>
238 Sets the SSL context id. It can be given any string value. If this option
239 is not present a default value will be used.
241 =item B<-verify> I<int>, B<-Verify> I<int>
243 The verify depth to use. This specifies the maximum length of the
244 client certificate chain and makes the server request a certificate from
245 the client. With the B<-verify> option a certificate is requested but the
246 client does not have to send one, with the B<-Verify> option the client
247 must supply a certificate or an error occurs.
249 If the cipher suite cannot request a client certificate (for example an
250 anonymous cipher suite or PSK) this option has no effect.
252 =item B<-cert> I<infile>
254 The certificate to use, most servers cipher suites require the use of a
255 certificate and some require a certificate with a certain public key type:
256 for example the DSS cipher suites require a certificate containing a DSS
257 (DSA) key. If not specified then the filename F<server.pem> will be used.
261 A file containing trusted certificates to use when attempting to build the
262 client/server certificate chain related to the certificate specified via the
265 =item B<-build_chain>
267 Specify whether the application should build the certificate chain to be
268 provided to the client.
270 =item B<-nameopt> I<val>
272 Option which determines how the subject or issuer names are displayed. The
273 I<val> argument can be a single option or multiple options separated by
274 commas. Alternatively the B<-nameopt> switch may be used more than once to
275 set multiple options. See the L<openssl-x509(1)> manual page for details.
277 =item B<-naccept> I<+int>
279 The server will exit after receiving the specified number of connections,
282 =item B<-serverinfo> I<val>
284 A file containing one or more blocks of PEM data. Each PEM block
285 must encode a TLS ServerHello extension (2 bytes type, 2 bytes length,
286 followed by "length" bytes of extension data). If the client sends
287 an empty TLS ClientHello extension matching the type, the corresponding
288 ServerHello extension will be returned.
290 =item B<-certform> B<DER>|B<PEM>, B<-CRLForm> B<DER>|B<PEM>
292 The certificate and CRL format; the default is PEM.
293 See L<openssl(1)/Format Options> for details.
295 =item B<-key> I<infile>
297 The private key to use. If not specified then the certificate file will
300 =item B<-keyform> B<DER>|B<PEM>
302 The key format; the default is B<PEM>.
303 See L<openssl(1)/Format Options> for details.
305 =item B<-pass> I<val>
307 The private key password source.
308 For more information about the format of I<val>,
309 see L<openssl(1)/Pass Phrase Options>.
311 =item B<-dcert> I<infile>, B<-dkey> I<infile>
313 Specify an additional certificate and private key, these behave in the
314 same manner as the B<-cert> and B<-key> options except there is no default
315 if they are not specified (no additional certificate and key is used). As
316 noted above some cipher suites require a certificate containing a key of
317 a certain type. Some cipher suites need a certificate carrying an RSA key
318 and some a DSS (DSA) key. By using RSA and DSS certificates and keys
319 a server can support clients which only support RSA or DSS cipher suites
320 by using an appropriate certificate.
322 =item B<-dcert_chain>
324 A file containing trusted certificates to use when attempting to build the
325 server certificate chain when a certificate specified via the B<-dcert> option
328 =item B<-dcertform> B<DER>|B<PEM>, B<-dkeyform> B<DER>|B<PEM>
330 The format of the certificate and private key; the default is B<PEM>
331 see L<openssl(1)/Format Options>.
333 =item B<-dpass> I<val>
335 The passphrase for the additional private key.
336 For more information about the format of I<val>,
337 see L<openssl(1)/Pass Phrase Options>.
341 Tests non blocking I/O.
345 This option translated a line feed from the terminal into CR+LF.
349 Print extensive debugging information including a hex dump of all traffic.
353 Show all protocol messages with hex dump.
355 =item B<-msgfile> I<outfile>
357 File to send output of B<-msg> or B<-trace> to, default standard output.
361 Prints the SSL session states.
363 =item B<-chainCApath> I<dir>
365 The directory to use for building the chain provided to the client. This
366 directory must be in "hash format", see L<openssl-verify(1)> for more
369 =item B<-chainCAfile> I<file>
371 A file containing trusted certificates to use when attempting to build the
372 server certificate chain.
374 =item B<-chainCAstore> I<uri>
376 The URI to a store to use for building the chain provided to the client.
377 The URI may indicate a single certificate, as well as a collection of
379 With URIs in the C<file:> scheme, this acts as B<-chainCAfile> or
380 B<-chainCApath>, depending on if the URI indicates a directory or a
382 See L<ossl_store-file(7)> for more information on the C<file:> scheme.
386 If this option is set then no certificate is used. This restricts the
387 cipher suites available to the anonymous ones (currently just anonymous
392 Inhibit printing of session and certificate information.
396 Sends a status message back to the client when it connects. This includes
397 information about the ciphers used and various session parameters.
398 The output is in HTML format so this option will normally be used with a
399 web browser. Cannot be used in conjunction with B<-early_data>.
403 Emulates a simple web server. Pages will be resolved relative to the
404 current directory, for example if the URL https://myhost/page.html is
405 requested the file F<./page.html> will be loaded. Cannot be used in conjunction
408 =item B<-tlsextdebug>
410 Print a hex dump of any TLS extensions received from the server.
414 Emulates a simple web server. Pages will be resolved relative to the
415 current directory, for example if the URL https://myhost/page.html is
416 requested the file F<./page.html> will be loaded. The files loaded are
417 assumed to contain a complete and correct HTTP response (lines that
418 are part of the HTTP response line and headers must end with CRLF). Cannot be
419 used in conjunction with B<-early_data>.
421 =item B<-id_prefix> I<val>
423 Generate SSL/TLS session IDs prefixed by I<val>. This is mostly useful
424 for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
425 servers, when each of which might be generating a unique range of session
426 IDs (eg. with a certain prefix).
428 =item B<-verify_return_error>
430 Verification errors normally just print a message but allow the
431 connection to continue, for debugging purposes.
432 If this option is used, then verification errors close the connection.
436 Enables certificate status request support (aka OCSP stapling).
438 =item B<-status_verbose>
440 Enables certificate status request support (aka OCSP stapling) and gives
441 a verbose printout of the OCSP response.
443 =item B<-status_timeout> I<int>
445 Sets the timeout for OCSP response to I<int> seconds.
447 =item B<-status_url> I<val>
449 Sets a fallback responder URL to use if no responder URL is present in the
450 server certificate. Without this option an error is returned if the server
451 certificate does not contain a responder address.
453 =item B<-status_file> I<infile>
455 Overrides any OCSP responder URLs from the certificate and always provides the
456 OCSP Response stored in the file. The file must be in DER format.
460 Show verbose trace output of protocol messages. OpenSSL needs to be compiled
461 with B<enable-ssl-trace> for this option to work.
465 Provide a brief summary of connection parameters instead of the normal verbose
470 Simple test server which just reverses the text received from the client
471 and sends it back to the server. Also sets B<-brief>. Cannot be used in
472 conjunction with B<-early_data>.
476 Switch on asynchronous mode. Cryptographic operations will be performed
477 asynchronously. This will only have an effect if an asynchronous capable engine
478 is also used via the B<-engine> option. For test purposes the dummy async engine
479 (dasync) can be used (if available).
481 =item B<-max_send_frag> I<+int>
483 The maximum size of data fragment to send.
484 See L<SSL_CTX_set_max_send_fragment(3)> for further information.
486 =item B<-split_send_frag> I<+int>
488 The size used to split data for encrypt pipelines. If more data is written in
489 one go than this value then it will be split into multiple pipelines, up to the
490 maximum number of pipelines defined by max_pipelines. This only has an effect if
491 a suitable cipher suite has been negotiated, an engine that supports pipelining
492 has been loaded, and max_pipelines is greater than 1. See
493 L<SSL_CTX_set_split_send_fragment(3)> for further information.
495 =item B<-max_pipelines> I<+int>
497 The maximum number of encrypt/decrypt pipelines to be used. This will only have
498 an effect if an engine has been loaded that supports pipelining (e.g. the dasync
499 engine) and a suitable cipher suite has been negotiated. The default value is 1.
500 See L<SSL_CTX_set_max_pipelines(3)> for further information.
502 =item B<-read_buf> I<+int>
504 The default read buffer size to be used for connections. This will only have an
505 effect if the buffer size is larger than the size that would otherwise be used
506 and pipelining is in use (see L<SSL_CTX_set_default_read_buffer_len(3)> for
507 further information).
509 =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>
511 These options require or disable the use of the specified SSL or TLS protocols.
512 By default, this command will negotiate the highest mutually supported
514 When a specific TLS version is required, only that version will be accepted
516 Note that not all protocols and flags may be available, depending on how
521 There are several known bugs in SSL and TLS implementations. Adding this
522 option enables various workarounds.
526 Disable negotiation of TLS compression.
527 TLS compression is not recommended and is off by default as of
532 Enable negotiation of TLS compression.
533 This option was introduced in OpenSSL 1.1.0.
534 TLS compression is not recommended and is off by default as of
539 Disable RFC4507bis session ticket support. This option has no effect if TLSv1.3
540 is negotiated. See B<-num_tickets>.
542 =item B<-num_tickets>
544 Control the number of tickets that will be sent to the client after a full
545 handshake in TLSv1.3. The default number of tickets is 2. This option does not
546 affect the number of tickets sent after a resumption handshake.
550 Use the server's cipher preferences, rather than the client's preferences.
552 =item B<-prioritize_chacha>
554 Prioritize ChaCha ciphers when preferred by clients. Requires B<-serverpref>.
556 =item B<-no_resumption_on_reneg>
558 Set the B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> option.
560 =item B<-client_sigalgs> I<val>
562 Signature algorithms to support for client certificate authentication
563 (colon-separated list).
565 =item B<-named_curve> I<val>
567 Specifies the elliptic curve to use. NOTE: this is single curve, not a list.
568 For a list of all possible curves, use:
570 $ openssl ecparam -list_curves
572 =item B<-cipher> I<val>
574 This allows the list of TLSv1.2 and below ciphersuites used by the server to be
575 modified. This list is combined with any TLSv1.3 ciphersuites that have been
576 configured. When the client sends a list of supported ciphers the first client
577 cipher also included in the server list is used. Because the client specifies
578 the preference order, the order of the server cipherlist is irrelevant. See
579 L<openssl-ciphers(1)> for more information.
581 =item B<-ciphersuites> I<val>
583 This allows the list of TLSv1.3 ciphersuites used by the server to be modified.
584 This list is combined with any TLSv1.2 and below ciphersuites that have been
585 configured. When the client sends a list of supported ciphers the first client
586 cipher also included in the server list is used. Because the client specifies
587 the preference order, the order of the server cipherlist is irrelevant. See
588 L<openssl-ciphers(1)> command for more information. The format for this list is
589 a simple colon (":") separated list of TLSv1.3 ciphersuite names.
591 =item B<-dhparam> I<infile>
593 The DH parameter file to use. The ephemeral DH cipher suites generate keys
594 using a set of DH parameters. If not specified then an attempt is made to
595 load the parameters from the server certificate file.
596 If this fails then a static set of parameters hard coded into this command
599 =item B<-attime>, B<-check_ss_sig>, B<-crl_check>, B<-crl_check_all>,
600 B<-explicit_policy>, B<-extended_crl>, B<-ignore_critical>, B<-inhibit_any>,
601 B<-inhibit_map>, B<-no_alt_chains>, B<-no_check_time>, B<-partial_chain>, B<-policy>,
602 B<-policy_check>, B<-policy_print>, B<-purpose>, B<-suiteB_128>,
603 B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>, B<-use_deltas>,
604 B<-auth_level>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
605 B<-verify_ip>, B<-verify_name>, B<-x509_strict>
607 Set different peer certificate verification options.
608 See the L<openssl-verify(1)> manual page for details.
610 =item B<-crl_check>, B<-crl_check_all>
612 Check the peer certificate has not been revoked by its CA.
613 The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
614 option all CRLs of all CAs in the chain are checked.
618 Turns on non blocking I/O.
620 =item B<-psk_identity> I<val>
622 Expect the client to send PSK identity I<val> when using a PSK
623 cipher suite, and warn if they do not. By default, the expected PSK
624 identity is the string "Client_identity".
626 =item B<-psk_hint> I<val>
628 Use the PSK identity hint I<val> when using a PSK cipher suite.
632 Use the PSK key I<val> when using a PSK cipher suite. The key is
633 given as a hexadecimal number without leading 0x, for example -psk
635 This option must be provided in order to use a PSK cipher.
637 =item B<-psk_session> I<file>
639 Use the pem encoded SSL_SESSION data stored in I<file> as the basis of a PSK.
640 Note that this will only work if TLSv1.3 is negotiated.
644 This option can only be used in conjunction with one of the DTLS options above.
645 With this option, this command will listen on a UDP port for incoming
647 Any ClientHellos that arrive will be checked to see if they have a cookie in
649 Any without a cookie will be responded to with a HelloVerifyRequest.
650 If a ClientHello with a cookie is received then this command will
651 connect to that peer and complete the handshake.
653 =item B<-dtls>, B<-dtls1>, B<-dtls1_2>
655 These options make this command use DTLS protocols instead of TLS.
656 With B<-dtls>, it will negotiate any supported DTLS protocol
657 version, whilst B<-dtls1> and B<-dtls1_2> will only support DTLSv1.0 and
658 DTLSv1.2 respectively.
662 Use SCTP for the transport protocol instead of UDP in DTLS. Must be used in
663 conjunction with B<-dtls>, B<-dtls1> or B<-dtls1_2>. This option is only
664 available where OpenSSL has support for SCTP enabled.
666 =item B<-sctp_label_bug>
668 Use the incorrect behaviour of older OpenSSL implementations when computing
669 endpoint-pair shared secrets for DTLS/SCTP. This allows communication with
670 older broken implementations but breaks interoperability with correct
671 implementations. Must be used in conjunction with B<-sctp>. This option is only
672 available where OpenSSL has support for SCTP enabled.
676 If this option is set then no DH parameters will be loaded effectively
677 disabling the ephemeral DH cipher suites.
679 =item B<-alpn> I<val>, B<-nextprotoneg> I<val>
681 These flags enable the Enable the Application-Layer Protocol Negotiation
682 or Next Protocol Negotiation (NPN) extension, respectively. ALPN is the
683 IETF standard and replaces NPN.
684 The I<val> list is a comma-separated list of supported protocol
685 names. The list should contain the most desirable protocols first.
686 Protocol names are printable ASCII strings, for example "http/1.1" or
688 The flag B<-nextprotoneg> cannot be specified if B<-tls1_3> is used.
690 =item B<-engine> I<val>
692 Specifying an engine (by its unique id string in I<val>) will cause
693 this command to attempt to obtain a functional reference to the
694 specified engine, thus initialising it if needed. The engine will then be
695 set as the default for all available algorithms.
697 =item B<-keylogfile> I<outfile>
699 Appends TLS secrets to the specified keylog file such that external programs
700 (like Wireshark) can decrypt TLS connections.
702 =item B<-max_early_data> I<int>
704 Change the default maximum early data bytes that are specified for new sessions
705 and any incoming early data (when used in conjunction with the B<-early_data>
706 flag). The default value is approximately 16k. The argument must be an integer
707 greater than or equal to 0.
711 Accept early data where possible. Cannot be used in conjunction with B<-www>,
712 B<-WWW>, B<-HTTP> or B<-rev>.
714 =item B<-anti_replay>, B<-no_anti_replay>
716 Switches replay protection on or off, respectively. Replay protection is on by
717 default unless overridden by a configuration file. When it is on, OpenSSL will
718 automatically detect if a session ticket has been used more than once, TLSv1.3
719 has been negotiated, and early data is enabled on the server. A full handshake
720 is forced if a session ticket is used a second or subsequent time. Any early
721 data that was sent will be rejected.
723 =item B<-http_server_binmode>
725 When acting as web-server (using option B<-WWW> or B<-HTTP>) open files requested
726 by the client in binary mode.
728 {- $OpenSSL::safe::opt_x_item -}
730 {- $OpenSSL::safe::opt_trust_item -}
732 {- $OpenSSL::safe::opt_r_item -}
736 =head1 CONNECTED COMMANDS
738 If a connection request is established with an SSL client and neither the
739 B<-www> nor the B<-WWW> option has been used then normally any data received
740 from the client is displayed and any key presses will be sent to the client.
742 Certain commands are also recognized which perform special operations. These
743 commands are a letter which must appear at the start of a line. They are listed
750 End the current SSL connection but still accept new connections.
754 End the current SSL connection and exit.
758 Renegotiate the SSL session (TLSv1.2 and below only).
762 Renegotiate the SSL session and request a client certificate (TLSv1.2 and below
767 Send some plain text down the underlying TCP connection: this should
768 cause the client to disconnect due to a protocol violation.
772 Print out some session cache status information.
776 Send a key update message to the client (TLSv1.3 only)
780 Send a key update message to the client and request one back (TLSv1.3 only)
784 Send a certificate request to the client (TLSv1.3 only)
790 This command can be used to debug SSL clients. To accept connections
791 from a web browser the command:
793 openssl s_server -accept 443 -www
795 can be used for example.
797 Although specifying an empty list of CAs when requesting a client certificate
798 is strictly speaking a protocol violation, some SSL clients interpret this to
799 mean any CA is acceptable. This is useful for debugging purposes.
801 The session parameters can printed out using the L<openssl-sess_id(1)> command.
805 Because this program has a lot of options and also because some of the
806 techniques used are rather old, the C source for this command is rather
807 hard to read and not a model of how things should be done.
808 A typical SSL server program would be much simpler.
810 The output of common ciphers is wrong: it just gives the list of ciphers that
811 OpenSSL recognizes and the client supports.
813 There should be a way for this command to print out details
814 of any unknown cipher suites a client says it supports.
819 L<openssl-sess_id(1)>,
820 L<openssl-s_client(1)>,
821 L<openssl-ciphers(1)>,
823 L<SSL_CTX_set_max_send_fragment(3)>,
824 L<SSL_CTX_set_split_send_fragment(3)>,
825 L<SSL_CTX_set_max_pipelines(3)>,
826 L<ossl_store-file(7)>
830 The -no_alt_chains option was added in OpenSSL 1.1.0.
833 -allow-no-dhe-kex and -prioritize_chacha options were added in OpenSSL 1.1.1.
837 Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
839 Licensed under the Apache License 2.0 (the "License"). You may not use
840 this file except in compliance with the License. You can obtain a copy
841 in the file LICENSE in the source distribution or at
842 L<https://www.openssl.org/source/license.html>.