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