6 s_server - SSL/TLS server program
10 B<openssl> B<s_server>
19 [B<-certform DER|PEM>]
24 [B<-dcertform DER|PEM>]
26 [B<-dkeyform DER|PEM>]
28 [B<-dhparam filename>]
35 [B<-CApath directory>]
38 [B<-cipher cipherlist>]
61 [B<-auth_require_reneg>]
62 [B<-no_resumption_on_reneg>]
65 The B<s_server> command implements a generic SSL/TLS server which listens
66 for connections on a given port using SSL/TLS.
70 In addition to the options below the B<s_server> utility also supports the
71 common and server only options documented in the
72 L<SSL_CONF_cmd(3)|SSL_CONF_cmd(3)/SUPPORTED COMMAND LINE COMMANDS> manual
79 the TCP port to listen on for connections. If not specified 4433 is used.
81 =item B<-naccept count>
83 The server will exit after receiving B<number> connections, default unlimited.
87 sets the SSL context id. It can be given any string value. If this option
88 is not present a default value will be used.
90 =item B<-cert certname>
92 The certificate to use, most servers cipher suites require the use of a
93 certificate and some require a certificate with a certain public key type:
94 for example the DSS cipher suites require a certificate containing a DSS
95 (DSA) key. If not specified then the filename "server.pem" will be used.
97 =item B<-certform format>
99 The certificate format to use: DER or PEM. PEM is the default.
101 =item B<-key keyfile>
103 The private key to use. If not specified then the certificate file will
106 =item B<-keyform format>
108 The private format to use: DER or PEM. PEM is the default.
112 the private key password source. For more information about the format of B<arg>
113 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
115 =item B<-dcert filename>, B<-dkey keyname>
117 specify an additional certificate and private key, these behave in the
118 same manner as the B<-cert> and B<-key> options except there is no default
119 if they are not specified (no additional certificate and key is used). As
120 noted above some cipher suites require a certificate containing a key of
121 a certain type. Some cipher suites need a certificate carrying an RSA key
122 and some a DSS (DSA) key. By using RSA and DSS certificates and keys
123 a server can support clients which only support RSA or DSS cipher suites
124 by using an appropriate certificate.
126 =item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg>
128 addtional certificate and private key format and passphrase respectively.
132 if this option is set then no certificate is used. This restricts the
133 cipher suites available to the anonymous ones (currently just anonymous
136 =item B<-dhparam filename>
138 the DH parameter file to use. The ephemeral DH cipher suites generate keys
139 using a set of DH parameters. If not specified then an attempt is made to
140 load the parameters from the server certificate file. If this fails then
141 a static set of parameters hard coded into the s_server program will be used.
145 if this option is set then no DH parameters will be loaded effectively
146 disabling the ephemeral DH cipher suites.
150 certain export cipher suites sometimes use a temporary RSA key, this option
151 disables temporary RSA key generation.
153 =item B<-verify depth>, B<-Verify depth>
155 The verify depth to use. This specifies the maximum length of the
156 client certificate chain and makes the server request a certificate from
157 the client. With the B<-verify> option a certificate is requested but the
158 client does not have to send one, with the B<-Verify> option the client
159 must supply a certificate or an error occurs.
161 =item B<-crl_check>, B<-crl_check_all>
163 Check the peer certificate has not been revoked by its CA.
164 The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
165 option all CRLs of all CAs in the chain are checked.
167 =item B<-CApath directory>
169 The directory to use for client certificate verification. This directory
170 must be in "hash format", see B<verify> for more information. These are
171 also used when building the server certificate chain.
173 =item B<-CAfile file>
175 A file containing trusted certificates to use during client authentication
176 and to use when attempting to build the server certificate chain. The list
177 is also used in the list of acceptable client CAs passed to the client when
178 a certificate is requested.
182 prints out the SSL session states.
186 print extensive debugging information including a hex dump of all traffic.
190 show all protocol messages with hex dump.
194 show verbose trace output of protocol messages. OpenSSL needs to be compiled
195 with B<enable-ssl-trace> for this option to work.
199 file to send output of B<-msg> or B<-trace> to, default standard output.
203 tests non blocking I/O
207 turns on non blocking I/O
211 this option translated a line feed from the terminal into CR+LF.
215 inhibit printing of session and certificate information.
217 =item B<-psk_hint hint>
219 Use the PSK identity hint B<hint> when using a PSK cipher suite.
223 Use the PSK key B<key> when using a PSK cipher suite. The key is
224 given as a hexadecimal number without leading 0x, for example -psk
227 =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
229 these options disable the use of certain SSL or TLS protocols. By default
230 the initial handshake uses a method which should be compatible with all
231 servers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
235 there are several known bug in SSL and TLS implementations. Adding this
236 option enables various workarounds.
240 only provide a brief summary of connection parameters instead of the
241 normal verbose output.
245 this option enables a further workaround for some some early Netscape
248 =item B<-cipher cipherlist>
250 this allows the cipher list used by the server to be modified. When
251 the client sends a list of supported ciphers the first client cipher
252 also included in the server list is used. Because the client specifies
253 the preference order, the order of the server cipherlist irrelevant. See
254 the B<ciphers> command for more information.
256 =item B<-tlsextdebug>
258 print out a hex dump of any TLS extensions received from the server.
262 disable RFC4507bis session ticket support.
266 sends a status message back to the client when it connects. This includes
267 lots of information about the ciphers used and various session parameters.
268 The output is in HTML format so this option will normally be used with a
273 emulates a simple web server. Pages will be resolved relative to the
274 current directory, for example if the URL https://myhost/page.html is
275 requested the file ./page.html will be loaded.
279 emulates a simple web server. Pages will be resolved relative to the
280 current directory, for example if the URL https://myhost/page.html is
281 requested the file ./page.html will be loaded. The files loaded are
282 assumed to contain a complete and correct HTTP response (lines that
283 are part of the HTTP response line and headers must end with CRLF).
287 simple test server which just reverses the text received from the client
288 and sends it back to the server. Also sets B<-brief>.
292 specifying an engine (by its unique B<id> string) will cause B<s_server>
293 to attempt to obtain a functional reference to the specified engine,
294 thus initialising it if needed. The engine will then be set as the default
295 for all available algorithms.
297 =item B<-id_prefix arg>
299 generate SSL/TLS session IDs prefixed by B<arg>. This is mostly useful
300 for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
301 servers, when each of which might be generating a unique range of session
302 IDs (eg. with a certain prefix).
304 =item B<-rand file(s)>
306 a file or files containing random data used to seed the random number
307 generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
308 Multiple files can be specified separated by a OS-dependent character.
309 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
312 =item B<-serverinfo file>
314 a file containing one or more blocks of PEM data. Each PEM block
315 must encode a TLS ServerHello extension (2 bytes type, 2 bytes length,
316 followed by "length" bytes of extension data). If the client sends
317 an empty TLS ClientHello extension matching the type, the corresponding
318 ServerHello extension will be returned.
322 send RFC 5878 client and server authorization extensions in the Client Hello as well as
323 supplemental data if the server also sent the authorization extensions in the Server Hello.
325 =item B<-auth_require_reneg>
327 only send RFC 5878 client and server authorization extensions during renegotiation.
329 =item B<-no_resumption_on_reneg>
331 set SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION flag. Required in order to receive supplemental data
332 during renegotiation if auth and auth_require_reneg are set.
336 =head1 CONNECTED COMMANDS
338 If a connection request is established with an SSL client and neither the
339 B<-www> nor the B<-WWW> option has been used then normally any data received
340 from the client is displayed and any key presses will be sent to the client.
342 Certain single letter commands are also recognized which perform special
343 operations: these are listed below.
349 end the current SSL connection but still accept new connections.
353 end the current SSL connection and exit.
357 renegotiate the SSL session.
361 renegotiate the SSL session and request a client certificate.
365 send some plain text down the underlying TCP connection: this should
366 cause the client to disconnect due to a protocol violation.
370 print out some session cache status information.
376 B<s_server> can be used to debug SSL clients. To accept connections from
377 a web browser the command:
379 openssl s_server -accept 443 -www
381 can be used for example.
383 Most web browsers (in particular Netscape and MSIE) only support RSA cipher
384 suites, so they cannot connect to servers which don't use a certificate
385 carrying an RSA key or a version of OpenSSL with RSA disabled.
387 Although specifying an empty list of CAs when requesting a client certificate
388 is strictly speaking a protocol violation, some SSL clients interpret this to
389 mean any CA is acceptable. This is useful for debugging purposes.
391 The session parameters can printed out using the B<sess_id> program.
395 Because this program has a lot of options and also because some of
396 the techniques used are rather old, the C source of s_server is rather
397 hard to read and not a model of how things should be done. A typical
398 SSL server program would be much simpler.
400 The output of common ciphers is wrong: it just gives the list of ciphers that
401 OpenSSL recognizes and the client supports.
403 There should be a way for the B<s_server> program to print out details of any
404 unknown cipher suites a client says it supports.
408 L<sess_id(1)|sess_id(1)>, L<s_client(1)|s_client(1)>, L<ciphers(1)|ciphers(1)>