sslclient [dacsoptions[1]]
[-caf | --ca_cert_file filename]
[-cad | --ca_cert_dir dirname]
[-ccf | --cert_chain_file filename]
[-C | --ciphers cipherstring]
[[-dvp] | [--default_verify_paths] cipherstring]
[-h | --help]
[-kf | --key_file filename]
[-kft | --key_file_type pem | asn1]
[-p | -sp | [--server_port] portnum]
[-r | --random filename]
[[-sm | --server_match regex ]...]
[-vd | --verify_depth depth]
[-vt | --verify_type none | peer]
[--] server [:port ]
This program is part of the DACS suite. It can be used with the usual DACS command line options (dacsoptions[1]), provided they all appear before the program-specific flags (note that the -un flag can be used to suppress configuration file processing). sslclient is also used by the dacshttp(1)[2] command and by requests generated internally by DACS components.
The sslclient utility acts as an SSL client. After establishing a bidirectional SSL connection with an SSL server, it forwards its standard input to the SSL server and writes data produced by the SSL server to sslclient's standard output.
sslclient connects to server (a domain name or IP address). If a port number suffix is given (port), it is used; otherwise, if a port number is specified as a separate command line argument (--server_portportnum), that is used; failing that, the default SSL port for https (443)[3] is used.
The program reads from its standard input and the server asynchronously (using non-blocking I/O). Note that the server side might need to see end-of-file on its input before its output is returned to sslclient.
This program's underlying SSL functionality is provided by OpenSSL[4].
sslclient recognizes these options:
-caf filename
--ca_cert_file filename
-cad dirname
--ca_cert_dir dirname
-ccf filename
--cert_chain_file filename
-C cipherstring
--ciphers cipherstring
-dvp
--default_verify_paths
-h
--help
-kf filename
--key_file filename
-kft type
--key_file_type type
-p portnum
-sp portnum
--server_port portnum
-r filename
--random filename
-sm regex
--server_match regex
-vd depth
--verify_depth depth
-vt type
--verify_type type
--
The DACS-v (or --verbose) flag causes the program to show some of the server's SSL certificate, print feedback about regular expression matching, and so on. If sslclient is not doing what you expect, try using this flag.
If the server presents a valid SSL (X.509) certificate, a set of checks is applied to it to help ensure that sslclient is communicating with the intended entity. Verification is successful and checking is terminated as soon as any test is successful. If no test succeeds, the program terminates immediately.
You can use a command like the following one to display an X.509 certificate to stdout in text form:
% openssl x509 -noout -text < cert.crt
Here, cert.crt is the certificate to display.
The server certificate's subjectAltName extension fields have the format field-name:field-value. For each such field, tests are made in the following sequence:
If the above procedure is unsuccessful and the server certificate's commonName attribute value is available, it is matched against each of the regular expressions given on the command line.
The following command line attempts to connect to port 443 at example.com and prints to stdout the server's response to a request for the home page:
% perl -e 'printf "GET / HTTP/1.0\n\n";' | sslclient example.com:443
When used with DACS logging configured, messages are directed to a log file, otherwise error messages and verbose output are written to stderr. The program exits 0 if everything was fine, 1 if an error occurred.
A wrapper mode of operation might be useful.
It would also be useful to have a mode where it listens for an SSL connection for input (rather than its standard input) and then relays data over that connection to a specified server, possibly but not necessarily via SSL. This mode might run on a firewall host to forward an approved incoming SSL connection (presumably authenticated by a client certificate, and possibly by a DACS ruleset) to a service running on an interior host, for instance.
dacshttp(1)[2], openssl(1)[4], s_client(1)[14], stunnel(1)[15], curl(1)[16], sslwrap(1)[17], and others, and regex(3)[18].
A variety of reference material on SSL/TLS is available. Perhaps best is Network Security with OpenSSL by John Viega, Matt Messier, and Pravir Chandra, O'Reilly & Associates, Inc., 2002. Also useful are SSL/TLS Strong Encryption: An Introduction[19], Netscape SSL 3.0 Specification[20], and RFC 2246[21].
Distributed Systems Software (www.dss.ca[22])
Copyright2003-2013 Distributed Systems Software. See the LICENSE[23] file that accompanies the distribution for licensing information.