Current Path : /compat/linux/proc/self/root/usr/local/share/doc/stunnel/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/share/doc/stunnel/stunnel.html |
<?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>stunnel.8</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:root@localhost" /> </head> <body style="background-color: white"> <h1 id="NAME">NAME</h1> <p>stunnel - universal SSL tunnel</p> <h1 id="SYNOPSIS">SYNOPSIS</h1> <dl> <dt id="Unix"><b>Unix:</b></dt> <dd> <p><b>stunnel</b> [<span style="white-space: nowrap;">FILE</span>] | <span style="white-space: nowrap;">-fd N</span> | <span style="white-space: nowrap;">-help</span> | <span style="white-space: nowrap;">-version</span> | <span style="white-space: nowrap;">-sockets</span> | <span style="white-space: nowrap;">-options</span></p> </dd> <dt id="WIN32"><b>WIN32:</b></dt> <dd> <p><b>stunnel</b> [ [<span style="white-space: nowrap;">-install</span> | <span style="white-space: nowrap;">-uninstall</span> | <span style="white-space: nowrap;">-start</span> | <span style="white-space: nowrap;">-stop</span>] | <span style="white-space: nowrap;">-exit</span>] [<span style="white-space: nowrap;">-quiet</span>] [<span style="white-space: nowrap;">FILE</span>] ] | <span style="white-space: nowrap;">-help</span> | <span style="white-space: nowrap;">-version</span> | <span style="white-space: nowrap;">-sockets</span> | <span style="white-space: nowrap;">-options</span></p> </dd> </dl> <h1 id="DESCRIPTION">DESCRIPTION</h1> <p>The <b>stunnel</b> program is designed to work as <i>SSL</i> encryption wrapper between remote clients and local (<i>inetd</i>-startable) or remote servers. The concept is that having non-SSL aware daemons running on your system you can easily set them up to communicate with clients over secure SSL channels.</p> <p><b>stunnel</b> can be used to add SSL functionality to commonly used <i>Inetd</i> daemons like POP-2, POP-3, and IMAP servers, to standalone daemons like NNTP, SMTP and HTTP, and in tunneling PPP over network sockets without changes to the source code.</p> <p>This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)</p> <h1 id="OPTIONS">OPTIONS</h1> <dl> <dt id="FILE"><b>FILE</b></dt> <dd> <p>Use specified configuration file</p> </dd> <dt id="fd-N-Unix-only"><b>-fd N</b> (Unix only)</dt> <dd> <p>Read the config file from specified file descriptor</p> </dd> <dt id="help"><b>-help</b></dt> <dd> <p>Print <b>stunnel</b> help menu</p> </dd> <dt id="version"><b>-version</b></dt> <dd> <p>Print <b>stunnel</b> version and compile time defaults</p> </dd> <dt id="sockets"><b>-sockets</b></dt> <dd> <p>Print default socket options</p> </dd> <dt id="options"><b>-options</b></dt> <dd> <p>Print supported SSL options</p> </dd> <dt id="install-Windows-NT-and-later-only"><b>-install</b> (Windows NT and later only)</dt> <dd> <p>Install NT Service</p> </dd> <dt id="uninstall-Windows-NT-and-later-only"><b>-uninstall</b> (Windows NT and later only)</dt> <dd> <p>Uninstall NT Service</p> </dd> <dt id="start-Windows-NT-and-later-only"><b>-start</b> (Windows NT and later only)</dt> <dd> <p>Start NT Service</p> </dd> <dt id="stop-Windows-NT-and-later-only"><b>-stop</b> (Windows NT and later only)</dt> <dd> <p>Stop NT Service</p> </dd> <dt id="exit-Win32-only"><b>-exit</b> (Win32 only)</dt> <dd> <p>Exit an already started stunnel</p> </dd> <dt id="quiet-Win32-only"><b>-quiet</b> (Win32 only)</dt> <dd> <p>Don't display any message boxes</p> </dd> </dl> <h1 id="CONFIGURATION-FILE">CONFIGURATION FILE</h1> <p>Each line of the configuration file can be either:</p> <ul> <li><p>An empty line (ignored).</p> </li> <li><p>A comment starting with ';' (ignored).</p> </li> <li><p>An 'option_name = option_value' pair.</p> </li> <li><p>'[service_name]' indicating a start of a service definition.</p> </li> </ul> <p>An address parameter of an option may be either:</p> <ul> <li><p>A port number.</p> </li> <li><p>A colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number.</p> </li> <li><p>A Unix socket path (Unix only).</p> </li> </ul> <h2 id="GLOBAL-OPTIONS">GLOBAL OPTIONS</h2> <dl> <dt id="chroot-DIRECTORY-Unix-only"><b>chroot</b> = DIRECTORY (Unix only)</dt> <dd> <p>directory to chroot <b>stunnel</b> process</p> <p><b>chroot</b> keeps <b>stunnel</b> in chrooted jail. <i>CApath</i>, <i>CRLpath</i>, <i>pid</i> and <i>exec</i> are located inside the jail and the patches have to be relative to the directory specified with <b>chroot</b>.</p> <p>Several functions of the operating system also need their files to be located within chroot jail, e.g.:</p> <ul> <li><p>Delayed resolver typically needs /etc/nsswitch.conf and /etc/resolv.conf.</p> </li> <li><p>Local time in log files needs /etc/timezone.</p> </li> <li><p>Some other functions may need devices, e.g. /dev/zero or /dev/null.</p> </li> </ul> </dd> <dt id="compression-deflate-zlib-rle"><b>compression</b> = deflate | zlib | rle</dt> <dd> <p>select data compression algorithm</p> <p>default: no compression</p> <p>deflate is the standard compression method as described in RFC 1951.</p> <p>zlib compression of <b>OpenSSL 0.9.8</b> or above is not backward compatible with <b>OpenSSL 0.9.7</b>.</p> <p>rle compression is currently not implemented by the <b>OpenSSL</b> library.</p> </dd> <dt id="debug-FACILITY.-LEVEL"><b>debug</b> = [FACILITY.]LEVEL</dt> <dd> <p>debugging level</p> <p>Level is a one of the syslog level names or numbers emerg (0), alert (1), crit (2), err (3), warning (4), notice (5), info (6), or debug (7). All logs for the specified level and all levels numerically less than it will be shown. Use <i>debug = debug</i> or <i>debug = 7</i> for greatest debugging output. The default is notice (5).</p> <p>The syslog facility 'daemon' will be used unless a facility name is supplied. (Facilities are not supported on Win32.)</p> <p>Case is ignored for both facilities and levels.</p> </dd> <dt id="EGD-EGD_PATH-Unix-only"><b>EGD</b> = EGD_PATH (Unix only)</dt> <dd> <p>path to Entropy Gathering Daemon socket</p> <p>Entropy Gathering Daemon socket to use to feed <b>OpenSSL</b> random number generator. (Available only if compiled with <b>OpenSSL 0.9.5a</b> or higher)</p> </dd> <dt id="engine-auto-ENGINE_ID"><b>engine</b> = auto | ENGINE_ID</dt> <dd> <p>select hardware engine</p> <p>default: software-only cryptography</p> <p>Here is an example of advanced engine configuration to read private key from an OpenSC engine</p> <pre><code> engine=dynamic engineCtrl=SO_PATH:/usr/lib/opensc/engine_pkcs11.so engineCtrl=ID:pkcs11 engineCtrl=LIST_ADD:1 engineCtrl=LOAD engineCtrl=MODULE_PATH:/usr/lib/pkcs11/opensc-pkcs11.so engineCtrl=INIT [service] engineNum=1 key=id_45</code></pre> </dd> <dt id="engineCtrl-COMMAND-:PARAMETER"><b>engineCtrl</b> = COMMAND[:PARAMETER]</dt> <dd> <p>control hardware engine</p> <p>Special commands "LOAD" and "INIT" can be used to load and initialize the engine cryptogaphic module.</p> </dd> <dt id="engineDefault-TASK_LIST"><b>engineDefault</b> = TASK_LIST</dt> <dd> <p>set OpenSSL tasks delegated to the current engine</p> <p>The parameter specifies a comma-separated list of task to be delegated to the current engine.</p> <p>The following tasks may be available, if supported by the engine: ALL, RSA, DSA, ECDH, ECDSA, DH, RAND, CIPHERS, DIGESTS, PKEY, PKEY_CRYPTO, PKEY_ASN1.</p> </dd> <dt id="fips-yes-no"><b>fips</b> = yes | no</dt> <dd> <p>Enable or disable FIPS 140-2 mode.</p> <p>This option allows to disable entering FIPS mode if <b>stunnel</b> was compiled with FIPS 140-2 support.</p> <p>default: no (since version 5.00)</p> </dd> <dt id="foreground-yes-no-Unix-only"><b>foreground</b> = yes | no (Unix only)</dt> <dd> <p>foreground mode</p> <p>Stay in foreground (don't fork) and log to stderr instead of via syslog (unless <i>output</i> is specified).</p> <p>default: background in daemon mode</p> </dd> <dt id="iconActive-ICON_FILE-GUI-only"><b>iconActive</b> = ICON_FILE (GUI only)</dt> <dd> <p>GUI icon to be displayed when there are established connections</p> <p>On Windows platform the parameter should be an .ico file containing a 16x16 pixel image.</p> </dd> <dt id="iconError-ICON_FILE-GUI-only"><b>iconError</b> = ICON_FILE (GUI only)</dt> <dd> <p>GUI icon to be displayed when no valid configuration is loaded</p> <p>On Windows platform the parameter should be an .ico file containing a 16x16 pixel image.</p> </dd> <dt id="iconIdle-ICON_FILE-GUI-only"><b>iconIdle</b> = ICON_FILE (GUI only)</dt> <dd> <p>GUI icon to be displayed when there are no established connections</p> <p>On Windows platform the parameter should be an .ico file containing a 16x16 pixel image.</p> </dd> <dt id="log-append-overwrite"><b>log</b> = append | overwrite</dt> <dd> <p>log file handling</p> <p>This option allows to choose whether the log file (specified with the <i>output</i> option) is appended or overwritten when opened or re-opened.</p> <p>default: append</p> </dd> <dt id="output-FILE"><b>output</b> = FILE</dt> <dd> <p>append log messages to a file</p> <p>/dev/stdout device can be used to send log messages to the standard output (for example to log them with daemontools splogger).</p> </dd> <dt id="pid-FILE-Unix-only"><b>pid</b> = FILE (Unix only)</dt> <dd> <p>pid file location</p> <p>If the argument is empty, then no pid file will be created.</p> <p><i>pid</i> path is relative to <i>chroot</i> directory if specified.</p> </dd> <dt id="RNDbytes-BYTES"><b>RNDbytes</b> = BYTES</dt> <dd> <p>bytes to read from random seed files</p> <p>Number of bytes of data read from random seed files. With SSL versions less than <b>0.9.5a</b>, also determines how many bytes of data are considered sufficient to seed the PRNG. More recent <b>OpenSSL</b> versions have a builtin function to determine when sufficient randomness is available.</p> </dd> <dt id="RNDfile-FILE"><b>RNDfile</b> = FILE</dt> <dd> <p>path to file with random seed data</p> <p>The SSL library will use data from this file first to seed the random number generator.</p> </dd> <dt id="RNDoverwrite-yes-no"><b>RNDoverwrite</b> = yes | no</dt> <dd> <p>overwrite the random seed files with new random data</p> <p>default: yes</p> </dd> <dt id="service-SERVICE-Unix-only"><b>service</b> = SERVICE (Unix only)</dt> <dd> <p>use specified string as <i>inetd</i> mode service name for TCP Wrapper library</p> <p>default: stunnel</p> </dd> <dt id="setgid-GROUP-Unix-only"><b>setgid</b> = GROUP (Unix only)</dt> <dd> <p>setgid() to the specified group in daemon mode and clear all other groups</p> </dd> <dt id="setuid-USER-Unix-only"><b>setuid</b> = USER (Unix only)</dt> <dd> <p>setuid() to the specified user in daemon mode</p> </dd> <dt id="socket-a-l-r:OPTION-VALUE-:VALUE"><b>socket</b> = a|l|r:OPTION=VALUE[:VALUE]</dt> <dd> <p>Set an option on accept/local/remote socket</p> <p>The values for linger option are l_onof:l_linger. The values for time are tv_sec:tv_usec.</p> <p>Examples:</p> <pre><code> socket = l:SO_LINGER=1:60 set one minute timeout for closing local socket socket = r:SO_OOBINLINE=yes place out-of-band data directly into the receive data stream for remote sockets socket = a:SO_REUSEADDR=no disable address reuse (enabled by default) socket = a:SO_BINDTODEVICE=lo only accept connections on loopback interface</code></pre> </dd> <dt id="syslog-yes-no-Unix-only"><b>syslog</b> = yes | no (Unix only)</dt> <dd> <p>enable logging via syslog</p> <p>default: yes</p> </dd> <dt id="taskbar-yes-no-WIN32-only"><b>taskbar</b> = yes | no (WIN32 only)</dt> <dd> <p>enable the taskbar icon</p> <p>default: yes</p> </dd> </dl> <h2 id="SERVICE-LEVEL-OPTIONS">SERVICE-LEVEL OPTIONS</h2> <p>Each configuration section begins with service name in square brackets. The service name is used for libwrap (TCP Wrappers) access control and lets you distinguish <b>stunnel</b> services in your log files.</p> <p>Note that if you wish to run <b>stunnel</b> in <i>inetd</i> mode (where it is provided a network socket by a server such as <i>inetd</i>, <i>xinetd</i>, or <i>tcpserver</i>) then you should read the section entitled <i>INETD MODE</i> below.</p> <dl> <dt id="accept-HOST:-PORT"><b>accept</b> = [HOST:]PORT</dt> <dd> <p>accept connections on specified address</p> <p>If no host specified, defaults to all IPv4 addresses for the local host.</p> <p>To listen on all IPv6 addresses use:</p> <pre><code> connect = :::PORT</code></pre> </dd> <dt id="CApath-DIRECTORY"><b>CApath</b> = DIRECTORY</dt> <dd> <p>Certificate Authority directory</p> <p>This is the directory in which <b>stunnel</b> will look for certificates when using the <i>verify</i>. Note that the certificates in this directory should be named XXXXXXXX.0 where XXXXXXXX is the hash value of the DER encoded subject of the cert.</p> <p>The hash algorithm has been changed in <b>OpenSSL 1.0.0</b>. It is required to c_rehash the directory on upgrade from <b>OpenSSL 0.x.x</b> to <b>OpenSSL 1.x.x</b>.</p> <p><i>CApath</i> path is relative to <i>chroot</i> directory if specified.</p> </dd> <dt id="CAfile-CERT_FILE"><b>CAfile</b> = CERT_FILE</dt> <dd> <p>Certificate Authority file</p> <p>This file contains multiple CA certificates, used with the <i>verify</i>.</p> </dd> <dt id="cert-PEM_FILE"><b>cert</b> = PEM_FILE</dt> <dd> <p>certificate chain PEM file name</p> <p>The certificates must be in PEM format, and must be from the actual server/client certificate to the self-signed root CA certificate.</p> <p>A certificate is required in server mode, and optional in client mode.</p> </dd> <dt id="ciphers-CIPHER_LIST"><b>ciphers</b> = CIPHER_LIST</dt> <dd> <p>Select permitted SSL ciphers</p> <p>A colon delimited list of the ciphers to allow in the SSL connection, for example DES-CBC3-SHA:IDEA-CBC-MD5.</p> </dd> <dt id="client-yes-no"><b>client</b> = yes | no</dt> <dd> <p>client mode (remote service uses SSL)</p> <p>default: no (server mode)</p> </dd> <dt id="connect-HOST:-PORT"><b>connect</b> = [HOST:]PORT</dt> <dd> <p>connect to a remote address</p> <p>If no host is specified, the host defaults to localhost.</p> <p>Multiple <b>connect</b> options are allowed in a single service section.</p> <p>If host resolves to multiple addresses and/or if multiple <i>connect</i> options are specified, then the remote address is chosen using a round-robin algorithm.</p> </dd> <dt id="CRLpath-DIRECTORY"><b>CRLpath</b> = DIRECTORY</dt> <dd> <p>Certificate Revocation Lists directory</p> <p>This is the directory in which <b>stunnel</b> will look for CRLs when using the <i>verify</i>. Note that the CRLs in this directory should be named XXXXXXXX.r0 where XXXXXXXX is the hash value of the CRL.</p> <p>The hash algorithm has been changed in <b>OpenSSL 1.0.0</b>. It is required to c_rehash the directory on upgrade from <b>OpenSSL 0.x.x</b> to <b>OpenSSL 1.x.x</b>.</p> <p><i>CRLpath</i> path is relative to <i>chroot</i> directory if specified.</p> </dd> <dt id="CRLfile-CERT_FILE"><b>CRLfile</b> = CERT_FILE</dt> <dd> <p>Certificate Revocation Lists file</p> <p>This file contains multiple CRLs, used with the <i>verify</i>.</p> </dd> <dt id="curve-NID"><b>curve</b> = NID</dt> <dd> <p>specify ECDH curve name</p> <p>To get a list of supported cuves use:</p> <pre><code> openssl ecparam -list_curves</code></pre> <p>default: prime256v1</p> </dd> <dt id="delay-yes-no"><b>delay</b> = yes | no</dt> <dd> <p>delay DNS lookup for <i>connect</i> option</p> <p>This option is useful for dynamic DNS, or when DNS is not available during <b>stunnel</b> startup (road warrior VPN, dial-up configurations).</p> <p>Delayed resolver mode is automatically engaged when stunnel fails to resolve on startup any of the <i>connect</i> targets for a service.</p> <p>Delayed resolver inflicts <i>failover = prio</i>.</p> <p>default: no</p> </dd> <dt id="engineId-ENGINE_ID"><b>engineId</b> = ENGINE_ID</dt> <dd> <p>select engine ID for the service</p> </dd> <dt id="engineNum-ENGINE_NUMBER"><b>engineNum</b> = ENGINE_NUMBER</dt> <dd> <p>select engine number for the service</p> <p>The engines are numbered starting from 1.</p> </dd> <dt id="exec-EXECUTABLE_PATH"><b>exec</b> = EXECUTABLE_PATH</dt> <dd> <p>execute local inetd-type program</p> <p><i>exec</i> path is relative to <i>chroot</i> directory if specified.</p> <p>The following environmental variables are set on Unix platform: REMOTE_HOST, REMOTE_PORT, SSL_CLIENT_DN, SSL_CLIENT_I_DN.</p> </dd> <dt id="execargs-0-1-2"><b>execargs</b> = $0 $1 $2 ...</dt> <dd> <p>arguments for <i>exec</i> including program name ($0)</p> <p>Quoting is currently not supported. Arguments are separated with arbitrary number of whitespaces.</p> </dd> <dt id="failover-rr-prio"><b>failover</b> = rr | prio</dt> <dd> <p>Failover strategy for multiple "connect" targets.</p> <pre><code> rr (round robin) - fair load distribution prio (priority) - use the order specified in config file</code></pre> <p>default: rr</p> </dd> <dt id="ident-USERNAME"><b>ident</b> = USERNAME</dt> <dd> <p>use IDENT (RFC 1413) username checking</p> </dd> <dt id="key-KEY_FILE"><b>key</b> = KEY_FILE</dt> <dd> <p>private key for certificate specified with <i>cert</i> option</p> <p>Private key is needed to authenticate certificate owner. Since this file should be kept secret it should only be readable to its owner. On Unix systems you can use the following command:</p> <pre><code> chmod 600 keyfile</code></pre> <p>default: value of <i>cert</i> option</p> </dd> <dt id="libwrap-yes-no"><b>libwrap</b> = yes | no</dt> <dd> <p>Enable or disable the use of /etc/hosts.allow and /etc/hosts.deny.</p> <p>default: no (since version 5.00)</p> </dd> <dt id="local-HOST"><b>local</b> = HOST</dt> <dd> <p>IP of the outgoing interface is used as source for remote connections. Use this option to bind a static local IP address, instead.</p> </dd> <dt id="sni-SERVICE:SERVER_PATTERN-server-mode"><b>sni</b> = SERVICE:SERVER_PATTERN (server mode)</dt> <dd> <p>Use the service as a slave service (a name-based virtual server) for Server Name Indication TLS extension (RFC 3546).</p> <p><i>service_name</i> specifies the master service that accepts client connections with <i>accept</i> option. <i>server_name_pattern</i> specifies the host name to be redirected. The pattern may start with '*' character, e.g. '*.example.com'. Multiple slave services are normally specified for a single master service. <i>sni</i> option can also be specified more than once within a single slave service.</p> <p>This service, as well as the master service, may not be configured in client mode.</p> <p><i>connect</i> option of the slave service is ignored when <i>protocol</i> option is specified, as <i>protocol</i> connects remote host before TLS handshake.</p> <p>Libwrap checks (Unix only) are performed twice: with master service name after TCP connection is accepted, and with slave service name during TLS handshake.</p> <p>Option <i>sni</i> is only available when compiled with <b>OpenSSL 1.0.0</b> and later.</p> </dd> <dt id="sni-SERVER-client-mode"><b>sni</b> = SERVER (client mode)</dt> <dd> <p>Use the parameter as the value of TLS Server Name Indication (RFC 3546) extension.</p> <p>Option <i>sni</i> is only available when compiled with <b>OpenSSL 1.0.0</b> and later.</p> </dd> <dt id="OCSP-URL"><b>OCSP</b> = URL</dt> <dd> <p>select OCSP server for certificate verification</p> </dd> <dt id="OCSPflag-OCSP_FLAG"><b>OCSPflag</b> = OCSP_FLAG</dt> <dd> <p>specify OCSP server flag</p> <p>Several <i>OCSPflag</i> can be used to specify multiple flags.</p> <p>currently supported flags: NOCERTS, NOINTERN NOSIGS, NOCHAIN, NOVERIFY, NOEXPLICIT, NOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPID_KEY, NOTIME</p> </dd> <dt id="options-SSL_OPTIONS"><b>options</b> = SSL_OPTIONS</dt> <dd> <p><b>OpenSSL</b> library options</p> <p>The parameter is the <b>OpenSSL</b> option name as described in the <i>SSL_CTX_set_options(3ssl)</i> manual, but without <i>SSL_OP_</i> prefix. <i>stunnel -options</i> lists the options found to be allowed in the current combination of <i>stunnel</i> and the <i>OpenSSL</i> library used to build it.</p> <p>Several <i>options</i> can be used to specify multiple options. An option name can be prepended with a dash ("-") to disable the option.</p> <p>For example, for compatibility with the erroneous Eudora SSL implementation, the following option can be used:</p> <pre><code> options = DONT_INSERT_EMPTY_FRAGMENTS</code></pre> <p>default:</p> <pre><code> options = NO_SSLv2 options = NO_SSLv3</code></pre> </dd> <dt id="protocol-PROTO"><b>protocol</b> = PROTO</dt> <dd> <p>application protocol to negotiate SSL</p> <p>This option enables initial, protocol-specific negotiation of the SSL/TLS encryption. <i>protocol</i> option should not be used with SSL encryption on a separate port.</p> <p>Currently supported protocols:</p> <dl> <dt id="cifs"><i>cifs</i></dt> <dd> <p>Proprietary (undocummented) extension of CIFS protocol implemented in Samba. Support for this extension was dropped in Samba 3.0.0.</p> </dd> <dt id="connect"><i>connect</i></dt> <dd> <p>Based on RFC 2817 - <i>Upgrading to TLS Within HTTP/1.1</i>, section 5.2 - <i>Requesting a Tunnel with CONNECT</i></p> <p>This protocol is only supported in client mode.</p> </dd> <dt id="imap"><i>imap</i></dt> <dd> <p>Based on RFC 2595 - <i>Using TLS with IMAP, POP3 and ACAP</i></p> </dd> <dt id="nntp"><i>nntp</i></dt> <dd> <p>Based on RFC 4642 - <i>Using Transport Layer Security (TLS) with Network News Transfer Protocol (NNTP)</i></p> <p>This protocol is only supported in client mode.</p> </dd> <dt id="pgsql"><i>pgsql</i></dt> <dd> <p>Based on <i>http://www.postgresql.org/docs/8.3/static/protocol-flow.html#AEN73982</i></p> </dd> <dt id="pop3"><i>pop3</i></dt> <dd> <p>Based on RFC 2449 - <i>POP3 Extension Mechanism</i></p> </dd> <dt id="proxy"><i>proxy</i></dt> <dd> <p>Haproxy client IP address <i>http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt</i></p> </dd> <dt id="smtp"><i>smtp</i></dt> <dd> <p>Based on RFC 2487 - <i>SMTP Service Extension for Secure SMTP over TLS</i></p> </dd> <dt id="socks"><i>socks</i></dt> <dd> <p>SOCKS versions 4, 4a, and 5 are supported. The SOCKS protocol itself is encapsulated within SSL/TLS encryption layer to protect the final destination address.</p> <p><i>http://www.openssh.com/txt/socks4.protocol</i></p> <p><i>http://www.openssh.com/txt/socks4a.protocol</i></p> <p>The BIND command of the SOCKS protocol is not supported. The USERID parameter is ignored.</p> <p>See Examples section for sample configuration files for VPN based on SOCKS encryption.</p> </dd> </dl> </dd> <dt id="protocolAuthentication-basic-ntlm"><b>protocolAuthentication</b> = basic | ntlm</dt> <dd> <p>authentication type for protocol negotiations</p> <p>Currently authentication type only applies to the 'connect' protocol.</p> <p>default: basic</p> </dd> <dt id="protocolHost-HOST:PORT"><b>protocolHost</b> = HOST:PORT</dt> <dd> <p>destination address for protocol negotiations</p> <p><i>protocolHost</i> specifies the final SSL server to be connected by the proxy, and not the proxy server directly connected by <b>stunnel</b>. The proxy server should be specified with the 'connect' option.</p> <p>Currently protocol destination address only applies to 'connect' protocol.</p> </dd> <dt id="protocolPassword-PASSWORD"><b>protocolPassword</b> = PASSWORD</dt> <dd> <p>password for protocol negotiations</p> </dd> <dt id="protocolUsername-USERNAME"><b>protocolUsername</b> = USERNAME</dt> <dd> <p>username for protocol negotiations</p> </dd> <dt id="pty-yes-no-Unix-only"><b>pty</b> = yes | no (Unix only)</dt> <dd> <p>allocate pseudoterminal for 'exec' option</p> </dd> <dt id="redirect-HOST:-PORT"><b>redirect</b> = [HOST:]PORT</dt> <dd> <p>redirect SSL client connections on authentication failures</p> <p>This option only works in server mode, and without protocol negotiation.</p> </dd> <dt id="renegotiation-yes-no"><b>renegotiation</b> = yes | no</dt> <dd> <p>support SSL renegotiation</p> <p>Applications of the SSL renegotiation include some authentication scenarios, or re-keying long lasting connections.</p> <p>On the other hand this feature can facilitate a trivial CPU-exhaustion DoS attack:</p> <p><i>http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html</i></p> <p>Please note that disabling SSL renegotiation does not fully mitigate this issue.</p> <p>default: yes (if supported by <b>OpenSSL</b>)</p> </dd> <dt id="reset-yes-no"><b>reset</b> = yes | no</dt> <dd> <p>attempt to use TCP RST flag to indicate an error</p> <p>This option is not supported on some platforms.</p> <p>default: yes</p> </dd> <dt id="retry-yes-no"><b>retry</b> = yes | no</dt> <dd> <p>reconnect a connect+exec section after it's disconnected</p> <p>default: no</p> </dd> <dt id="sessionCacheSize-NUM_ENTRIES"><b>sessionCacheSize</b> = NUM_ENTRIES</dt> <dd> <p>session cache size</p> <p><i>sessionCacheSize</i> specifies the maximum number of the internal session cache entries.</p> <p>The value of 0 can be used for unlimited size. It is not recommended for production use due to the risk of memory exhaustion DoS attack.</p> </dd> <dt id="sessionCacheTimeout-TIMEOUT"><b>sessionCacheTimeout</b> = TIMEOUT</dt> <dd> <p>session cache timeout</p> <p>This is the number of seconds to keep cached SSL sessions.</p> </dd> <dt id="sessiond-HOST:PORT"><b>sessiond</b> = HOST:PORT</dt> <dd> <p>address of sessiond SSL cache server</p> </dd> <dt id="sslVersion-SSL_VERSION"><b>sslVersion</b> = SSL_VERSION</dt> <dd> <p>select the SSL protocol version</p> <p>Allowed values: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2</p> </dd> <dt id="stack-BYTES-except-for-FORK-model"><b>stack</b> = BYTES (except for FORK model)</dt> <dd> <p>thread stack size</p> </dd> <dt id="TIMEOUTbusy-SECONDS"><b>TIMEOUTbusy</b> = SECONDS</dt> <dd> <p>time to wait for expected data</p> </dd> <dt id="TIMEOUTclose-SECONDS"><b>TIMEOUTclose</b> = SECONDS</dt> <dd> <p>time to wait for close_notify (set to 0 for buggy MSIE)</p> </dd> <dt id="TIMEOUTconnect-SECONDS"><b>TIMEOUTconnect</b> = SECONDS</dt> <dd> <p>time to wait to connect a remote host</p> </dd> <dt id="TIMEOUTidle-SECONDS"><b>TIMEOUTidle</b> = SECONDS</dt> <dd> <p>time to keep an idle connection</p> </dd> <dt id="transparent-none-source-destination-both-Unix-only"><b>transparent</b> = none | source | destination | both (Unix only)</dt> <dd> <p>enable transparent proxy support on selected platforms</p> <p>Supported values:</p> <dl> <dt id="none"><i>none</i></dt> <dd> <p>Disable transparent proxy support. This is the default.</p> </dd> <dt id="source"><i>source</i></dt> <dd> <p>Re-write address to appear as if wrapped daemon is connecting from the SSL client machine instead of the machine running <b>stunnel</b>.</p> <p>This option is currently available in:</p> <dl> <dt id="Remote-mode-connect-option-on-Linux-2.6.28">Remote mode (<i>connect</i> option) on <i>Linux >=2.6.28</i></dt> <dd> <p>This configuration requires <b>stunnel</b> to be executed as root and without <i>setuid</i> option.</p> <p>This configuration requires the following setup for iptables and routing (possibly in /etc/rc.local or equivalent file):</p> <pre><code> iptables -t mangle -N DIVERT iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT ip rule add fwmark 1 lookup 100 ip route add local 0.0.0.0/0 dev lo table 100 echo 0 >/proc/sys/net/ipv4/conf/lo/rp_filter</code></pre> <p><b>stunnel</b> must also to be executed as root and without <i>setuid</i> option.</p> </dd> <dt id="Remote-mode-connect-option-on-Linux-2.2.x">Remote mode (<i>connect</i> option) on <i>Linux 2.2.x</i></dt> <dd> <p>This configuration requires kernel to be compiled with <i>transparent proxy</i> option. Connected service must be installed on a separate host. Routing towards the clients has to go through the <b>stunnel</b> box.</p> <p><b>stunnel</b> must also to be executed as root and without <i>setuid</i> option.</p> </dd> <dt id="Remote-mode-connect-option-on-FreeBSD-8.0">Remote mode (<i>connect</i> option) on <i>FreeBSD >=8.0</i></dt> <dd> <p>This configuration requires additional firewall and routing setup. <b>stunnel</b> must also to be executed as root and without <i>setuid</i> option.</p> </dd> <dt id="Local-mode-exec-option">Local mode (<i>exec</i> option)</dt> <dd> <p>This configuration works by pre-loading <i>libstunnel.so</i> shared library. _RLD_LIST environment variable is used on Tru64, and LD_PRELOAD variable on other platforms.</p> </dd> </dl> </dd> <dt id="destination"><i>destination</i></dt> <dd> <p>Original destination is used instead of <i>connect</i> option.</p> <p>A service section for transparent destination may look like this:</p> <pre><code> [transparent] client=yes accept=<stunnel_port> transparent=destination</code></pre> <p>This configuration requires iptables setup to work, possibly in /etc/rc.local or equivalent file.</p> <p>For a connect target installed on the same host:</p> <pre><code> /sbin/iptables -t nat -I OUTPUT -p tcp --dport <redirected_port> \ -m ! --uid-owner <stunnel_user_id> \ -j DNAT --to-destination <local_ip>:<stunnel_port></code></pre> <p>For a connect target installed on a remote host:</p> <pre><code> /sbin/iptables -I INPUT -i eth0 -p tcp --dport <stunnel_port> -j ACCEPT /sbin/iptables -t nat -I PREROUTING -p tcp --dport <redirected_port> \ -i eth0 -j DNAT --to-destination <local_ip>:<stunnel_port></code></pre> <p>Transparent destination option is currently only supported on Linux.</p> </dd> <dt id="both"><i>both</i></dt> <dd> <p>Use both <i>source</i> and <i>destination</i> transparent proxy.</p> </dd> </dl> <p>Two legacy options are also supported for backward compatibility:</p> <dl> <dt id="yes"><i>yes</i></dt> <dd> <p>This options has been renamed to <i>source</i>.</p> </dd> <dt id="no"><i>no</i></dt> <dd> <p>This options has been renamed to <i>none</i>.</p> </dd> </dl> </dd> <dt id="verify-LEVEL"><b>verify</b> = LEVEL</dt> <dd> <p>verify peer certificate</p> <dl> <dt id="level-0">level 0</dt> <dd> <p>Request and ignore peer certificate.</p> </dd> <dt id="level-1">level 1</dt> <dd> <p>Verify peer certificate if present.</p> </dd> <dt id="level-2">level 2</dt> <dd> <p>Verify peer certificate.</p> </dd> <dt id="level-3">level 3</dt> <dd> <p>Verify peer with locally installed certificate.</p> </dd> <dt id="level-4">level 4</dt> <dd> <p>Ignore CA chain and only verify peer certificate.</p> </dd> <dt id="default">default</dt> <dd> <p>No verify.</p> </dd> </dl> <p>It is important to understand, that this option was solely designed for access control and not for authorization. Specifically for level 2 every non-revoked certificate is accepted regardless of its Common Name. For this reason a dedicated CA should be used with level 2, and not a generic CA commonly used for webservers. Level 3 is preferred for point-to-point connections.</p> </dd> </dl> <h1 id="RETURN-VALUE">RETURN VALUE</h1> <p><b>stunnel</b> returns zero on success, non-zero on error.</p> <h1 id="SIGNALS">SIGNALS</h1> <p>The following signals can be used to control <b>stunnel</b> in Unix environment:</p> <dl> <dt id="SIGHUP">SIGHUP</dt> <dd> <p>Force a reload of the configuration file.</p> <p>Some global options will not be reloaded:</p> <ul> <li><p>chroot</p> </li> <li><p>foreground</p> </li> <li><p>pid</p> </li> <li><p>setgid</p> </li> <li><p>setuid</p> </li> </ul> <p>The use of 'setuid' option will also prevent <b>stunnel</b> from binding privileged (<1024) ports during configuration reloading.</p> <p>When 'chroot' option is used, <b>stunnel</b> will look for all its files (including configuration file, certificates, log file and pid file) within the chroot jail.</p> </dd> <dt id="SIGUSR1">SIGUSR1</dt> <dd> <p>Close and reopen <b>stunnel</b> log file. This function can be used for log rotation.</p> </dd> <dt id="SIGTERM-SIGQUIT-SIGINT">SIGTERM, SIGQUIT, SIGINT</dt> <dd> <p>Shut <b>stunnel</b> down.</p> </dd> </dl> <p>The result of sending any other signals to the server is undefined.</p> <h1 id="EXAMPLES">EXAMPLES</h1> <p>In order to provide SSL encapsulation to your local <i>imapd</i> service, use:</p> <pre><code> [imapd] accept = 993 exec = /usr/sbin/imapd execargs = imapd</code></pre> <p>or in remote mode:</p> <pre><code> [imapd] accept = 993 connect = 143</code></pre> <p>In order to let your local e-mail client connect to an SSL-enabled <i>imapd</i> service on another server, configure the e-mail client to connect to localhost on port 119 and use:</p> <pre><code> [imap] client = yes accept = 143 connect = servername:993</code></pre> <p>If you want to provide tunneling to your <i>pppd</i> daemon on port 2020, use something like:</p> <pre><code> [vpn] accept = 2020 exec = /usr/sbin/pppd execargs = pppd local pty = yes</code></pre> <p>If you want to use <b>stunnel</b> in <i>inetd</i> mode to launch your imapd process, you'd use this <i>stunnel.conf</i>. Note there must be no <i>[service_name]</i> section.</p> <pre><code> exec = /usr/sbin/imapd execargs = imapd</code></pre> <p>To setup SOCKS VPN configure the following client service:</p> <pre><code> [socks_client] client = yes accept = 127.0.0.1:1080 connect = vpn_server:9080 verify = 4 CAfile = stunnel.pem</code></pre> <p>The corresponding configuration on the vpn_server host:</p> <pre><code> [socks_server] protocol = socks accept = 9080 cert = stunnel.pem key = stunnel.key</code></pre> <p>Now test your configuration on the client machine with:</p> <pre><code> curl --socks4a localhost http://www.example.com/</code></pre> <h1 id="NOTES">NOTES</h1> <h2 id="RESTRICTIONS">RESTRICTIONS</h2> <p><b>stunnel</b> cannot be used for the FTP daemon because of the nature of the FTP protocol which utilizes multiple ports for data transfers. There are available SSL-enabled versions of FTP and telnet daemons, however.</p> <h2 id="INETD-MODE">INETD MODE</h2> <p>The most common use of <b>stunnel</b> is to listen on a network port and establish communication with either a new port via the connect option, or a new program via the <i>exec</i> option. However there is a special case when you wish to have some other program accept incoming connections and launch <b>stunnel</b>, for example with <i>inetd</i>, <i>xinetd</i>, or <i>tcpserver</i>.</p> <p>For example, if you have the following line in <i>inetd.conf</i>:</p> <pre><code> imaps stream tcp nowait root /usr/bin/stunnel stunnel /etc/stunnel/imaps.conf</code></pre> <p>In these cases, the <i>inetd</i>-style program is responsible for binding a network socket (<i>imaps</i> above) and handing it to <b>stunnel</b> when a connection is received. Thus you do not want <b>stunnel</b> to have any <i>accept</i> option. All the <i>Service Level Options</i> should be placed in the global options section, and no <i>[service_name]</i> section will be present. See the <i>EXAMPLES</i> section for example configurations.</p> <h2 id="CERTIFICATES">CERTIFICATES</h2> <p>Each SSL-enabled daemon needs to present a valid X.509 certificate to the peer. It also needs a private key to decrypt the incoming data. The easiest way to obtain a certificate and a key is to generate them with the free <b>OpenSSL</b> package. You can find more information on certificates generation on pages listed below.</p> <p>The order of contents of the <i>.pem</i> file is important. It should contain the unencrypted private key first, then a signed certificate (not certificate request). There should be also empty lines after certificate and private key. Plaintext certificate information appended on the top of generated certificate should be discarded. So the file should look like this:</p> <pre><code> -----BEGIN RSA PRIVATE KEY----- [encoded key] -----END RSA PRIVATE KEY----- [empty line] -----BEGIN CERTIFICATE----- [encoded certificate] -----END CERTIFICATE----- [empty line]</code></pre> <h2 id="RANDOMNESS">RANDOMNESS</h2> <p><b>stunnel</b> needs to seed the PRNG (pseudo random number generator) in order for SSL to use good randomness. The following sources are loaded in order until sufficient random data has been gathered:</p> <ul> <li><p>The file specified with the <i>RNDfile</i> flag.</p> </li> <li><p>The file specified by the RANDFILE environment variable, if set.</p> </li> <li><p>The file .rnd in your home directory, if RANDFILE not set.</p> </li> <li><p>The file specified with '--with-random' at compile time.</p> </li> <li><p>The contents of the screen if running on Windows.</p> </li> <li><p>The egd socket specified with the <i>EGD</i> flag.</p> </li> <li><p>The egd socket specified with '--with-egd-sock' at compile time.</p> </li> <li><p>The /dev/urandom device.</p> </li> </ul> <p>With recent (<b>OpenSSL 0.9.5a</b> or later) version of SSL it will stop loading random data automatically when sufficient entropy has been gathered. With previous versions it will continue to gather from all the above sources since no SSL function exists to tell when enough data is available.</p> <p>Note that on Windows machines that do not have console user interaction (mouse movements, creating windows, etc.) the screen contents are not variable enough to be sufficient, and you should provide a random file for use with the <i>RNDfile</i> flag.</p> <p>Note that the file specified with the <i>RNDfile</i> flag should contain random data -- that means it should contain different information each time <b>stunnel</b> is run. This is handled automatically unless the <i>RNDoverwrite</i> flag is used. If you wish to update this file manually, the <i>openssl rand</i> command in recent versions of <b>OpenSSL</b>, would be useful.</p> <p>Important note: If /dev/urandom is available, <b>OpenSSL</b> often seeds the PRNG with it while checking the random state. On systems with /dev/urandom <b>OpenSSL</b> is likely to use it even though it is listed at the very bottom of the list above. This is the behaviour of <b>OpenSSL</b> and not <b>stunnel</b>.</p> <h2 id="DH-PARAMETERS">DH PARAMETERS</h2> <p>Stunnel 4.40 and later contains hardcoded 2048-bit DH parameters.</p> <p>It is also possible to specify DH parameters in the certificate file:</p> <pre><code> openssl dhparam 2048 >> stunnel.pem</code></pre> <p>DH parameter generation may take several minutes.</p> <h1 id="FILES">FILES</h1> <dl> <dt id="stunnel.conf"><i>stunnel.conf</i></dt> <dd> <p><b>stunnel</b> configuration file</p> </dd> </dl> <h1 id="BUGS">BUGS</h1> <p>Option <i>execargs</i> and Win32 command line does not support quoting.</p> <h1 id="SEE-ALSO">SEE ALSO</h1> <dl> <dt id="tcpd-8"><a href="http://man.he.net/man8/tcpd">tcpd(8)</a></dt> <dd> <p>access control facility for internet services</p> </dd> <dt id="inetd-8"><a href="http://man.he.net/man8/inetd">inetd(8)</a></dt> <dd> <p>internet 'super-server'</p> </dd> <dt id="http:-www.stunnel.org"><i>http://www.stunnel.org/</i></dt> <dd> <p><b>stunnel</b> homepage</p> </dd> <dt id="http:-www.openssl.org"><i>http://www.openssl.org/</i></dt> <dd> <p><b>OpenSSL</b> project website</p> </dd> </dl> <h1 id="AUTHOR">AUTHOR</h1> <dl> <dt id="Micha-Trojnara">Michał Trojnara</dt> <dd> <p><<i>Michal.Trojnara@mirt.net</i>></p> </dd> </dl> </body> </html>