Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > 37d2bab7e7eb9122b08a703d1cea3450 > files > 27

stunnel-4.21-2mdv2008.1.x86_64.rpm

<?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">

<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#options">OPTIONS</a></li>
	<li><a href="#configuration_file">CONFIGURATION FILE</a></li>
	<ul>

		<li><a href="#global_options">GLOBAL OPTIONS</a></li>
		<li><a href="#servicelevel_options">SERVICE-LEVEL OPTIONS</a></li>
	</ul>

	<li><a href="#return_value">RETURN VALUE</a></li>
	<li><a href="#examples">EXAMPLES</a></li>
	<li><a href="#files">FILES</a></li>
	<li><a href="#bugs">BUGS</a></li>
	<li><a href="#restrictions">RESTRICTIONS</a></li>
	<li><a href="#notes">NOTES</a></li>
	<ul>

		<li><a href="#inetd_mode">INETD MODE</a></li>
		<li><a href="#certificates">CERTIFICATES</a></li>
		<li><a href="#randomness">RANDOMNESS</a></li>
	</ul>

	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>stunnel - universal SSL tunnel</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<dl>
<dt><strong><a name="item_unix_3a"><strong>Unix:</strong></a></strong>

<dd>
<p><strong>stunnel</strong> [&lt;filename&gt;] | -fd&nbsp;n | -help | -version | -sockets</p>
</dd>
</li>
<dt><strong><a name="item_win32_3a"><strong>WIN32:</strong></a></strong>

<dd>
<p><strong>stunnel</strong> [ [-install | -uninstall | -start | -stop]
    [-quiet] [&lt;filename&gt;] ] | -help | -version | -sockets</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>stunnel</strong> program is designed to work as <em>SSL</em> encryption wrapper 
between remote clients and local (<em>inetd</em>-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><strong>stunnel</strong> can be used to add SSL functionality to commonly used <em>Inetd</em>
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 (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>)</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<dl>
<dt><strong><a name="item__3cfilename_3e">&lt;<strong>filename</strong>&gt;</a></strong>

<dd>
<p>Use specified configuration file</p>
</dd>
</li>
<dt><strong><a name="item_n"><strong>-fd n</strong> (Unix only)</a></strong>

<dd>
<p>Read the config file from specified file descriptor</p>
</dd>
</li>
<dt><strong><a name="item__2dhelp"><strong>-help</strong></a></strong>

<dd>
<p>Print <strong>stunnel</strong> help menu</p>
</dd>
</li>
<dt><strong><a name="item__2dversion"><strong>-version</strong></a></strong>

<dd>
<p>Print <strong>stunnel</strong> version and compile time defaults</p>
</dd>
</li>
<dt><strong><a name="item__2dsockets"><strong>-sockets</strong></a></strong>

<dd>
<p>Print default socket options</p>
</dd>
</li>
<dt><strong><a name="item_install"><strong>-install</strong> (NT/2000/XP only)</a></strong>

<dd>
<p>Install NT Service</p>
</dd>
</li>
<dt><strong><a name="item_uninstall"><strong>-uninstall</strong> (NT/2000/XP only)</a></strong>

<dd>
<p>Uninstall NT Service</p>
</dd>
</li>
<dt><strong><a name="item_start"><strong>-start</strong> (NT/2000/XP only)</a></strong>

<dd>
<p>Start NT Service</p>
</dd>
</li>
<dt><strong><a name="item_stop"><strong>-stop</strong> (NT/2000/XP only)</a></strong>

<dd>
<p>Stop NT Service</p>
</dd>
</li>
<dt><strong><a name="item_quiet"><strong>-quiet</strong> (NT/2000/XP only)</a></strong>

<dd>
<p>Don't display a message box when successfully installed or uninstalled NT service</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="configuration_file">CONFIGURATION FILE</a></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>
</p>
<h2><a name="global_options">GLOBAL OPTIONS</a></h2>
<dl>
<dt><strong><a name="item_directory"><strong>chroot</strong> = directory (Unix only)</a></strong>

<dd>
<p>directory to chroot <strong>stunnel</strong> process</p>
</dd>
<dd>
<p><strong>chroot</strong> keeps <strong>stunnel</strong> in chrooted jail.  <em>CApath</em>, <em>CRLpath</em>, <em>pid</em>
and <em>exec</em> are located inside the jail and the patches have to be relative
to the directory specified with <strong>chroot</strong>.</p>
</dd>
<dd>
<p>To have libwrap (TCP Wrappers) control effective in a chrooted environment
you also have to copy its configuration files (/etc/hosts.allow and
/etc/hosts.deny) there.</p>
</dd>
</li>
<dt><strong><a name="item_compression__3d_zlib__7c_rle"><strong>compression</strong> = zlib | rle</a></strong>

<dd>
<p>select data compression algorithm</p>
</dd>
<dd>
<p>default: no compression</p>
</dd>
</li>
<dt><strong><a name="item_debug__3d__5bfacility_2e_5dlevel"><strong>debug</strong> = [facility.]level</a></strong>

<dd>
<p>debugging level</p>
</dd>
<dd>
<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 <strong>debug = debug</strong> or
<strong>debug = 7</strong> for greatest debugging output.  The default is notice (5).</p>
</dd>
<dd>
<p>The syslog facility 'authpriv' will be used unless a facility name is supplied.
(Facilities are not supported on Win32.)</p>
</dd>
<dd>
<p>Case is ignored for both facilities and levels.</p>
</dd>
</li>
<dt><strong><a name="item_path"><strong>EGD</strong> = egd path (Unix only)</a></strong>

<dd>
<p>path to Entropy Gathering Daemon socket</p>
</dd>
<dd>
<p>Entropy Gathering Daemon socket to use to feed OpenSSL random number
generator.  (Available only if compiled with OpenSSL 0.9.5a or higher)</p>
</dd>
</li>
<dt><strong><a name="item_engine__3d_auto__7c__3cengine_id_3e"><strong>engine</strong> = auto | &lt;engine id&gt;</a></strong>

<dd>
<p>select hardware engine</p>
</dd>
<dd>
<p>default: software-only cryptography</p>
</dd>
<dd>
<p>There's an example in 'EXAMPLES' section.</p>
</dd>
</li>
<dt><strong><a name="item_enginectrl__3d_command_5b_3aparameter_5d"><strong>engineCtrl</strong> = command[:parameter]</a></strong>

<dd>
<p>control hardware engine</p>
</dd>
<dd>
<p>Special commands ``LOAD'' and ``INIT'' can be used to load and initialize the
engine cryptogaphic module.</p>
</dd>
</li>
<dt><strong><a name="item_no"><strong>foreground</strong> = yes | no (Unix only)</a></strong>

<dd>
<p>foreground mode</p>
</dd>
<dd>
<p>Stay in foreground (don't fork) and log to stderr
instead of via syslog (unless <strong>output</strong> is specified).</p>
</dd>
<dd>
<p>default: background in daemon mode</p>
</dd>
</li>
<dt><strong><a name="item_output__3d_file"><strong>output</strong> = file</a></strong>

<dd>
<p>append log messages to a file instead of using syslog</p>
</dd>
<dd>
<p>/dev/stdout device can be used to redirect log messages to the standard
output (for example to log them with daemontools splogger).</p>
</dd>
</li>
<dt><strong><a name="item_file"><strong>pid</strong> = file (Unix only)</a></strong>

<dd>
<p>pid file location</p>
</dd>
<dd>
<p>If the argument is empty, then no pid file will be created.</p>
</dd>
<dd>
<p><em>pid</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
</li>
<dt><strong><a name="item_rndbytes__3d_bytes"><strong>RNDbytes</strong> = bytes</a></strong>

<dd>
<p>bytes to read from random seed files</p>
</dd>
<dd>
<p>Number of bytes of data read from random seed files.  With SSL versions
less than 0.9.5a, also determines how many bytes of data are considered
sufficient to seed the PRNG.  More recent OpenSSL versions have a builtin
function to determine when sufficient randomness is available.</p>
</dd>
</li>
<dt><strong><a name="item_rndfile__3d_file"><strong>RNDfile</strong> = file</a></strong>

<dd>
<p>path to file with random seed data</p>
</dd>
<dd>
<p>The SSL library will use data from this file first to seed the random
number generator.</p>
</dd>
</li>
<dt><strong><a name="item_rndoverwrite__3d_yes__7c_no"><strong>RNDoverwrite</strong> = yes | no</a></strong>

<dd>
<p>overwrite the random seed files with new random data</p>
</dd>
<dd>
<p>default: yes</p>
</dd>
</li>
<dt><strong><a name="item_service__3d_servicename"><strong>service</strong> = servicename</a></strong>

<dd>
<p>use specified string as the service name</p>
</dd>
<dd>
<p><strong>On Unix:</strong> <em>inetd</em> mode service name for TCP Wrapper library.</p>
</dd>
<dd>
<p><strong>On NT/2000/XP:</strong> NT service name in the Control Panel.</p>
</dd>
<dd>
<p>default: stunnel</p>
</dd>
</li>
<dt><strong><a name="item_groupname"><strong>setgid</strong> = groupname (Unix only)</a></strong>

<dd>
<p><code>setgid()</code> to groupname in daemon mode and clears all other groups</p>
</dd>
</li>
<dt><strong><a name="item_username"><strong>setuid</strong> = username (Unix only)</a></strong>

<dd>
<p><code>setuid()</code> to username in daemon mode</p>
</dd>
</li>
<dt><strong><a name="item_socket__3d_a_7cl_7cr_3aoption_3dvalue_5b_3avalue_5"><strong>socket</strong> = a|l|r:option=value[:value]</a></strong>

<dd>
<p>Set an option on accept/local/remote socket</p>
</dd>
<dd>
<p>The values for linger option are l_onof:l_linger.
The values for time are tv_sec:tv_usec.</p>
</dd>
<dd>
<p>Examples:</p>
</dd>
<dd>
<pre>
    socket = l:SO_LINGER=1:60
        set one minute timeout for closing local socket
    socket = r:TCP_NODELAY=1
        turn off the Nagle algorithm for remote sockets
    socket = r:SO_OOBINLINE=1
        place out-of-band data directly into the
        receive data stream for remote sockets
    socket = a:SO_REUSEADDR=0
        disable address reuse (enabled by default)
    socket = a:SO_BINDTODEVICE=lo
        only accept connections on loopback interface</pre>
</dd>
</li>
<dt><strong><strong>taskbar</strong> = yes | no (WIN32 only)</strong>

<dd>
<p>enable the taskbar icon</p>
</dd>
<dd>
<p>default: yes</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="servicelevel_options">SERVICE-LEVEL OPTIONS</a></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 <strong>stunnel</strong> services in your log files.</p>
<p>Note that if you wish to run <strong>stunnel</strong> in <em>inetd</em> mode (where it
is provided a network socket by a server such as <em>inetd</em>, <em>xinetd</em>,
or <em>tcpserver</em>) then you should read the section entitled <em>INETD MODE</em>
below.</p>
<dl>
<dt><strong><a name="item_accept__3d__5bhost_3a_5dport"><strong>accept</strong> = [host:]port</a></strong>

<dd>
<p>accept connections on specified host:port</p>
</dd>
<dd>
<p>If no host specified, defaults to all IP addresses for the local host.</p>
</dd>
</li>
<dt><strong><a name="item_capath__3d_directory"><strong>CApath</strong> = directory</a></strong>

<dd>
<p>Certificate Authority directory</p>
</dd>
<dd>
<p>This is the directory in which <strong>stunnel</strong> will look for certificates when using
the <em>verify</em>. 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 (the first 4 bytes of the MD5 hash in least significant byte order).</p>
</dd>
<dd>
<p><em>CApath</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
</li>
<dt><strong><a name="item_cafile__3d_certfile"><strong>CAfile</strong> = certfile</a></strong>

<dd>
<p>Certificate Authority file</p>
</dd>
<dd>
<p>This file contains multiple CA certificates, used with the <em>verify</em>.</p>
</dd>
</li>
<dt><strong><a name="item_cert__3d_pemfile"><strong>cert</strong> = pemfile</a></strong>

<dd>
<p>certificate chain PEM file name</p>
</dd>
<dd>
<p>A PEM is always needed in server mode.
Specifying this flag in client mode will use this certificate chain
as a client side certificate chain.  Using client side certs is optional.
The certificates must be in PEM format and must be sorted starting with the
certificate to the highest level (root CA).</p>
</dd>
</li>
<dt><strong><a name="item_ciphers__3d_cipherlist"><strong>ciphers</strong> = cipherlist</a></strong>

<dd>
<p>Select permitted SSL ciphers</p>
</dd>
<dd>
<p>A colon delimited list of the ciphers to allow in the SSL connection.
For example DES-CBC3-SHA:IDEA-CBC-MD5</p>
</dd>
</li>
<dt><strong><a name="item_client__3d_yes__7c_no"><strong>client</strong> = yes | no</a></strong>

<dd>
<p>client mode (remote service uses SSL)</p>
</dd>
<dd>
<p>default: no (server mode)</p>
</dd>
</li>
<dt><strong><a name="item_connect__3d__5bhost_3a_5dport"><strong>connect</strong> = [host:]port</a></strong>

<dd>
<p>connect to a remote host:port</p>
</dd>
<dd>
<p>If no host is specified, the host defaults to localhost.</p>
</dd>
<dd>
<p>Multiple <strong>connect</strong> options are allowed in a single service section.</p>
</dd>
<dd>
<p>If host resolves to multiple addresses and/or if multiple <strong>connect</strong>
options are specified, then the remote address is chosen using a
round-robin algorithm.</p>
</dd>
</li>
<dt><strong><a name="item_crlpath__3d_directory"><strong>CRLpath</strong> = directory</a></strong>

<dd>
<p>Certificate Revocation Lists directory</p>
</dd>
<dd>
<p>This is the directory in which <strong>stunnel</strong> will look for CRLs when
using the <em>verify</em>. Note that the CRLs in this directory should
be named XXXXXXXX.0 where XXXXXXXX is the hash value of the CRL.</p>
</dd>
<dd>
<p><em>CRLpath</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
</li>
<dt><strong><a name="item_crlfile__3d_certfile"><strong>CRLfile</strong> = certfile</a></strong>

<dd>
<p>Certificate Revocation Lists file</p>
</dd>
<dd>
<p>This file contains multiple CRLs, used with the <em>verify</em>.</p>
</dd>
</li>
<dt><strong><a name="item_delay__3d_yes__7c_no"><strong>delay</strong> = yes | no</a></strong>

<dd>
<p>delay DNS lookup for 'connect' option</p>
</dd>
</li>
<dt><strong><a name="item_enginenum__3d_engine_number"><strong>engineNum</strong> = engine number</a></strong>

<dd>
<p>select engine number to read private key</p>
</dd>
<dd>
<p>The engines are numbered starting from 1.</p>
</dd>
</li>
<dt><strong><a name="item_executable_path"><strong>exec</strong> = executable_path (Unix only)</a></strong>

<dd>
<p>execute local inetd-type program</p>
</dd>
<dd>
<p><em>exec</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
</li>
<dt><strong><a name="item_execargs__3d__240__241__242__2e_2e_2e__28unix_only"><strong>execargs</strong> = $0 $1 $2 ... (Unix only)</a></strong>

<dd>
<p>arguments for <em>exec</em> including program name ($0)</p>
</dd>
<dd>
<p>Quoting is currently not supported.
Arguments are separated with arbitrary number of whitespaces.</p>
</dd>
</li>
<dt><strong><a name="item_ident__3d_username"><strong>ident</strong> = username</a></strong>

<dd>
<p>use IDENT (RFC 1413) username checking</p>
</dd>
</li>
<dt><strong><a name="item_key__3d_keyfile"><strong>key</strong> = keyfile</a></strong>

<dd>
<p>private key for certificate specified with <em>cert</em> option</p>
</dd>
<dd>
<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>
</dd>
<dd>
<pre>
    chmod 600 keyfile</pre>
</dd>
<dd>
<p>default: value of <em>cert</em> option</p>
</dd>
</li>
<dt><strong><a name="item_local__3d_host"><strong>local</strong> = host</a></strong>

<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>
</li>
<dt><strong><a name="item_ocsp__3d_url"><strong>OCSP</strong> = url</a></strong>

<dd>
<p>select OCSP server for certificate verification</p>
</dd>
</li>
<dt><strong><a name="item_ocspflag__3d_flag"><strong>OCSPflag</strong> = flag</a></strong>

<dd>
<p>specify OCSP server flag</p>
</dd>
<dd>
<p>Several <em>OCSPflag</em> can be used to specify multiple flags.</p>
</dd>
<dd>
<p>currently supported flags: NOCERTS, NOINTERN NOSIGS, NOCHAIN, NOVERIFY,
NOEXPLICIT, NOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPID_KEY, NOTIME</p>
</dd>
</li>
<dt><strong><a name="item_options__3d_ssl_options"><strong>options</strong> = SSL_options</a></strong>

<dd>
<p>OpenSSL library options</p>
</dd>
<dd>
<p>The parameter is the OpenSSL option name as described in the
<em>SSL_CTX_set_options(3ssl)</em> manual, but without <em>SSL_OP_</em> prefix.
Several <em>options</em> can be used to specify multiple options.</p>
</dd>
<dd>
<p>For example for compatibility with erroneous Eudora SSL implementation
the following option can be used:</p>
</dd>
<dd>
<pre>
    options = DONT_INSERT_EMPTY_FRAGMENTS</pre>
</dd>
</li>
<dt><strong><a name="item_protocol__3d_proto"><strong>protocol</strong> = proto</a></strong>

<dd>
<p>application protocol to negotiate SSL</p>
</dd>
<dd>
<p>currently supported: cifs, connect, imap, nntp, pop3, smtp</p>
</dd>
</li>
<dt><strong><a name="item_protocolauthentication__3d_auth_type"><strong>protocolAuthentication</strong> = auth_type</a></strong>

<dd>
<p>authentication type for protocol negotiations</p>
</dd>
<dd>
<p>currently supported: basic, NTLM</p>
</dd>
<dd>
<p>Currently authentication type only applies to 'connect' protocol.</p>
</dd>
<dd>
<p>default: basic</p>
</dd>
</li>
<dt><strong><a name="item_protocolhost__3d_host_3aport"><strong>protocolHost</strong> = host:port</a></strong>

<dd>
<p>destination address for protocol negotiations</p>
</dd>
</li>
<dt><strong><a name="item_protocolpassword__3d_password"><strong>protocolPassword</strong> = password</a></strong>

<dd>
<p>password for protocol negotiations</p>
</dd>
</li>
<dt><strong><a name="item_protocolusername__3d_username"><strong>protocolUsername</strong> = username</a></strong>

<dd>
<p>username for protocol negotiations</p>
</dd>
</li>
<dt><strong><strong>pty</strong> = yes | no (Unix only)</strong>

<dd>
<p>allocate pseudo terminal for 'exec' option</p>
</dd>
</li>
<dt><strong><strong>retry</strong> = yes | no (Unix only)</strong>

<dd>
<p>reconnect a connect+exec section after it's disconnected</p>
</dd>
<dd>
<p>default: no</p>
</dd>
</li>
<dt><strong><a name="item_session__3d_timeout"><strong>session</strong> = timeout</a></strong>

<dd>
<p>session cache timeout</p>
</dd>
</li>
<dt><strong><a name="item_sslversion__3d_version"><strong>sslVersion</strong> = version</a></strong>

<dd>
<p>select version of SSL protocol</p>
</dd>
<dd>
<p>Allowed options: all, SSLv2, SSLv3, TLSv1</p>
</dd>
</li>
<dt><strong><a name="item_timeoutbusy__3d_seconds"><strong>TIMEOUTbusy</strong> = seconds</a></strong>

<dd>
<p>time to wait for expected data</p>
</dd>
</li>
<dt><strong><a name="item_timeoutclose__3d_seconds"><strong>TIMEOUTclose</strong> = seconds</a></strong>

<dd>
<p>time to wait for close_notify (set to 0 for buggy MSIE)</p>
</dd>
</li>
<dt><strong><a name="item_timeoutconnect__3d_seconds"><strong>TIMEOUTconnect</strong> = seconds</a></strong>

<dd>
<p>time to wait to connect a remote host</p>
</dd>
</li>
<dt><strong><a name="item_timeoutidle__3d_seconds"><strong>TIMEOUTidle</strong> = seconds</a></strong>

<dd>
<p>time to keep an idle connection</p>
</dd>
</li>
<dt><strong><strong>transparent</strong> = yes | no (Unix only)</strong>

<dd>
<p>transparent proxy mode</p>
</dd>
<dd>
<p>Re-write address to appear as if wrapped daemon is connecting
from the SSL client machine instead of the machine running <strong>stunnel</strong>.
This option is only available in local mode (<em>exec</em> option)
by LD_PRELOADing env.so shared library or in remote mode (<em>connect</em>
option) on Linux 2.2 kernel compiled with <em>transparent proxy</em> option
and then only in server mode. Note that this option will not combine
with proxy mode (<em>connect</em>) unless the client's default route to the target
machine lies through the host running <strong>stunnel</strong>, which cannot be localhost.</p>
</dd>
</li>
<dt><strong><a name="item_verify__3d_level"><strong>verify</strong> = level</a></strong>

<dd>
<p>verify peer certificate</p>
</dd>
<dd>
<pre>
    level 1 - verify peer certificate if present
    level 2 - verify peer certificate
    level 3 - verify peer with locally installed certificate
    default - no verify</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="return_value">RETURN VALUE</a></h1>
<p><strong>stunnel</strong> returns zero on success, non-zero on error.</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>In order to provide SSL encapsulation to your local <em>imapd</em> service, use</p>
<pre>
    [imapd]
    accept = 993
    exec = /usr/sbin/imapd
    execargs = imapd</pre>
<p>If you want to provide tunneling to your <em>pppd</em> daemon on port 2020,
use something like</p>
<pre>
    [vpn]
    accept = 2020
    exec = /usr/sbin/pppd
    execargs = pppd local
    pty = yes</pre>
<p>If you want to use <strong>stunnel</strong> in <em>inetd</em> mode to launch your imapd
process, you'd use this <em>stunnel.conf</em>.
Note there must be no <em>[service_name]</em> section.</p>
<pre>
    exec = /usr/sbin/imapd
    execargs = imapd</pre>
<p>Here is an example of advanced engine configuration to read private key from an
OpenSC engine</p>
<pre>
    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</pre>
<pre>
    [service]
    engineNum=1
    key=id_45</pre>
<p>
</p>
<hr />
<h1><a name="files">FILES</a></h1>
<dl>
<dt><strong><a name="item_stunnel_2econf"><em>stunnel.conf</em></a></strong>

<dd>
<p><strong>stunnel</strong> configuration file</p>
</dd>
</li>
<dt><strong><a name="item_stunnel_2epem"><em>stunnel.pem</em></a></strong>

<dd>
<p><strong>stunnel</strong> certificate and private key</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>Option <em>execargs</em> does not support quoting.</p>
<p>
</p>
<hr />
<h1><a name="restrictions">RESTRICTIONS</a></h1>
<p><strong>stunnel</strong> 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>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>
</p>
<h2><a name="inetd_mode">INETD MODE</a></h2>
<p>The most common use of <strong>stunnel</strong> 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 <em>exec</em> option.
However there is a special case when you wish to have
some other program accept incoming connections and
launch <strong>stunnel</strong>, for example with <em>inetd</em>, <em>xinetd</em>,
or <em>tcpserver</em>.</p>
<p>For example, if you have the following line in <em>inetd.conf</em>:</p>
<pre>
    imaps stream tcp nowait root /usr/bin/stunnel stunnel /etc/stunnel/imaps.conf</pre>
<p>In these cases, the <em>inetd</em>-style program is responsible
for binding a network socket (<em>imaps</em> above) and handing
it to <strong>stunnel</strong> when a connection is received.
Thus you do not want <strong>stunnel</strong> to have any <em>accept</em> option.
All the <em>Service Level Options</em> should be placed in the
global options section, and no <em>[service_name]</em> section
will be present.  See the <em>EXAMPLES</em> section for example
configurations.</p>
<p>
</p>
<h2><a name="certificates">CERTIFICATES</a></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 <em>OpenSSL</em> package. You can find more
information on certificates generation on pages listed below.</p>
<p>The order of contents of the <em>.pem</em> 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>
    -----BEGIN RSA PRIVATE KEY-----
    [encoded key]
    -----END RSA PRIVATE KEY-----
    [empty line]
    -----BEGIN CERTIFICATE-----
    [encoded certificate]
    -----END CERTIFICATE-----
    [empty line]</pre>
<p>
</p>
<h2><a name="randomness">RANDOMNESS</a></h2>
<p><strong>stunnel</strong> 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 <em>RNDfile</em> 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 <em>EGD</em> 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 (&gt;=OpenSSL 0.9.5a) 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 <em>RNDfile</em> flag.</p>
<p>Note that the file specified with the <em>RNDfile</em> flag should contain
random data -- that means it should contain different information
each time <strong>stunnel</strong> is run.  This is handled automatically
unless the <em>RNDoverwrite</em> flag is used.  If you wish to update this file
manually, the <em>openssl rand</em> command in recent versions of OpenSSL,
would be useful.</p>
<p>One important note -- if /dev/urandom is available, OpenSSL has a habit of
seeding the PRNG with it even when checking the random state, so on
systems with /dev/urandom you're likely to use it even though it's listed
at the very bottom of the list above.  This isn't <strong>stunnel's</strong> behaviour, it's
OpenSSLs.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<dl>
<dt><strong><a name="item_tcpd"><a href="#item_tcpd">tcpd(8)</a></a></strong>

<dd>
<p>access control facility for internet services</p>
</dd>
</li>
<dt><strong><a name="item_inetd"><a href="#item_inetd">inetd(8)</a></a></strong>

<dd>
<p>internet 'super-server'</p>
</dd>
</li>
<dt><strong><a name="item_http_3a_2f_2fstunnel_2emirt_2enet_2f"><em><a href="http://stunnel.mirt.net/">http://stunnel.mirt.net/</a></em></a></strong>

<dd>
<p><strong>stunnel</strong> homepage</p>
</dd>
</li>
<dt><strong><a name="item_http_3a_2f_2fwww_2estunnel_2eorg_2f"><em><a href="http://www.stunnel.org/">http://www.stunnel.org/</a></em></a></strong>

<dd>
<p><strong>stunnel</strong> Frequently Asked Questions</p>
</dd>
</li>
<dt><strong><a name="item_http_3a_2f_2fwww_2eopenssl_2eorg_2f"><em><a href="http://www.openssl.org/">http://www.openssl.org/</a></em></a></strong>

<dd>
<p>OpenSSL project website</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<dl>
<dt><strong><a name="item_michal_trojnara">Michal Trojnara</a></strong>

<dd>
<p>&lt;<em><a href="mailto:Michal.Trojnara@mirt.net">Michal.Trojnara@mirt.net</a></em>&gt;</p>
</dd>
</li>
</dl>

</body>

</html>