1S_CLIENT(1)                         OpenSSL                        S_CLIENT(1)
2
3
4

NAME

6       s_client - SSL/TLS client program
7

SYNOPSIS

9       openssl s_client [-connect host:port] [-verify depth] [-cert filename]
10       [-certform DER⎪PEM] [-key filename] [-keyform DER⎪PEM] [-pass arg]
11       [-CApath directory] [-CAfile filename] [-reconnect] [-pause]
12       [-showcerts] [-debug] [-msg] [-nbio_test] [-state] [-nbio] [-crlf]
13       [-ign_eof] [-quiet] [-ssl2] [-ssl3] [-tls1] [-no_ssl2] [-no_ssl3]
14       [-no_tls1] [-bugs] [-cipher cipherlist] [-starttls protocol] [-engine
15       id] [-rand file(s)]
16

DESCRIPTION

18       The s_client command implements a generic SSL/TLS client which connects
19       to a remote host using SSL/TLS. It is a very useful diagnostic tool for
20       SSL servers.
21

OPTIONS

23       -connect host:port
24           This specifies the host and optional port to connect to. If not
25           specified then an attempt is made to connect to the local host on
26           port 4433.
27
28       -cert certname
29           The certificate to use, if one is requested by the server. The
30           default is not to use a certificate.
31
32       -certform format
33           The certificate format to use: DER or PEM. PEM is the default.
34
35       -key keyfile
36           The private key to use. If not specified then the certificate file
37           will be used.
38
39       -keyform format
40           The private format to use: DER or PEM. PEM is the default.
41
42       -pass arg
43           the private key password source. For more information about the
44           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
45
46       -verify depth
47           The verify depth to use. This specifies the maximum length of the
48           server certificate chain and turns on server certificate verifica‐
49           tion.  Currently the verify operation continues after errors so all
50           the problems with a certificate chain can be seen. As a side effect
51           the connection will never fail due to a server certificate verify
52           failure.
53
54       -CApath directory
55           The directory to use for server certificate verification. This
56           directory must be in "hash format", see verify for more informa‐
57           tion. These are also used when building the client certificate
58           chain.
59
60       -CAfile file
61           A file containing trusted certificates to use during server authen‐
62           tication and to use when attempting to build the client certificate
63           chain.
64
65       -reconnect
66           reconnects to the same server 5 times using the same session ID,
67           this can be used as a test that session caching is working.
68
69       -pause
70           pauses 1 second between each read and write call.
71
72       -showcerts
73           display the whole server certificate chain: normally only the
74           server certificate itself is displayed.
75
76       -prexit
77           print session information when the program exits. This will always
78           attempt to print out information even if the connection fails. Nor‐
79           mally information will only be printed out once if the connection
80           succeeds. This option is useful because the cipher in use may be
81           renegotiated or the connection may fail because a client certifi‐
82           cate is required or is requested only after an attempt is made to
83           access a certain URL. Note: the output produced by this option is
84           not always accurate because a connection might never have been
85           established.
86
87       -state
88           prints out the SSL session states.
89
90       -debug
91           print extensive debugging information including a hex dump of all
92           traffic.
93
94       -msg
95           show all protocol messages with hex dump.
96
97       -nbio_test
98           tests non-blocking I/O
99
100       -nbio
101           turns on non-blocking I/O
102
103       -crlf
104           this option translated a line feed from the terminal into CR+LF as
105           required by some servers.
106
107       -ign_eof
108           inhibit shutting down the connection when end of file is reached in
109           the input.
110
111       -quiet
112           inhibit printing of session and certificate information.  This
113           implicitly turns on -ign_eof as well.
114
115       -ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1
116           these options disable the use of certain SSL or TLS protocols. By
117           default the initial handshake uses a method which should be compat‐
118           ible with all servers and permit them to use SSL v3, SSL v2 or TLS
119           as appropriate.
120
121           Unfortunately there are a lot of ancient and broken servers in use
122           which cannot handle this technique and will fail to connect. Some
123           servers only work if TLS is turned off with the -no_tls option oth‐
124           ers will only support SSL v2 and may need the -ssl2 option.
125
126       -bugs
127           there are several known bug in SSL and TLS implementations. Adding
128           this option enables various workarounds.
129
130       -cipher cipherlist
131           this allows the cipher list sent by the client to be modified.
132           Although the server determines which cipher suite is used it should
133           take the first supported cipher in the list sent by the client. See
134           the ciphers command for more information.
135
136       -starttls protocol
137           send the protocol-specific message(s) to switch to TLS for communi‐
138           cation.  protocol is a keyword for the intended protocol.  Cur‐
139           rently, the only supported keywords are "smtp" and "pop3".
140
141       -engine id
142           specifying an engine (by it's unique id string) will cause s_client
143           to attempt to obtain a functional reference to the specified
144           engine, thus initialising it if needed. The engine will then be set
145           as the default for all available algorithms.
146
147       -rand file(s)
148           a file or files containing random data used to seed the random num‐
149           ber generator, or an EGD socket (see RAND_egd(3)).  Multiple files
150           can be specified separated by a OS-dependent character.  The sepa‐
151           rator is ; for MS-Windows, , for OpenVMS, and : for all others.
152

CONNECTED COMMANDS

154       If a connection is established with an SSL server then any data
155       received from the server is displayed and any key presses will be sent
156       to the server. When used interactively (which means neither -quiet nor
157       -ign_eof have been given), the session will be renegotiated if the line
158       begins with an R, and if the line begins with a Q or if end of file is
159       reached, the connection will be closed down.
160

NOTES

162       s_client can be used to debug SSL servers. To connect to an SSL HTTP
163       server the command:
164
165        openssl s_client -connect servername:443
166
167       would typically be used (https uses port 443). If the connection suc‐
168       ceeds then an HTTP command can be given such as "GET /" to retrieve a
169       web page.
170
171       If the handshake fails then there are several possible causes, if it is
172       nothing obvious like no client certificate then the -bugs, -ssl2,
173       -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1 options can be tried in case
174       it is a buggy server. In particular you should play with these options
175       before submitting a bug report to an OpenSSL mailing list.
176
177       A frequent problem when attempting to get client certificates working
178       is that a web client complains it has no certificates or gives an empty
179       list to choose from. This is normally because the server is not sending
180       the clients certificate authority in its "acceptable CA list" when it
181       requests a certificate. By using s_client the CA list can be viewed and
182       checked. However some servers only request client authentication after
183       a specific URL is requested. To obtain the list in this case it is nec‐
184       essary to use the -prexit option and send an HTTP request for an appro‐
185       priate page.
186
187       If a certificate is specified on the command line using the -cert
188       option it will not be used unless the server specifically requests a
189       client certificate. Therefor merely including a client certificate on
190       the command line is no guarantee that the certificate works.
191
192       If there are problems verifying a server certificate then the
193       -showcerts option can be used to show the whole chain.
194

BUGS

196       Because this program has a lot of options and also because some of the
197       techniques used are rather old, the C source of s_client is rather hard
198       to read and not a model of how things should be done. A typical SSL
199       client program would be much simpler.
200
201       The -verify option should really exit if the server verification fails.
202
203       The -prexit option is a bit of a hack. We should really report informa‐
204       tion whenever a session is renegotiated.
205

SEE ALSO

207       sess_id(1), s_server(1), ciphers(1)
208
209
210
2110.9.8b                            2004-11-16                       S_CLIENT(1)
Impressum