Merge from vendor branch LIBEVENT:
[dragonfly.git] / secure / usr.bin / openssl / man / s_client.1
1 .\" Automatically generated by Pod::Man 2.12 (Pod::Simple 3.05)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
29 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
30 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
31 .\" nothing in troff, for use with C<>.
32 .tr \(*W-
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "S_CLIENT 1"
127 .TH S_CLIENT 1 "2007-10-24" "0.9.8g" "OpenSSL"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 s_client \- SSL/TLS client program
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBopenssl\fR \fBs_client\fR
137 [\fB\-connect host:port\fR]
138 [\fB\-verify depth\fR]
139 [\fB\-cert filename\fR]
140 [\fB\-certform DER|PEM\fR]
141 [\fB\-key filename\fR]
142 [\fB\-keyform DER|PEM\fR]
143 [\fB\-pass arg\fR]
144 [\fB\-CApath directory\fR]
145 [\fB\-CAfile filename\fR]
146 [\fB\-reconnect\fR]
147 [\fB\-pause\fR]
148 [\fB\-showcerts\fR]
149 [\fB\-debug\fR]
150 [\fB\-msg\fR]
151 [\fB\-nbio_test\fR]
152 [\fB\-state\fR]
153 [\fB\-nbio\fR]
154 [\fB\-crlf\fR]
155 [\fB\-ign_eof\fR]
156 [\fB\-quiet\fR]
157 [\fB\-ssl2\fR]
158 [\fB\-ssl3\fR]
159 [\fB\-tls1\fR]
160 [\fB\-no_ssl2\fR]
161 [\fB\-no_ssl3\fR]
162 [\fB\-no_tls1\fR]
163 [\fB\-bugs\fR]
164 [\fB\-cipher cipherlist\fR]
165 [\fB\-starttls protocol\fR]
166 [\fB\-engine id\fR]
167 [\fB\-tlsextdebug\fR]
168 [\fB\-no_ticket\fR]
169 [\fB\-sess_out filename\fR]
170 [\fB\-sess_in filename\fR]
171 [\fB\-rand file(s)\fR]
172 .SH "DESCRIPTION"
173 .IX Header "DESCRIPTION"
174 The \fBs_client\fR command implements a generic \s-1SSL/TLS\s0 client which connects
175 to a remote host using \s-1SSL/TLS\s0. It is a \fIvery\fR useful diagnostic tool for
176 \&\s-1SSL\s0 servers.
177 .SH "OPTIONS"
178 .IX Header "OPTIONS"
179 .IP "\fB\-connect host:port\fR" 4
180 .IX Item "-connect host:port"
181 This specifies the host and optional port to connect to. If not specified
182 then an attempt is made to connect to the local host on port 4433.
183 .IP "\fB\-cert certname\fR" 4
184 .IX Item "-cert certname"
185 The certificate to use, if one is requested by the server. The default is
186 not to use a certificate.
187 .IP "\fB\-certform format\fR" 4
188 .IX Item "-certform format"
189 The certificate format to use: \s-1DER\s0 or \s-1PEM\s0. \s-1PEM\s0 is the default.
190 .IP "\fB\-key keyfile\fR" 4
191 .IX Item "-key keyfile"
192 The private key to use. If not specified then the certificate file will
193 be used.
194 .IP "\fB\-keyform format\fR" 4
195 .IX Item "-keyform format"
196 The private format to use: \s-1DER\s0 or \s-1PEM\s0. \s-1PEM\s0 is the default.
197 .IP "\fB\-pass arg\fR" 4
198 .IX Item "-pass arg"
199 the private key password source. For more information about the format of \fBarg\fR
200 see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
201 .IP "\fB\-verify depth\fR" 4
202 .IX Item "-verify depth"
203 The verify depth to use. This specifies the maximum length of the
204 server certificate chain and turns on server certificate verification.
205 Currently the verify operation continues after errors so all the problems
206 with a certificate chain can be seen. As a side effect the connection
207 will never fail due to a server certificate verify failure.
208 .IP "\fB\-CApath directory\fR" 4
209 .IX Item "-CApath directory"
210 The directory to use for server certificate verification. This directory
211 must be in \*(L"hash format\*(R", see \fBverify\fR for more information. These are
212 also used when building the client certificate chain.
213 .IP "\fB\-CAfile file\fR" 4
214 .IX Item "-CAfile file"
215 A file containing trusted certificates to use during server authentication
216 and to use when attempting to build the client certificate chain.
217 .IP "\fB\-reconnect\fR" 4
218 .IX Item "-reconnect"
219 reconnects to the same server 5 times using the same session \s-1ID\s0, this can
220 be used as a test that session caching is working.
221 .IP "\fB\-pause\fR" 4
222 .IX Item "-pause"
223 pauses 1 second between each read and write call.
224 .IP "\fB\-showcerts\fR" 4
225 .IX Item "-showcerts"
226 display the whole server certificate chain: normally only the server
227 certificate itself is displayed.
228 .IP "\fB\-prexit\fR" 4
229 .IX Item "-prexit"
230 print session information when the program exits. This will always attempt
231 to print out information even if the connection fails. Normally information
232 will only be printed out once if the connection succeeds. This option is useful
233 because the cipher in use may be renegotiated or the connection may fail
234 because a client certificate is required or is requested only after an
235 attempt is made to access a certain \s-1URL\s0. Note: the output produced by this
236 option is not always accurate because a connection might never have been
237 established.
238 .IP "\fB\-state\fR" 4
239 .IX Item "-state"
240 prints out the \s-1SSL\s0 session states.
241 .IP "\fB\-debug\fR" 4
242 .IX Item "-debug"
243 print extensive debugging information including a hex dump of all traffic.
244 .IP "\fB\-msg\fR" 4
245 .IX Item "-msg"
246 show all protocol messages with hex dump.
247 .IP "\fB\-nbio_test\fR" 4
248 .IX Item "-nbio_test"
249 tests non-blocking I/O
250 .IP "\fB\-nbio\fR" 4
251 .IX Item "-nbio"
252 turns on non-blocking I/O
253 .IP "\fB\-crlf\fR" 4
254 .IX Item "-crlf"
255 this option translated a line feed from the terminal into \s-1CR+LF\s0 as required
256 by some servers.
257 .IP "\fB\-ign_eof\fR" 4
258 .IX Item "-ign_eof"
259 inhibit shutting down the connection when end of file is reached in the
260 input.
261 .IP "\fB\-quiet\fR" 4
262 .IX Item "-quiet"
263 inhibit printing of session and certificate information.  This implicitly
264 turns on \fB\-ign_eof\fR as well.
265 .IP "\fB\-ssl2\fR, \fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ssl3\fR, \fB\-no_tls1\fR" 4
266 .IX Item "-ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1"
267 these options disable the use of certain \s-1SSL\s0 or \s-1TLS\s0 protocols. By default
268 the initial handshake uses a method which should be compatible with all
269 servers and permit them to use \s-1SSL\s0 v3, \s-1SSL\s0 v2 or \s-1TLS\s0 as appropriate.
270 .Sp
271 Unfortunately there are a lot of ancient and broken servers in use which
272 cannot handle this technique and will fail to connect. Some servers only
273 work if \s-1TLS\s0 is turned off with the \fB\-no_tls\fR option others will only
274 support \s-1SSL\s0 v2 and may need the \fB\-ssl2\fR option.
275 .IP "\fB\-bugs\fR" 4
276 .IX Item "-bugs"
277 there are several known bug in \s-1SSL\s0 and \s-1TLS\s0 implementations. Adding this
278 option enables various workarounds.
279 .IP "\fB\-cipher cipherlist\fR" 4
280 .IX Item "-cipher cipherlist"
281 this allows the cipher list sent by the client to be modified. Although
282 the server determines which cipher suite is used it should take the first
283 supported cipher in the list sent by the client. See the \fBciphers\fR
284 command for more information.
285 .IP "\fB\-starttls protocol\fR" 4
286 .IX Item "-starttls protocol"
287 send the protocol-specific message(s) to switch to \s-1TLS\s0 for communication.
288 \&\fBprotocol\fR is a keyword for the intended protocol.  Currently, the only
289 supported keywords are \*(L"smtp\*(R", \*(L"pop3\*(R", \*(L"imap\*(R", and \*(L"ftp\*(R".
290 .IP "\fB\-tlsextdebug\fR" 4
291 .IX Item "-tlsextdebug"
292 print out a hex dump of any \s-1TLS\s0 extensions received from the server. Note: this
293 option is only available if extension support is explicitly enabled at compile
294 time
295 .IP "\fB\-no_ticket\fR" 4
296 .IX Item "-no_ticket"
297 disable RFC4507bis session ticket support. Note: this option is only available
298 if extension support is explicitly enabled at compile time
299 .IP "\fB\-sess_out filename\fR" 4
300 .IX Item "-sess_out filename"
301 output \s-1SSL\s0 session to \fBfilename\fR
302 .IP "\fB\-sess_in sess.pem\fR" 4
303 .IX Item "-sess_in sess.pem"
304 load \s-1SSL\s0 session from \fBfilename\fR. The client will attempt to resume a
305 connection from this session.
306 .IP "\fB\-engine id\fR" 4
307 .IX Item "-engine id"
308 specifying an engine (by it's unique \fBid\fR string) will cause \fBs_client\fR
309 to attempt to obtain a functional reference to the specified engine,
310 thus initialising it if needed. The engine will then be set as the default
311 for all available algorithms.
312 .IP "\fB\-rand file(s)\fR" 4
313 .IX Item "-rand file(s)"
314 a file or files containing random data used to seed the random number
315 generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
316 Multiple files can be specified separated by a OS-dependent character.
317 The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
318 all others.
319 .SH "CONNECTED COMMANDS"
320 .IX Header "CONNECTED COMMANDS"
321 If a connection is established with an \s-1SSL\s0 server then any data received
322 from the server is displayed and any key presses will be sent to the
323 server. When used interactively (which means neither \fB\-quiet\fR nor \fB\-ign_eof\fR
324 have been given), the session will be renegotiated if the line begins with an
325 \&\fBR\fR, and if the line begins with a \fBQ\fR or if end of file is reached, the
326 connection will be closed down.
327 .SH "NOTES"
328 .IX Header "NOTES"
329 \&\fBs_client\fR can be used to debug \s-1SSL\s0 servers. To connect to an \s-1SSL\s0 \s-1HTTP\s0
330 server the command:
331 .PP
332 .Vb 1
333 \& openssl s_client \-connect servername:443
334 .Ve
335 .PP
336 would typically be used (https uses port 443). If the connection succeeds
337 then an \s-1HTTP\s0 command can be given such as \*(L"\s-1GET\s0 /\*(R" to retrieve a web page.
338 .PP
339 If the handshake fails then there are several possible causes, if it is
340 nothing obvious like no client certificate then the \fB\-bugs\fR, \fB\-ssl2\fR,
341 \&\fB\-ssl3\fR, \fB\-tls1\fR, \fB\-no_ssl2\fR, \fB\-no_ssl3\fR, \fB\-no_tls1\fR options can be tried
342 in case it is a buggy server. In particular you should play with these
343 options \fBbefore\fR submitting a bug report to an OpenSSL mailing list.
344 .PP
345 A frequent problem when attempting to get client certificates working
346 is that a web client complains it has no certificates or gives an empty
347 list to choose from. This is normally because the server is not sending
348 the clients certificate authority in its \*(L"acceptable \s-1CA\s0 list\*(R" when it
349 requests a certificate. By using \fBs_client\fR the \s-1CA\s0 list can be viewed
350 and checked. However some servers only request client authentication
351 after a specific \s-1URL\s0 is requested. To obtain the list in this case it
352 is necessary to use the \fB\-prexit\fR option and send an \s-1HTTP\s0 request
353 for an appropriate page.
354 .PP
355 If a certificate is specified on the command line using the \fB\-cert\fR
356 option it will not be used unless the server specifically requests
357 a client certificate. Therefor merely including a client certificate
358 on the command line is no guarantee that the certificate works.
359 .PP
360 If there are problems verifying a server certificate then the
361 \&\fB\-showcerts\fR option can be used to show the whole chain.
362 .PP
363 Since the SSLv23 client hello cannot include compression methods or extensions
364 these will only be supported if its use is disabled, for example by using the
365 \&\fB\-no_sslv2\fR option.
366 .PP
367 \&\s-1TLS\s0 extensions are only supported in OpenSSL 0.9.8 if they are explictly
368 enabled at compile time using for example the \fBenable-tlsext\fR switch.
369 .SH "BUGS"
370 .IX Header "BUGS"
371 Because this program has a lot of options and also because some of
372 the techniques used are rather old, the C source of s_client is rather
373 hard to read and not a model of how things should be done. A typical
374 \&\s-1SSL\s0 client program would be much simpler.
375 .PP
376 The \fB\-verify\fR option should really exit if the server verification
377 fails.
378 .PP
379 The \fB\-prexit\fR option is a bit of a hack. We should really report
380 information whenever a session is renegotiated.
381 .SH "SEE ALSO"
382 .IX Header "SEE ALSO"
383 \&\fIsess_id\fR\|(1), \fIs_server\fR\|(1), \fIciphers\fR\|(1)