add references to verify(1) man page for args_verify() options
[openssl.git] / doc / apps / s_server.pod
1
2 =pod
3
4 =head1 NAME
5
6 s_server - SSL/TLS server program
7
8 =head1 SYNOPSIS
9
10 B<openssl> B<s_server>
11 [B<-accept port>]
12 [B<-naccept count>]
13 [B<-context id>]
14 [B<-verify depth>]
15 [B<-Verify depth>]
16 [B<-crl_check>]
17 [B<-crl_check_all>]
18 [B<-cert filename>]
19 [B<-certform DER|PEM>]
20 [B<-key keyfile>]
21 [B<-keyform DER|PEM>]
22 [B<-pass arg>]
23 [B<-dcert filename>]
24 [B<-dcertform DER|PEM>]
25 [B<-dkey keyfile>]
26 [B<-dkeyform DER|PEM>]
27 [B<-dpass arg>]
28 [B<-dhparam filename>]
29 [B<-nbio>]
30 [B<-nbio_test>]
31 [B<-crlf>]
32 [B<-debug>]
33 [B<-msg>]
34 [B<-state>]
35 [B<-CApath directory>]
36 [B<-CAfile filename>]
37 [B<-attime timestamp>]
38 [B<-check_ss_sig>]
39 [B<-explicit_policy>]
40 [B<-extended_crl>]
41 [B<-ignore_critical>]
42 [B<-inhibit_any>]
43 [B<-inhibit_map>]
44 [B<-issuer_checks>]
45 [B<-partial_chain>]
46 [B<-policy arg>]
47 [B<-policy_check>]
48 [B<-policy_print>]
49 [B<-purpose purpose>]
50 [B<-suiteB_128>]
51 [B<-suiteB_128_only>]
52 [B<-suiteB_192>]
53 [B<-trusted_first>]
54 [B<-use_deltas>]
55 [B<-verify_depth num>]
56 [B<-verify_email email>]
57 [B<-verify_hostname hostname>]
58 [B<-verify_ip ip>]
59 [B<-verify_name name>]
60 [B<-x509_strict>]
61 [B<-nocert>]
62 [B<-cipher cipherlist>]
63 [B<-quiet>]
64 [B<-no_tmp_rsa>]
65 [B<-ssl2>]
66 [B<-ssl3>]
67 [B<-tls1>]
68 [B<-no_ssl2>]
69 [B<-no_ssl3>]
70 [B<-no_tls1>]
71 [B<-no_dhe>]
72 [B<-no_ecdhe>]
73 [B<-bugs>]
74 [B<-brief>]
75 [B<-hack>]
76 [B<-www>]
77 [B<-WWW>]
78 [B<-HTTP>]
79 [B<-engine id>]
80 [B<-tlsextdebug>]
81 [B<-no_ticket>]
82 [B<-id_prefix arg>]
83 [B<-rand file(s)>]
84 [B<-serverinfo file>]
85 [B<-auth>]
86 [B<-auth_require_reneg>]
87 [B<-no_resumption_on_reneg>]
88 =head1 DESCRIPTION
89
90 The B<s_server> command implements a generic SSL/TLS server which listens
91 for connections on a given port using SSL/TLS.
92
93 =head1 OPTIONS
94
95 In addition to the options below the B<s_server> utility also supports the
96 common and server only options documented in the
97 L<SSL_CONF_cmd(3)|SSL_CONF_cmd(3)/SUPPORTED COMMAND LINE COMMANDS> manual
98 page.
99
100 =over 4
101
102 =item B<-accept port>
103
104 the TCP port to listen on for connections. If not specified 4433 is used.
105
106 =item B<-naccept count>
107
108 The server will exit after receiving B<number> connections, default unlimited. 
109
110 =item B<-context id>
111
112 sets the SSL context id. It can be given any string value. If this option
113 is not present a default value will be used.
114
115 =item B<-cert certname>
116
117 The certificate to use, most servers cipher suites require the use of a
118 certificate and some require a certificate with a certain public key type:
119 for example the DSS cipher suites require a certificate containing a DSS
120 (DSA) key. If not specified then the filename "server.pem" will be used.
121
122 =item B<-certform format>
123
124 The certificate format to use: DER or PEM. PEM is the default.
125
126 =item B<-key keyfile>
127
128 The private key to use. If not specified then the certificate file will
129 be used.
130
131 =item B<-keyform format>
132
133 The private format to use: DER or PEM. PEM is the default.
134
135 =item B<-pass arg>
136
137 the private key password source. For more information about the format of B<arg>
138 see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
139
140 =item B<-dcert filename>, B<-dkey keyname>
141
142 specify an additional certificate and private key, these behave in the
143 same manner as the B<-cert> and B<-key> options except there is no default
144 if they are not specified (no additional certificate and key is used). As
145 noted above some cipher suites require a certificate containing a key of
146 a certain type. Some cipher suites need a certificate carrying an RSA key
147 and some a DSS (DSA) key. By using RSA and DSS certificates and keys
148 a server can support clients which only support RSA or DSS cipher suites
149 by using an appropriate certificate.
150
151 =item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg>
152
153 additional certificate and private key format and passphrase respectively.
154
155 =item B<-nocert>
156
157 if this option is set then no certificate is used. This restricts the
158 cipher suites available to the anonymous ones (currently just anonymous
159 DH).
160
161 =item B<-dhparam filename>
162
163 the DH parameter file to use. The ephemeral DH cipher suites generate keys
164 using a set of DH parameters. If not specified then an attempt is made to
165 load the parameters from the server certificate file. If this fails then
166 a static set of parameters hard coded into the s_server program will be used.
167
168 =item B<-no_dhe>
169
170 if this option is set then no DH parameters will be loaded effectively
171 disabling the ephemeral DH cipher suites.
172
173 =item B<-no_ecdhe>
174
175 if this option is set then no ECDH parameters will be loaded effectively
176 disabling the ephemeral ECDH cipher suites.
177
178 =item B<-no_tmp_rsa>
179
180 certain export cipher suites sometimes use a temporary RSA key, this option
181 disables temporary RSA key generation.
182
183 =item B<-verify depth>, B<-Verify depth>
184
185 The verify depth to use. This specifies the maximum length of the
186 client certificate chain and makes the server request a certificate from
187 the client. With the B<-verify> option a certificate is requested but the
188 client does not have to send one, with the B<-Verify> option the client
189 must supply a certificate or an error occurs.
190
191 =item B<-crl_check>, B<-crl_check_all>
192
193 Check the peer certificate has not been revoked by its CA.
194 The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
195 option all CRLs of all CAs in the chain are checked.
196
197 =item B<-CApath directory>
198
199 The directory to use for client certificate verification. This directory
200 must be in "hash format", see B<verify> for more information. These are
201 also used when building the server certificate chain.
202
203 =item B<-CAfile file>
204
205 A file containing trusted certificates to use during client authentication
206 and to use when attempting to build the server certificate chain. The list
207 is also used in the list of acceptable client CAs passed to the client when
208 a certificate is requested.
209
210 =item B<-attime>, B<-check_ss_sig>, B<explicit_policy>, B<-extended_crl>,
211 B<-ignore_critical>, B<-inhibit_any>, B<-inhibit_map>, B<-issuer_checks>,
212 B<-partial_chain>, B<-policy>, B<-policy_check>, B<-policy_print>, B<-purpose>,
213 B<-suiteB_128>, B<-suiteB_128_only>, B<-suiteB_192>, B<-trusted_first>,
214 B<-use_deltas>, B<-verify_depth>, B<-verify_email>, B<-verify_hostname>,
215 B<-verify_ip>, B<-verify_name>, B<-x509_strict>
216
217 Set different peer certificate verification options.
218 See the L<B<verify>|verify(1)> manual page for details.
219
220 =item B<-state>
221
222 prints out the SSL session states.
223
224 =item B<-debug>
225
226 print extensive debugging information including a hex dump of all traffic.
227
228 =item B<-msg>
229
230 show all protocol messages with hex dump.
231
232 =item B<-trace>
233
234 show verbose trace output of protocol messages. OpenSSL needs to be compiled
235 with B<enable-ssl-trace> for this option to work.
236
237 =item B<-msgfile>
238
239 file to send output of B<-msg> or B<-trace> to, default standard output.
240
241 =item B<-nbio_test>
242
243 tests non blocking I/O
244
245 =item B<-nbio>
246
247 turns on non blocking I/O
248
249 =item B<-crlf>
250
251 this option translated a line feed from the terminal into CR+LF.
252
253 =item B<-quiet>
254
255 inhibit printing of session and certificate information.
256
257 =item B<-psk_hint hint>
258
259 Use the PSK identity hint B<hint> when using a PSK cipher suite.
260
261 =item B<-psk key>
262
263 Use the PSK key B<key> when using a PSK cipher suite. The key is
264 given as a hexadecimal number without leading 0x, for example -psk
265 1a2b3c4d.
266
267 =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
268
269 these options disable the use of certain SSL or TLS protocols. By default
270 the initial handshake uses a method which should be compatible with all
271 servers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
272
273 =item B<-bugs>
274
275 there are several known bug in SSL and TLS implementations. Adding this
276 option enables various workarounds.
277
278 =item B<-brief>
279
280 only provide a brief summary of connection parameters instead of the
281 normal verbose output.
282
283 =item B<-hack>
284
285 this option enables a further workaround for some some early Netscape
286 SSL code (?).
287
288 =item B<-cipher cipherlist>
289
290 this allows the cipher list used by the server to be modified.  When
291 the client sends a list of supported ciphers the first client cipher
292 also included in the server list is used. Because the client specifies
293 the preference order, the order of the server cipherlist irrelevant. See
294 the B<ciphers> command for more information.
295
296 =item B<-tlsextdebug>
297
298 print out a hex dump of any TLS extensions received from the server.
299
300 =item B<-no_ticket>
301
302 disable RFC4507bis session ticket support. 
303
304 =item B<-www>
305
306 sends a status message back to the client when it connects. This includes
307 lots of information about the ciphers used and various session parameters.
308 The output is in HTML format so this option will normally be used with a
309 web browser.
310
311 =item B<-WWW>
312
313 emulates a simple web server. Pages will be resolved relative to the
314 current directory, for example if the URL https://myhost/page.html is
315 requested the file ./page.html will be loaded.
316
317 =item B<-HTTP>
318
319 emulates a simple web server. Pages will be resolved relative to the
320 current directory, for example if the URL https://myhost/page.html is
321 requested the file ./page.html will be loaded. The files loaded are
322 assumed to contain a complete and correct HTTP response (lines that
323 are part of the HTTP response line and headers must end with CRLF).
324
325 =item B<-rev>
326
327 simple test server which just reverses the text received from the client
328 and sends it back to the server. Also sets B<-brief>.
329
330 =item B<-engine id>
331
332 specifying an engine (by its unique B<id> string) will cause B<s_server>
333 to attempt to obtain a functional reference to the specified engine,
334 thus initialising it if needed. The engine will then be set as the default
335 for all available algorithms.
336
337 =item B<-id_prefix arg>
338
339 generate SSL/TLS session IDs prefixed by B<arg>. This is mostly useful
340 for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
341 servers, when each of which might be generating a unique range of session
342 IDs (eg. with a certain prefix).
343
344 =item B<-rand file(s)>
345
346 a file or files containing random data used to seed the random number
347 generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
348 Multiple files can be specified separated by a OS-dependent character.
349 The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
350 all others.
351
352 =item B<-serverinfo file>
353
354 a file containing one or more blocks of PEM data.  Each PEM block
355 must encode a TLS ServerHello extension (2 bytes type, 2 bytes length,
356 followed by "length" bytes of extension data).  If the client sends
357 an empty TLS ClientHello extension matching the type, the corresponding
358 ServerHello extension will be returned.
359
360 =item B<-auth>
361
362 send RFC 5878 client and server authorization extensions in the Client Hello as well as
363 supplemental data if the server also sent the authorization extensions in the Server Hello.
364
365 =item B<-auth_require_reneg>
366
367 only send RFC 5878 client and server authorization extensions during renegotiation.
368
369 =item B<-no_resumption_on_reneg>
370
371 set SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION flag.  Required in order to receive supplemental data
372 during renegotiation if auth and auth_require_reneg are set.
373
374 =back
375
376 =head1 CONNECTED COMMANDS
377
378 If a connection request is established with an SSL client and neither the
379 B<-www> nor the B<-WWW> option has been used then normally any data received
380 from the client is displayed and any key presses will be sent to the client. 
381
382 Certain single letter commands are also recognized which perform special
383 operations: these are listed below.
384
385 =over 4
386
387 =item B<q>
388
389 end the current SSL connection but still accept new connections.
390
391 =item B<Q>
392
393 end the current SSL connection and exit.
394
395 =item B<r>
396
397 renegotiate the SSL session.
398
399 =item B<R>
400
401 renegotiate the SSL session and request a client certificate.
402
403 =item B<P>
404
405 send some plain text down the underlying TCP connection: this should
406 cause the client to disconnect due to a protocol violation.
407
408 =item B<S>
409
410 print out some session cache status information.
411
412 =back
413
414 =head1 NOTES
415
416 B<s_server> can be used to debug SSL clients. To accept connections from
417 a web browser the command:
418
419  openssl s_server -accept 443 -www
420
421 can be used for example.
422
423 Most web browsers (in particular Netscape and MSIE) only support RSA cipher
424 suites, so they cannot connect to servers which don't use a certificate
425 carrying an RSA key or a version of OpenSSL with RSA disabled.
426
427 Although specifying an empty list of CAs when requesting a client certificate
428 is strictly speaking a protocol violation, some SSL clients interpret this to
429 mean any CA is acceptable. This is useful for debugging purposes.
430
431 The session parameters can printed out using the B<sess_id> program.
432
433 =head1 BUGS
434
435 Because this program has a lot of options and also because some of
436 the techniques used are rather old, the C source of s_server is rather
437 hard to read and not a model of how things should be done. A typical
438 SSL server program would be much simpler.
439
440 The output of common ciphers is wrong: it just gives the list of ciphers that
441 OpenSSL recognizes and the client supports.
442
443 There should be a way for the B<s_server> program to print out details of any
444 unknown cipher suites a client says it supports.
445
446 =head1 SEE ALSO
447
448 L<sess_id(1)|sess_id(1)>, L<s_client(1)|s_client(1)>, L<ciphers(1)|ciphers(1)>
449
450 =cut