1S_SERVER(1) OpenSSL S_SERVER(1)
2
3
4
6 s_server - SSL/TLS server program
7
9 openssl s_server [-accept port] [-context id] [-verify depth] [-Verify
10 depth] [-cert filename] [-certform DER⎪PEM] [-key keyfile] [-keyform
11 DER⎪PEM] [-pass arg] [-dcert filename] [-dcertform DER⎪PEM] [-dkey key‐
12 file] [-dkeyform DER⎪PEM] [-dpass arg] [-dhparam filename] [-nbio]
13 [-nbio_test] [-crlf] [-debug] [-msg] [-state] [-CApath directory]
14 [-CAfile filename] [-nocert] [-cipher cipherlist] [-quiet]
15 [-no_tmp_rsa] [-ssl2] [-ssl3] [-tls1] [-no_ssl2] [-no_ssl3] [-no_tls1]
16 [-no_dhe] [-bugs] [-hack] [-www] [-WWW] [-HTTP] [-engine id] [-id_pre‐
17 fix arg] [-rand file(s)]
18
20 The s_server command implements a generic SSL/TLS server which listens
21 for connections on a given port using SSL/TLS.
22
24 -accept port
25 the TCP port to listen on for connections. If not specified 4433 is
26 used.
27
28 -context id
29 sets the SSL context id. It can be given any string value. If this
30 option is not present a default value will be used.
31
32 -cert certname
33 The certificate to use, most servers cipher suites require the use
34 of a certificate and some require a certificate with a certain pub‐
35 lic key type: for example the DSS cipher suites require a certifi‐
36 cate containing a DSS (DSA) key. If not specified then the filename
37 "server.pem" will be used.
38
39 -certform format
40 The certificate format to use: DER or PEM. PEM is the default.
41
42 -key keyfile
43 The private key to use. If not specified then the certificate file
44 will be used.
45
46 -keyform format
47 The private format to use: DER or PEM. PEM is the default.
48
49 -pass arg
50 the private key password source. For more information about the
51 format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
52
53 -dcert filename, -dkey keyname
54 specify an additional certificate and private key, these behave in
55 the same manner as the -cert and -key options except there is no
56 default if they are not specified (no additional certificate and
57 key is used). As noted above some cipher suites require a certifi‐
58 cate containing a key of a certain type. Some cipher suites need a
59 certificate carrying an RSA key and some a DSS (DSA) key. By using
60 RSA and DSS certificates and keys a server can support clients
61 which only support RSA or DSS cipher suites by using an appropriate
62 certificate.
63
64 -dcertform format, -dkeyform format, -dpass arg
65 addtional certificate and private key format and passphrase respec‐
66 tively.
67
68 -nocert
69 if this option is set then no certificate is used. This restricts
70 the cipher suites available to the anonymous ones (currently just
71 anonymous DH).
72
73 -dhparam filename
74 the DH parameter file to use. The ephemeral DH cipher suites gener‐
75 ate keys using a set of DH parameters. If not specified then an
76 attempt is made to load the parameters from the server certificate
77 file. If this fails then a static set of parameters hard coded into
78 the s_server program will be used.
79
80 -no_dhe
81 if this option is set then no DH parameters will be loaded effec‐
82 tively disabling the ephemeral DH cipher suites.
83
84 -no_tmp_rsa
85 certain export cipher suites sometimes use a temporary RSA key,
86 this option disables temporary RSA key generation.
87
88 -verify depth, -Verify depth
89 The verify depth to use. This specifies the maximum length of the
90 client certificate chain and makes the server request a certificate
91 from the client. With the -verify option a certificate is requested
92 but the client does not have to send one, with the -Verify option
93 the client must supply a certificate or an error occurs.
94
95 -CApath directory
96 The directory to use for client certificate verification. This
97 directory must be in "hash format", see verify for more informa‐
98 tion. These are also used when building the server certificate
99 chain.
100
101 -CAfile file
102 A file containing trusted certificates to use during client authen‐
103 tication and to use when attempting to build the server certificate
104 chain. The list is also used in the list of acceptable client CAs
105 passed to the client when a certificate is requested.
106
107 -state
108 prints out the SSL session states.
109
110 -debug
111 print extensive debugging information including a hex dump of all
112 traffic.
113
114 -msg
115 show all protocol messages with hex dump.
116
117 -nbio_test
118 tests non blocking I/O
119
120 -nbio
121 turns on non blocking I/O
122
123 -crlf
124 this option translated a line feed from the terminal into CR+LF.
125
126 -quiet
127 inhibit printing of session and certificate information.
128
129 -ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1
130 these options disable the use of certain SSL or TLS protocols. By
131 default the initial handshake uses a method which should be compat‐
132 ible with all servers and permit them to use SSL v3, SSL v2 or TLS
133 as appropriate.
134
135 -bugs
136 there are several known bug in SSL and TLS implementations. Adding
137 this option enables various workarounds.
138
139 -hack
140 this option enables a further workaround for some some early Net‐
141 scape SSL code (?).
142
143 -cipher cipherlist
144 this allows the cipher list used by the server to be modified.
145 When the client sends a list of supported ciphers the first client
146 cipher also included in the server list is used. Because the client
147 specifies the preference order, the order of the server cipherlist
148 irrelevant. See the ciphers command for more information.
149
150 -www
151 sends a status message back to the client when it connects. This
152 includes lots of information about the ciphers used and various
153 session parameters. The output is in HTML format so this option
154 will normally be used with a web browser.
155
156 -WWW
157 emulates a simple web server. Pages will be resolved relative to
158 the current directory, for example if the URL
159 https://myhost/page.html is requested the file ./page.html will be
160 loaded.
161
162 -HTTP
163 emulates a simple web server. Pages will be resolved relative to
164 the current directory, for example if the URL
165 https://myhost/page.html is requested the file ./page.html will be
166 loaded. The files loaded are assumed to contain a complete and cor‐
167 rect HTTP response (lines that are part of the HTTP response line
168 and headers must end with CRLF).
169
170 -engine id
171 specifying an engine (by it's unique id string) will cause s_server
172 to attempt to obtain a functional reference to the specified
173 engine, thus initialising it if needed. The engine will then be set
174 as the default for all available algorithms.
175
176 -id_prefix arg
177 generate SSL/TLS session IDs prefixed by arg. This is mostly useful
178 for testing any SSL/TLS code (eg. proxies) that wish to deal with
179 multiple servers, when each of which might be generating a unique
180 range of session IDs (eg. with a certain prefix).
181
182 -rand file(s)
183 a file or files containing random data used to seed the random num‐
184 ber generator, or an EGD socket (see RAND_egd(3)). Multiple files
185 can be specified separated by a OS-dependent character. The sepa‐
186 rator is ; for MS-Windows, , for OpenVMS, and : for all others.
187
189 If a connection request is established with an SSL client and neither
190 the -www nor the -WWW option has been used then normally any data
191 received from the client is displayed and any key presses will be sent
192 to the client.
193
194 Certain single letter commands are also recognized which perform spe‐
195 cial operations: these are listed below.
196
197 q end the current SSL connection but still accept new connections.
198
199 Q end the current SSL connection and exit.
200
201 r renegotiate the SSL session.
202
203 R renegotiate the SSL session and request a client certificate.
204
205 P send some plain text down the underlying TCP connection: this
206 should cause the client to disconnect due to a protocol violation.
207
208 S print out some session cache status information.
209
211 s_server can be used to debug SSL clients. To accept connections from a
212 web browser the command:
213
214 openssl s_server -accept 443 -www
215
216 can be used for example.
217
218 Most web browsers (in particular Netscape and MSIE) only support RSA
219 cipher suites, so they cannot connect to servers which don't use a cer‐
220 tificate carrying an RSA key or a version of OpenSSL with RSA disabled.
221
222 Although specifying an empty list of CAs when requesting a client cer‐
223 tificate is strictly speaking a protocol violation, some SSL clients
224 interpret this to mean any CA is acceptable. This is useful for debug‐
225 ging purposes.
226
227 The session parameters can printed out using the sess_id program.
228
230 Because this program has a lot of options and also because some of the
231 techniques used are rather old, the C source of s_server is rather hard
232 to read and not a model of how things should be done. A typical SSL
233 server program would be much simpler.
234
235 The output of common ciphers is wrong: it just gives the list of
236 ciphers that OpenSSL recognizes and the client supports.
237
238 There should be a way for the s_server program to print out details of
239 any unknown cipher suites a client says it supports.
240
242 sess_id(1), s_client(1), ciphers(1)
243
244
245
2460.9.8b 2004-11-16 S_SERVER(1)