s_server.pod 25 KB

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