s_server.pod 25 KB

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