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] [-servername name] [-verify
10       depth] [-verify_return_error] [-cert filename] [-certform DER|PEM]
11       [-key filename] [-keyform DER|PEM] [-pass arg] [-CApath directory]
12       [-CAfile filename] [-trusted_first] [-no_alt_chains] [-reconnect]
13       [-pause] [-showcerts] [-debug] [-msg] [-nbio_test] [-state] [-nbio]
14       [-crlf] [-ign_eof] [-no_ign_eof] [-quiet] [-ssl3] [-tls1] [-tls1_1]
15       [-tls1_2] [-dtls1] [-no_ssl3] [-no_tls1] [-no_tls1_1] [-no_tls1_2]
16       [-fallback_scsv] [-bugs] [-cipher cipherlist] [-krb5svc service]
17       [-serverpref] [-starttls protocol] [-xmpphost hostname] [-name
18       hostname] [-engine id] [-tlsextdebug] [-no_ticket] [-sess_out filename]
19       [-sess_in filename] [-rand file(s)] [-serverinfo types] [-status]
20       [-alpn protocols] [-nextprotoneg protocols]
21

DESCRIPTION

23       The s_client command implements a generic SSL/TLS client which connects
24       to a remote host using SSL/TLS. It is a very useful diagnostic tool for
25       SSL servers.
26

OPTIONS

28       -connect host:port
29           This specifies the host and optional port to connect to. If not
30           specified then an attempt is made to connect to the local host on
31           port 4433.
32
33       -servername name
34           Set the TLS SNI (Server Name Indication) extension in the
35           ClientHello message.
36
37       -cert certname
38           The certificate to use, if one is requested by the server. The
39           default is not to use a certificate.
40
41       -certform format
42           The certificate format to use: DER or PEM. PEM is the default.
43
44       -key keyfile
45           The private key to use. If not specified then the certificate file
46           will be used.
47
48       -keyform format
49           The private format to use: DER or PEM. PEM is the default.
50
51       -pass arg
52           the private key password source. For more information about the
53           format of arg see the PASS PHRASE ARGUMENTS section in openssl(1).
54
55       -verify depth
56           The verify depth to use. This specifies the maximum length of the
57           server certificate chain and turns on server certificate
58           verification.  Currently the verify operation continues after
59           errors so all the problems with a certificate chain can be seen. As
60           a side effect the connection will never fail due to a server
61           certificate verify failure.
62
63       -verify_return_error
64           Return verification errors instead of continuing. This will
65           typically abort the handshake with a fatal error.
66
67       -CApath directory
68           The directory to use for server certificate verification. This
69           directory must be in "hash format", see verify for more
70           information. These are also used when building the client
71           certificate chain.
72
73       -CAfile file
74           A file containing trusted certificates to use during server
75           authentication and to use when attempting to build the client
76           certificate chain.
77
78       -purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all,
79       -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig,
80       -trusted_first -no_alt_chains
81           Set various certificate chain valiadition option. See the verify
82           manual page for details.
83
84       -reconnect
85           reconnects to the same server 5 times using the same session ID,
86           this can be used as a test that session caching is working.
87
88       -pause
89           pauses 1 second between each read and write call.
90
91       -showcerts
92           display the whole server certificate chain: normally only the
93           server certificate itself is displayed.
94
95       -prexit
96           print session information when the program exits. This will always
97           attempt to print out information even if the connection fails.
98           Normally information will only be printed out once if the
99           connection succeeds. This option is useful because the cipher in
100           use may be renegotiated or the connection may fail because a client
101           certificate is required or is requested only after an attempt is
102           made to access a certain URL. Note: the output produced by this
103           option is not always accurate because a connection might never have
104           been established.
105
106       -state
107           prints out the SSL session states.
108
109       -debug
110           print extensive debugging information including a hex dump of all
111           traffic.
112
113       -msg
114           show all protocol messages with hex dump.
115
116       -nbio_test
117           tests non-blocking I/O
118
119       -nbio
120           turns on non-blocking I/O
121
122       -crlf
123           this option translated a line feed from the terminal into CR+LF as
124           required by some servers.
125
126       -ign_eof
127           inhibit shutting down the connection when end of file is reached in
128           the input.
129
130       -quiet
131           inhibit printing of session and certificate information.  This
132           implicitly turns on -ign_eof as well.
133
134       -no_ign_eof
135           shut down the connection when end of file is reached in the input.
136           Can be used to override the implicit -ign_eof after -quiet.
137
138       -psk_identity identity
139           Use the PSK identity identity when using a PSK cipher suite.
140
141       -psk key
142           Use the PSK key key when using a PSK cipher suite. The key is given
143           as a hexadecimal number without leading 0x, for example -psk
144           1a2b3c4d.
145
146       -ssl3, -tls1, -tls1_1, -tls1_2, -dtls1, -no_ssl3, -no_tls1, -no_tls1_1,
147       -no_tls1_2
148           These options require or disable the use of the specified SSL or
149           TLS protocols.  By default the initial handshake uses a version-
150           flexible method which will negotiate the highest mutually supported
151           protocol version.
152
153       -fallback_scsv
154           Send TLS_FALLBACK_SCSV in the ClientHello.
155
156       -bugs
157           there are several known bug in SSL and TLS implementations. Adding
158           this option enables various workarounds.
159
160       -cipher cipherlist
161           this allows the cipher list sent by the client to be modified.
162           Although the server determines which cipher suite is used it should
163           take the first supported cipher in the list sent by the client. See
164           the ciphers command for more information.
165
166       -serverpref
167           use the server's cipher preferences; only used for SSLV2.
168
169       -krb5svc service
170           the Kerberos service name to use (default "host"). This means
171           s_server will expect a ticket for the principal
172           service/hostname@REALM, and will need keys for that principal in
173           its keytab.
174
175       -starttls protocol
176           send the protocol-specific message(s) to switch to TLS for
177           communication.  protocol is a keyword for the intended protocol.
178           Currently, the only supported keywords are "smtp", "pop3", "imap",
179           "ftp", "xmpp", "xmpp-server", "irc", "postgres", "lmtp", "nntp",
180           "sieve" and "ldap".
181
182       -xmpphost hostname
183           This option, when used with "-starttls xmpp" or "-starttls xmpp-
184           server", specifies the host for the "to" attribute of the stream
185           element.  If this option is not specified, then the host specified
186           with "-connect" will be used.
187
188       -name hostname
189           the host name to use with "-starttls smtp".  If this option is not
190           specified, the default "openssl.client.net" will be used.
191
192       -tlsextdebug
193           print out a hex dump of any TLS extensions received from the
194           server.
195
196       -no_ticket
197           disable RFC4507bis session ticket support.
198
199       -sess_out filename
200           output SSL session to filename
201
202       -sess_in sess.pem
203           load SSL session from filename. The client will attempt to resume a
204           connection from this session.
205
206       -engine id
207           specifying an engine (by its unique id string) will cause s_client
208           to attempt to obtain a functional reference to the specified
209           engine, thus initialising it if needed. The engine will then be set
210           as the default for all available algorithms.
211
212       -rand file(s)
213           a file or files containing random data used to seed the random
214           number generator, or an EGD socket (see RAND_egd(3)).  Multiple
215           files can be specified separated by a OS-dependent character.  The
216           separator is ; for MS-Windows, , for OpenVMS, and : for all others.
217
218       -serverinfo types
219           a list of comma-separated TLS Extension Types (numbers between 0
220           and 65535).  Each type will be sent as an empty ClientHello TLS
221           Extension.  The server's response (if any) will be encoded and
222           displayed as a PEM file.
223
224       -status
225           sends a certificate status request to the server (OCSP stapling).
226           The server response (if any) is printed out.
227
228       -alpn protocols, -nextprotoneg protocols
229           these flags enable the Enable the Application-Layer Protocol
230           Negotiation or Next Protocol Negotiation extension, respectively.
231           ALPN is the IETF standard and replaces NPN.  The protocols list is
232           a comma-separated protocol names that the client should advertise
233           support for. The list should contain most wanted protocols first.
234           Protocol names are printable ASCII strings, for example "http/1.1"
235           or "spdy/3".  Empty list of protocols is treated specially and will
236           cause the client to advertise support for the TLS extension but
237           disconnect just after reciving ServerHello with a list of server
238           supported protocols.
239

CONNECTED COMMANDS

241       If a connection is established with an SSL server then any data
242       received from the server is displayed and any key presses will be sent
243       to the server. When used interactively (which means neither -quiet nor
244       -ign_eof have been given), the session will be renegotiated if the line
245       begins with an R, and if the line begins with a Q or if end of file is
246       reached, the connection will be closed down.
247

NOTES

249       s_client can be used to debug SSL servers. To connect to an SSL HTTP
250       server the command:
251
252        openssl s_client -connect servername:443
253
254       would typically be used (https uses port 443). If the connection
255       succeeds then an HTTP command can be given such as "GET /" to retrieve
256       a web page.
257
258       If the handshake fails then there are several possible causes, if it is
259       nothing obvious like no client certificate then the -bugs, -ssl3,
260       -tls1, -no_ssl3, -no_tls1 options can be tried in case it is a buggy
261       server. In particular you should play with these options before
262       submitting a bug report to an OpenSSL mailing list.
263
264       A frequent problem when attempting to get client certificates working
265       is that a web client complains it has no certificates or gives an empty
266       list to choose from. This is normally because the server is not sending
267       the clients certificate authority in its "acceptable CA list" when it
268       requests a certificate. By using s_client the CA list can be viewed and
269       checked. However some servers only request client authentication after
270       a specific URL is requested. To obtain the list in this case it is
271       necessary to use the -prexit option and send an HTTP request for an
272       appropriate page.
273
274       If a certificate is specified on the command line using the -cert
275       option it will not be used unless the server specifically requests a
276       client certificate. Therefor merely including a client certificate on
277       the command line is no guarantee that the certificate works.
278
279       If there are problems verifying a server certificate then the
280       -showcerts option can be used to show the whole chain.
281
282       The s_client utility is a test tool and is designed to continue the
283       handshake after any certificate verification errors. As a result it
284       will accept any certificate chain (trusted or not) sent by the peer.
285       None test applications should not do this as it makes them vulnerable
286       to a MITM attack. This behaviour can be changed by with the
287       -verify_return_error option: any verify errors are then returned
288       aborting the handshake.
289

BUGS

291       Because this program has a lot of options and also because some of the
292       techniques used are rather old, the C source of s_client is rather hard
293       to read and not a model of how things should be done. A typical SSL
294       client program would be much simpler.
295
296       The -prexit option is a bit of a hack. We should really report
297       information whenever a session is renegotiated.
298

SEE ALSO

300       sess_id(1), s_server(1), ciphers(1)
301

HISTORY

303       The -no_alt_chains options was first added to OpenSSL 1.0.2b.
304
305
306
3071.0.2k                            2019-03-12                       S_CLIENT(1)
Impressum