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