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