The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / openssl / openssl / doc / apps / s_server.pod @ aa3b4b4d

History | View | Annotate | Download (11.2 KB)

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<-context id>]
13
[B<-verify depth>]
14
[B<-Verify depth>]
15
[B<-crl_check>]
16
[B<-crl_check_all>]
17
[B<-cert filename>]
18
[B<-certform DER|PEM>]
19
[B<-key keyfile>]
20
[B<-keyform DER|PEM>]
21
[B<-pass arg>]
22
[B<-dcert filename>]
23
[B<-dcertform DER|PEM>]
24
[B<-dkey keyfile>]
25
[B<-dkeyform DER|PEM>]
26
[B<-dpass arg>]
27
[B<-dhparam filename>]
28
[B<-nbio>]
29
[B<-nbio_test>]
30
[B<-crlf>]
31
[B<-debug>]
32
[B<-msg>]
33
[B<-state>]
34
[B<-CApath directory>]
35
[B<-CAfile filename>]
36
[B<-nocert>]
37
[B<-cipher cipherlist>]
38
[B<-serverpref>]
39
[B<-quiet>]
40
[B<-no_tmp_rsa>]
41
[B<-ssl2>]
42
[B<-ssl3>]
43
[B<-tls1>]
44
[B<-no_ssl2>]
45
[B<-no_ssl3>]
46
[B<-no_tls1>]
47
[B<-no_dhe>]
48
[B<-no_ecdhe>]
49
[B<-bugs>]
50
[B<-hack>]
51
[B<-www>]
52
[B<-WWW>]
53
[B<-HTTP>]
54
[B<-engine id>]
55
[B<-tlsextdebug>]
56
[B<-no_ticket>]
57
[B<-id_prefix arg>]
58
[B<-rand file(s)>]
59
[B<-status>]
60
[B<-status_verbose>]
61
[B<-status_timeout nsec>]
62
[B<-status_url url>]
63
[B<-nextprotoneg protocols>]
64

    
65
=head1 DESCRIPTION
66

    
67
The B<s_server> command implements a generic SSL/TLS server which listens
68
for connections on a given port using SSL/TLS.
69

    
70
=head1 OPTIONS
71

    
72
=over 4
73

    
74
=item B<-accept port>
75

    
76
the TCP port to listen on for connections. If not specified 4433 is used.
77

    
78
=item B<-context id>
79

    
80
sets the SSL context id. It can be given any string value. If this option
81
is not present a default value will be used.
82

    
83
=item B<-cert certname>
84

    
85
The certificate to use, most servers cipher suites require the use of a
86
certificate and some require a certificate with a certain public key type:
87
for example the DSS cipher suites require a certificate containing a DSS
88
(DSA) key. If not specified then the filename "server.pem" will be used.
89

    
90
=item B<-certform format>
91

    
92
The certificate format to use: DER or PEM. PEM is the default.
93

    
94
=item B<-key keyfile>
95

    
96
The private key to use. If not specified then the certificate file will
97
be used.
98

    
99
=item B<-keyform format>
100

    
101
The private format to use: DER or PEM. PEM is the default.
102

    
103
=item B<-pass arg>
104

    
105
the private key password source. For more information about the format of B<arg>
106
see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
107

    
108
=item B<-dcert filename>, B<-dkey keyname>
109

    
110
specify an additional certificate and private key, these behave in the
111
same manner as the B<-cert> and B<-key> options except there is no default
112
if they are not specified (no additional certificate and key is used). As
113
noted above some cipher suites require a certificate containing a key of
114
a certain type. Some cipher suites need a certificate carrying an RSA key
115
and some a DSS (DSA) key. By using RSA and DSS certificates and keys
116
a server can support clients which only support RSA or DSS cipher suites
117
by using an appropriate certificate.
118

    
119
=item B<-dcertform format>, B<-dkeyform format>, B<-dpass arg>
120

    
121
additional certificate and private key format and passphrase respectively.
122

    
123
=item B<-nocert>
124

    
125
if this option is set then no certificate is used. This restricts the
126
cipher suites available to the anonymous ones (currently just anonymous
127
DH).
128

    
129
=item B<-dhparam filename>
130

    
131
the DH parameter file to use. The ephemeral DH cipher suites generate keys
132
using a set of DH parameters. If not specified then an attempt is made to
133
load the parameters from the server certificate file. If this fails then
134
a static set of parameters hard coded into the s_server program will be used.
135

    
136
=item B<-no_dhe>
137

    
138
if this option is set then no DH parameters will be loaded effectively
139
disabling the ephemeral DH cipher suites.
140

    
141
=item B<-no_ecdhe>
142

    
143
if this option is set then no ECDH parameters will be loaded effectively
144
disabling the ephemeral ECDH cipher suites.
145

    
146
=item B<-no_tmp_rsa>
147

    
148
certain export cipher suites sometimes use a temporary RSA key, this option
149
disables temporary RSA key generation.
150

    
151
=item B<-verify depth>, B<-Verify depth>
152

    
153
The verify depth to use. This specifies the maximum length of the
154
client certificate chain and makes the server request a certificate from
155
the client. With the B<-verify> option a certificate is requested but the
156
client does not have to send one, with the B<-Verify> option the client
157
must supply a certificate or an error occurs.
158

    
159
If the ciphersuite cannot request a client certificate (for example an
160
anonymous ciphersuite or PSK) this option has no effect.
161

    
162
=item B<-crl_check>, B<-crl_check_all>
163

    
164
Check the peer certificate has not been revoked by its CA.
165
The CRL(s) are appended to the certificate file. With the B<-crl_check_all>
166
option all CRLs of all CAs in the chain are checked.
167

    
168
=item B<-CApath directory>
169

    
170
The directory to use for client certificate verification. This directory
171
must be in "hash format", see B<verify> for more information. These are
172
also used when building the server certificate chain.
173

    
174
=item B<-CAfile file>
175

    
176
A file containing trusted certificates to use during client authentication
177
and to use when attempting to build the server certificate chain. The list
178
is also used in the list of acceptable client CAs passed to the client when
179
a certificate is requested.
180

    
181
=item B<-state>
182

    
183
prints out the SSL session states.
184

    
185
=item B<-debug>
186

    
187
print extensive debugging information including a hex dump of all traffic.
188

    
189
=item B<-msg>
190

    
191
show all protocol messages with hex dump.
192

    
193
=item B<-nbio_test>
194

    
195
tests non blocking I/O
196

    
197
=item B<-nbio>
198

    
199
turns on non blocking I/O
200

    
201
=item B<-crlf>
202

    
203
this option translated a line feed from the terminal into CR+LF.
204

    
205
=item B<-quiet>
206

    
207
inhibit printing of session and certificate information.
208

    
209
=item B<-psk_hint hint>
210

    
211
Use the PSK identity hint B<hint> when using a PSK cipher suite.
212

    
213
=item B<-psk key>
214

    
215
Use the PSK key B<key> when using a PSK cipher suite. The key is
216
given as a hexadecimal number without leading 0x, for example -psk
217
1a2b3c4d.
218

    
219
=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
220

    
221
these options disable the use of certain SSL or TLS protocols. By default
222
the initial handshake uses a method which should be compatible with all
223
servers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
224

    
225
=item B<-bugs>
226

    
227
there are several known bug in SSL and TLS implementations. Adding this
228
option enables various workarounds.
229

    
230
=item B<-hack>
231

    
232
this option enables a further workaround for some some early Netscape
233
SSL code (?).
234

    
235
=item B<-cipher cipherlist>
236

    
237
this allows the cipher list used by the server to be modified.  When
238
the client sends a list of supported ciphers the first client cipher
239
also included in the server list is used. Because the client specifies
240
the preference order, the order of the server cipherlist irrelevant. See
241
the B<ciphers> command for more information.
242

    
243
=item B<-serverpref>
244

    
245
use the server's cipher preferences, rather than the client's preferences.
246

    
247
=item B<-tlsextdebug>
248

    
249
print out a hex dump of any TLS extensions received from the server.
250

    
251
=item B<-no_ticket>
252

    
253
disable RFC4507bis session ticket support. 
254

    
255
=item B<-www>
256

    
257
sends a status message back to the client when it connects. This includes
258
lots of information about the ciphers used and various session parameters.
259
The output is in HTML format so this option will normally be used with a
260
web browser.
261

    
262
=item B<-WWW>
263

    
264
emulates a simple web server. Pages will be resolved relative to the
265
current directory, for example if the URL https://myhost/page.html is
266
requested the file ./page.html will be loaded.
267

    
268
=item B<-HTTP>
269

    
270
emulates a simple web server. Pages will be resolved relative to the
271
current directory, for example if the URL https://myhost/page.html is
272
requested the file ./page.html will be loaded. The files loaded are
273
assumed to contain a complete and correct HTTP response (lines that
274
are part of the HTTP response line and headers must end with CRLF).
275

    
276
=item B<-engine id>
277

    
278
specifying an engine (by its unique B<id> string) will cause B<s_server>
279
to attempt to obtain a functional reference to the specified engine,
280
thus initialising it if needed. The engine will then be set as the default
281
for all available algorithms.
282

    
283
=item B<-id_prefix arg>
284

    
285
generate SSL/TLS session IDs prefixed by B<arg>. This is mostly useful
286
for testing any SSL/TLS code (eg. proxies) that wish to deal with multiple
287
servers, when each of which might be generating a unique range of session
288
IDs (eg. with a certain prefix).
289

    
290
=item B<-rand file(s)>
291

    
292
a file or files containing random data used to seed the random number
293
generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
294
Multiple files can be specified separated by a OS-dependent character.
295
The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
296
all others.
297

    
298
=item B<-status>
299

    
300
enables certificate status request support (aka OCSP stapling).
301

    
302
=item B<-status_verbose>
303

    
304
enables certificate status request support (aka OCSP stapling) and gives
305
a verbose printout of the OCSP response.
306

    
307
=item B<-status_timeout nsec>
308

    
309
sets the timeout for OCSP response to B<nsec> seconds.
310

    
311
=item B<-status_url url>
312

    
313
sets a fallback responder URL to use if no responder URL is present in the
314
server certificate. Without this option an error is returned if the server
315
certificate does not contain a responder address.
316

    
317
=item B<-nextprotoneg protocols>
318

    
319
enable Next Protocol Negotiation TLS extension and provide a
320
comma-separated list of supported protocol names.
321
The list should contain most wanted protocols first.
322
Protocol names are printable ASCII strings, for example "http/1.1" or
323
"spdy/3".
324

    
325
=back
326

    
327
=head1 CONNECTED COMMANDS
328

    
329
If a connection request is established with an SSL client and neither the
330
B<-www> nor the B<-WWW> option has been used then normally any data received
331
from the client is displayed and any key presses will be sent to the client. 
332

    
333
Certain single letter commands are also recognized which perform special
334
operations: these are listed below.
335

    
336
=over 4
337

    
338
=item B<q>
339

    
340
end the current SSL connection but still accept new connections.
341

    
342
=item B<Q>
343

    
344
end the current SSL connection and exit.
345

    
346
=item B<r>
347

    
348
renegotiate the SSL session.
349

    
350
=item B<R>
351

    
352
renegotiate the SSL session and request a client certificate.
353

    
354
=item B<P>
355

    
356
send some plain text down the underlying TCP connection: this should
357
cause the client to disconnect due to a protocol violation.
358

    
359
=item B<S>
360

    
361
print out some session cache status information.
362

    
363
=back
364

    
365
=head1 NOTES
366

    
367
B<s_server> can be used to debug SSL clients. To accept connections from
368
a web browser the command:
369

    
370
 openssl s_server -accept 443 -www
371

    
372
can be used for example.
373

    
374
Most web browsers (in particular Netscape and MSIE) only support RSA cipher
375
suites, so they cannot connect to servers which don't use a certificate
376
carrying an RSA key or a version of OpenSSL with RSA disabled.
377

    
378
Although specifying an empty list of CAs when requesting a client certificate
379
is strictly speaking a protocol violation, some SSL clients interpret this to
380
mean any CA is acceptable. This is useful for debugging purposes.
381

    
382
The session parameters can printed out using the B<sess_id> program.
383

    
384
=head1 BUGS
385

    
386
Because this program has a lot of options and also because some of
387
the techniques used are rather old, the C source of s_server is rather
388
hard to read and not a model of how things should be done. A typical
389
SSL server program would be much simpler.
390

    
391
The output of common ciphers is wrong: it just gives the list of ciphers that
392
OpenSSL recognizes and the client supports.
393

    
394
There should be a way for the B<s_server> program to print out details of any
395
unknown cipher suites a client says it supports.
396

    
397
=head1 SEE ALSO
398

    
399
L<sess_id(1)|sess_id(1)>, L<s_client(1)|s_client(1)>, L<ciphers(1)|ciphers(1)>
400

    
401
=cut