MAN page from Trustix openssl-0.9.7m-1tr.i586.rpm
Section: OpenSSL (1)
s_client - SSL/TLS client program
command implements a generic SSL/TLS
client which connectsto a remote host using SSL/TLS
. It is a very
useful diagnostic tool forSSL
- -connect host:port
- This specifies the host and optional port to connect to. If not specifiedthen an attempt is made to connect to the local host on port 4433.
- -cert certname
- The certificate to use, if one is requested by the server. The default isnot to use a certificate.
- -key keyfile
- The private key to use. If not specified then the certificate file willbe used.
- -verify depth
- The verify depth to use. This specifies the maximum length of theserver certificate chain and turns on server certificate verification.Currently the verify operation continues after errors so all the problemswith a certificate chain can be seen. As a side effect the connectionwill never fail due to a server certificate verify failure.
- -CApath directory
- The directory to use for server certificate verification. This directorymust be in ``hash format'', see verify for more information. These arealso used when building the client certificate chain.
- -CAfile file
- A file containing trusted certificates to use during server authenticationand to use when attempting to build the client certificate chain.
- reconnects to the same server 5 times using the same session ID, this canbe used as a test that session caching is working.
- pauses 1 second between each read and write call.
- display the whole server certificate chain: normally only the servercertificate itself is displayed.
- print session information when the program exits. This will always attemptto print out information even if the connection fails. Normally informationwill only be printed out once if the connection succeeds. This option is usefulbecause the cipher in use may be renegotiated or the connection may failbecause a client certificate is required or is requested only after anattempt is made to access a certain URL. Note: the output produced by thisoption is not always accurate because a connection might never have beenestablished.
- prints out the SSL session states.
- print extensive debugging information including a hex dump of all traffic.
- show all protocol messages with hex dump.
- tests non-blocking I/O
- turns on non-blocking I/O
- this option translated a line feed from the terminal into CR+LF as requiredby some servers.
- inhibit shutting down the connection when end of file is reached in theinput.
- inhibit printing of session and certificate information. This implicitlyturns on -ign_eof as well.
- -ssl2, -ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1
- these options disable the use of certain SSL or TLS protocols. By defaultthe initial handshake uses a method which should be compatible with allservers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
Unfortunately there are a lot of ancient and broken servers in use whichcannot handle this technique and will fail to connect. Some servers onlywork if TLS is turned off with the -no_tls option others will onlysupport SSL v2 and may need the -ssl2 option.
- there are several known bug in SSL and TLS implementations. Adding thisoption enables various workarounds.
- -cipher cipherlist
- this allows the cipher list sent by the client to be modified. Althoughthe server determines which cipher suite is used it should take the firstsupported cipher in the list sent by the client. See the cipherscommand for more information.
- -starttls protocol
- send the protocol-specific message(s) to switch to TLS for communication.protocol is a keyword for the intended protocol. Currently, the onlysupported keywords are ``smtp'' and ``pop3''.
- -engine id
- specifying an engine (by it's unique id string) will cause s_clientto attempt to obtain a functional reference to the specified engine,thus initialising it if needed. The engine will then be set as the defaultfor all available algorithms.
- -rand file(s)
- a file or files containing random data used to seed the random numbergenerator, or an EGD socket (see RAND_egd(3)).Multiple files can be specified separated by a OS-dependent character.The separator is ; for MS-Windows, , for OpenVMS, and : forall others.
If a connection is established with an SSL
server then any data receivedfrom the server is displayed and any key presses will be sent to theserver. When used interactively (which means neither -quiet
have been given), the session will be renegotiated if the line begins with anR
, and if the line begins with a Q
or if end of file is reached, theconnection will be closed down.
can be used to debug SSL
servers. To connect to an SSL HTTP
server the command:
openssl s_client -connect servername:443
would typically be used (https uses port 443). If the connection succeedsthen an HTTP command can be given such as ``GET /'' to retrieve a web page.
If the handshake fails then there are several possible causes, if it isnothing obvious like no client certificate then the -bugs, -ssl2,-ssl3, -tls1, -no_ssl2, -no_ssl3, -no_tls1 options can be triedin case it is a buggy server. In particular you should play with theseoptions before submitting a bug report to an OpenSSL mailing list.
A frequent problem when attempting to get client certificates workingis that a web client complains it has no certificates or gives an emptylist to choose from. This is normally because the server is not sendingthe clients certificate authority in its ``acceptable CA list'' when itrequests a certificate. By using s_client the CA list can be viewedand checked. However some servers only request client authenticationafter a specific URL is requested. To obtain the list in this case itis necessary to use the -prexit option and send an HTTP requestfor an appropriate page.
If a certificate is specified on the command line using the -certoption it will not be used unless the server specifically requestsa client certificate. Therefor merely including a client certificateon the command line is no guarantee that the certificate works.
If there are problems verifying a server certificate then the-showcerts option can be used to show the whole chain.
Because this program has a lot of options and also because some ofthe techniques used are rather old, the C source of s_client is ratherhard to read and not a model of how things should be done. A typicalSSL
client program would be much simpler.
The -verify option should really exit if the server verificationfails.
The -prexit option is a bit of a hack. We should really reportinformation whenever a session is renegotiated.
- CONNECTED COMMANDS
- SEE ALSO
This document was created byman2html,using the manual pages.