[2a7d6c3e] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[2a7d6c3e] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[423b1d94] | 7 | <!-- <!ENTITY stunnel-download-http "http://www.stunnel.org/download/stunnel/src/stunnel-&stunnel-version;.tar.gz"> -->
|
---|
| 8 | <!ENTITY stunnel-download-http " ">
|
---|
| 9 | <!ENTITY stunnel-download-ftp "ftp://stunnel.mirt.net/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
| 10 | <!ENTITY stunnel-md5sum "2077669b04c36e4c0baa68348e8860a7">
|
---|
| 11 | <!ENTITY stunnel-size "484 KB">
|
---|
[0ef1837] | 12 | <!ENTITY stunnel-buildsize "3.9 MB">
|
---|
[423b1d94] | 13 | <!ENTITY stunnel-time "0.10 SBU">
|
---|
[2a7d6c3e] | 14 | ]>
|
---|
| 15 |
|
---|
[0b5a693] | 16 | <sect1 id="stunnel" xreflabel="Stunnel-&stunnel-version;">
|
---|
[2a7d6c3e] | 17 | <sect1info>
|
---|
| 18 | <othername>$LastChangedBy$</othername>
|
---|
| 19 | <date>$Date$</date>
|
---|
| 20 | </sect1info>
|
---|
| 21 | <?dbhtml filename="stunnel.html"?>
|
---|
| 22 | <title>Stunnel-&stunnel-version;</title>
|
---|
[0b5a693] | 23 | <indexterm zone="stunnel">
|
---|
[6a2bce2] | 24 | <primary sortas="a-Stunnel">Stunnel</primary></indexterm>
|
---|
[2a7d6c3e] | 25 |
|
---|
| 26 | <sect2>
|
---|
| 27 | <title>Introduction to <application>Stunnel</application></title>
|
---|
| 28 |
|
---|
| 29 | <para>The <application>Stunnel</application> package contains a program that
|
---|
| 30 | allows you to encrypt arbitrary <acronym>TCP</acronym> connections inside
|
---|
| 31 | <acronym>SSL</acronym> (Secure Sockets Layer) so you can easily communicate
|
---|
| 32 | with clients over secure channels. <application>Stunnel</application> can be
|
---|
| 33 | used to add <acronym>SSL</acronym> functionality to commonly used Inetd
|
---|
| 34 | daemons like <acronym>POP</acronym>-2, <acronym>POP</acronym>-3, and
|
---|
| 35 | <acronym>IMAP</acronym> servers, to standalone daemons like
|
---|
| 36 | <acronym>NNTP</acronym>, <acronym>SMTP</acronym> and <acronym>HTTP</acronym>,
|
---|
| 37 | and in tunneling <acronym>PPP</acronym> over network sockets without changes
|
---|
| 38 | to the server package source code.</para>
|
---|
| 39 |
|
---|
| 40 | <sect3><title>Package information</title>
|
---|
| 41 | <itemizedlist spacing="compact">
|
---|
[0ef1837] | 42 | <listitem><para>Download (HTTP):
|
---|
| 43 | <ulink url="&stunnel-download-http;"/></para></listitem>
|
---|
| 44 | <listitem><para>Download (FTP):
|
---|
| 45 | <ulink url="&stunnel-download-ftp;"/></para></listitem>
|
---|
[90e2fb4e] | 46 | <listitem><para>Download MD5 sum:
|
---|
| 47 | &stunnel-md5sum;</para></listitem>
|
---|
[0ef1837] | 48 | <listitem><para>Download size:
|
---|
| 49 | &stunnel-size;</para></listitem>
|
---|
| 50 | <listitem><para>Estimated disk space required:
|
---|
| 51 | &stunnel-buildsize;</para></listitem>
|
---|
| 52 | <listitem><para>Estimated build time:
|
---|
| 53 | &stunnel-time;</para></listitem></itemizedlist>
|
---|
[2a7d6c3e] | 54 | </sect3>
|
---|
| 55 |
|
---|
[423b1d94] | 56 | <sect3><title>Additional downloads</title>
|
---|
| 57 | <itemizedlist spacing="compact">
|
---|
| 58 | <listitem><para>Required patch: <ulink
|
---|
| 59 | url="ftp://stunnel.mirt.net/stunnel/stunnel-&stunnel-version;-1_minute_sleep_fix.patch"/></para>
|
---|
| 60 | </listitem>
|
---|
| 61 | </itemizedlist>
|
---|
| 62 | </sect3>
|
---|
| 63 |
|
---|
[2a7d6c3e] | 64 | <sect3><title><application>Stunnel</application> dependencies</title>
|
---|
| 65 | <sect4><title>Required</title>
|
---|
[cef3a2f] | 66 | <para><xref linkend="openssl"/></para>
|
---|
[2a7d6c3e] | 67 | </sect4>
|
---|
| 68 |
|
---|
| 69 | <sect4><title>Optional</title>
|
---|
| 70 | <para><xref linkend="tcpwrappers"/></para>
|
---|
| 71 | </sect4>
|
---|
| 72 | </sect3>
|
---|
| 73 |
|
---|
| 74 | </sect2>
|
---|
| 75 |
|
---|
| 76 | <sect2>
|
---|
| 77 | <title>Installation of <application>Stunnel</application></title>
|
---|
| 78 |
|
---|
| 79 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
| 80 | <command>chroot</command> jail by an unprivileged user. Create the new user,
|
---|
| 81 | group and <command>chroot</command> home directory structure using the
|
---|
[305e60de] | 82 | following commands as the root user:</para>
|
---|
[2a7d6c3e] | 83 |
|
---|
[305e60de] | 84 | <screen><userinput role='root'><command>groupadd stunnel &&
|
---|
[8d9eb0f] | 85 | useradd -c "Stunnel Daemon" -d /var/lib/stunnel \
|
---|
| 86 | -g stunnel -s /bin/false stunnel &&
|
---|
[2a7d6c3e] | 87 | install -d -m 700 -o stunnel -g stunnel /var/lib/stunnel/run</command></userinput></screen>
|
---|
| 88 |
|
---|
[2bfe939] | 89 | <note><para>A signed <acronym>SSL</acronym> Certificate and a Private Key is
|
---|
| 90 | necessary to run the <command>stunnel</command> daemon. If you own, or have
|
---|
| 91 | already created a signed <acronym>SSL</acronym> Certificate you wish to use,
|
---|
[423b1d94] | 92 | copy it to <filename>/etc/stunnel/stunnel.pem</filename> before starting the
|
---|
| 93 | build, otherwise you will be prompted to create one during the installation
|
---|
| 94 | process. The <filename>.pem</filename> file must be formatted as shown
|
---|
| 95 | below:</para>
|
---|
[2a7d6c3e] | 96 |
|
---|
| 97 | <screen>-----BEGIN RSA PRIVATE KEY-----
|
---|
| 98 | <replaceable>[many encrypted lines of unencrypted key]</replaceable>
|
---|
| 99 | -----END RSA PRIVATE KEY-----
|
---|
| 100 | -----BEGIN CERTIFICATE-----
|
---|
| 101 | <replaceable>[many encrypted lines of certificate]</replaceable>
|
---|
| 102 | -----END CERTIFICATE-----</screen></note>
|
---|
| 103 |
|
---|
| 104 | <para>Install <application>Stunnel</application> by running the following
|
---|
| 105 | commands:</para>
|
---|
| 106 |
|
---|
[423b1d94] | 107 | <screen><userinput><command>patch -Np1 -i ../stunnel-&stunnel-version;-1_minute_sleep_fix.patch &&
|
---|
| 108 | ./configure --prefix=/usr --sysconfdir=/etc \
|
---|
| 109 | --localstatedir=/var/lib &&
|
---|
[305e60de] | 110 | make</command></userinput></screen>
|
---|
| 111 |
|
---|
| 112 | <para>Now, as the root user:</para>
|
---|
| 113 |
|
---|
| 114 | <screen><userinput role='root'><command>make install</command></userinput></screen>
|
---|
[2a7d6c3e] | 115 |
|
---|
| 116 | </sect2>
|
---|
| 117 |
|
---|
| 118 | <sect2>
|
---|
| 119 | <title>Command explanations</title>
|
---|
| 120 |
|
---|
| 121 | <para><parameter>--sysconfdir=/etc</parameter>: This parameter forces the
|
---|
| 122 | configuration directory to <filename class='directory'>/etc</filename> instead
|
---|
| 123 | of <filename class='directory'>/usr/etc</filename>.</para>
|
---|
| 124 |
|
---|
[423b1d94] | 125 | <para><parameter>--localstatedir=/var/lib</parameter>: This parameter
|
---|
[0ef1837] | 126 | causes the installation process to create
|
---|
[423b1d94] | 127 | <filename class='directory'>/var/lib/stunnel</filename> instead of
|
---|
[0ef1837] | 128 | <filename class='directory'>/usr/var/stunnel</filename>.</para>
|
---|
| 129 |
|
---|
[423b1d94] | 130 | <para><command>make install</command>: This command installs the package and,
|
---|
| 131 | if you did not copy an <filename>stunnel.pem</filename> file to the
|
---|
| 132 | <filename class='directory'>/etc/stunnel</filename> directory, prompts you for
|
---|
| 133 | the necessary information to create one. Ensure you reply to the</para>
|
---|
[2a7d6c3e] | 134 |
|
---|
| 135 | <screen><computeroutput>Common Name (FQDN of your server) [localhost]:</computeroutput></screen>
|
---|
| 136 |
|
---|
| 137 | <para>prompt with the name or <acronym>IP</acronym> address you will be using
|
---|
| 138 | to access the service.</para>
|
---|
| 139 |
|
---|
| 140 | </sect2>
|
---|
| 141 |
|
---|
| 142 | <sect2>
|
---|
| 143 | <title>Configuring <application>Stunnel</application></title>
|
---|
| 144 |
|
---|
[40851cf] | 145 | <sect3 id="stunnel-config"><title>Config files</title>
|
---|
| 146 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
[0b5a693] | 147 | <indexterm zone="stunnel stunnel-config">
|
---|
[0cd6d67] | 148 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
[40851cf] | 149 | </indexterm>
|
---|
[2a7d6c3e] | 150 | </sect3>
|
---|
| 151 |
|
---|
| 152 | <sect3><title>Configuration Information</title>
|
---|
| 153 |
|
---|
| 154 | <para>Create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
| 155 | configuration file using the following commands:</para>
|
---|
| 156 |
|
---|
[305e60de] | 157 | <screen><userinput role='root'><command>cat >/etc/stunnel/stunnel.conf << "EOF"</command>
|
---|
[2a7d6c3e] | 158 | # File: /etc/stunnel/stunnel.conf
|
---|
| 159 |
|
---|
| 160 | pid = /run/stunnel.pid
|
---|
| 161 | chroot = /var/lib/stunnel
|
---|
| 162 | client = no
|
---|
| 163 | setuid = stunnel
|
---|
| 164 | setgid = stunnel
|
---|
| 165 |
|
---|
| 166 | <command>EOF</command></userinput></screen>
|
---|
| 167 |
|
---|
| 168 | <para>Next, you need to add the service you wish to encrypt to the
|
---|
| 169 | configuration file. The format is as follows:</para>
|
---|
| 170 |
|
---|
[305e60de] | 171 | <screen><userinput role='root'>[<replaceable>[service]</replaceable>]
|
---|
[2a7d6c3e] | 172 | accept = <replaceable>[hostname:portnumber]</replaceable>
|
---|
| 173 | connect = <replaceable>[hostname:portnumber]</replaceable></userinput></screen>
|
---|
| 174 |
|
---|
| 175 | <para>If you use <application>Stunnel</application> to encrypt a daemon
|
---|
| 176 | started from <command>[x]inetd</command>, you may need to disable that daemon
|
---|
| 177 | in the <filename>/etc/[x]inetd.conf</filename> file and enable a corresponding
|
---|
| 178 | <replaceable>[service]</replaceable>_stunnel service. You may have to add an
|
---|
| 179 | appropriate entry in <filename>/etc/services</filename> as well.</para>
|
---|
| 180 |
|
---|
| 181 | <para>For a full explanation of the commands and syntax used in the
|
---|
| 182 | configuration file, run <command>man stunnel</command>. To see a
|
---|
| 183 | <acronym>BLFS</acronym> example of an actual setup of an
|
---|
| 184 | <command>stunnel</command> encrypted service, read the
|
---|
[8f2d9b04] | 185 | <xref linkend="samba3-swat-config"/> in the <application>Samba</application>
|
---|
[2a7d6c3e] | 186 | instructions.</para>
|
---|
| 187 |
|
---|
[9f6698c] | 188 | <para id="stunnel.init">To automatically start the <command>stunnel</command>
|
---|
| 189 | daemon when the system is rebooted, install the
|
---|
| 190 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
| 191 | <xref linkend="intro-important-bootscripts"/> package.</para>
|
---|
[0b5a693] | 192 | <indexterm zone="stunnel stunnel.init">
|
---|
[0ef1837] | 193 | <primary sortas="f-stunnel.init">stunnel</primary></indexterm>
|
---|
[2a7d6c3e] | 194 |
|
---|
[305e60de] | 195 | <screen><userinput role='root'><command>make install-stunnel</command></userinput></screen>
|
---|
[2a7d6c3e] | 196 | </sect3>
|
---|
| 197 |
|
---|
| 198 | </sect2>
|
---|
| 199 |
|
---|
| 200 | <sect2>
|
---|
| 201 | <title>Contents</title>
|
---|
[0ef1837] | 202 | <segmentedlist>
|
---|
[eeaaf995] | 203 | <segtitle>Installed Programs</segtitle>
|
---|
[0ef1837] | 204 | <segtitle>Installed Library</segtitle>
|
---|
| 205 | <segtitle>Installed Directories</segtitle>
|
---|
| 206 | <seglistitem>
|
---|
[eeaaf995] | 207 | <seg>stunnel and stunnel3</seg>
|
---|
[0ef1837] | 208 | <seg>libstunnel.so</seg>
|
---|
[0b5a693] | 209 | <seg>/etc/stunnel, /var/lib/stunnel and /usr/share/doc/stunnel</seg>
|
---|
| 210 | </seglistitem>
|
---|
[0ef1837] | 211 | </segmentedlist>
|
---|
| 212 |
|
---|
| 213 | <variablelist>
|
---|
| 214 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 215 | <?dbfo list-presentation="list"?>
|
---|
| 216 |
|
---|
[0b5a693] | 217 | <varlistentry id="stunnel-prog">
|
---|
[0ef1837] | 218 | <term><command>stunnel</command></term>
|
---|
| 219 | <listitem><para> is a program designed to work as an <acronym>SSL</acronym>
|
---|
| 220 | encryption wrapper between remote clients and local
|
---|
| 221 | (<command>[x]inetd</command>-startable) or remote servers.</para>
|
---|
[0b5a693] | 222 | <indexterm zone="stunnel stunnel-prog">
|
---|
[0ef1837] | 223 | <primary sortas="b-stunnel">stunnel</primary></indexterm>
|
---|
| 224 | </listitem>
|
---|
| 225 | </varlistentry>
|
---|
| 226 |
|
---|
| 227 | <varlistentry id="stunnel3">
|
---|
| 228 | <term><command>stunnel3</command></term>
|
---|
| 229 | <listitem><para>is a <application>Perl</application> wrapper script to use
|
---|
| 230 | <command>stunnel</command> 3.x syntax with <command>stunnel</command>
|
---|
| 231 | >=4.05.</para>
|
---|
[0b5a693] | 232 | <indexterm zone="stunnel stunnel3">
|
---|
[eeaaf995] | 233 | <primary sortas="b-stunnel3">stunnel3</primary></indexterm>
|
---|
[0ef1837] | 234 | </listitem>
|
---|
| 235 | </varlistentry>
|
---|
| 236 |
|
---|
[9f6698c] | 237 | <varlistentry id="libstunnel">
|
---|
[0ef1837] | 238 | <term><filename class='libraryfile'>libstunnel.so</filename></term>
|
---|
| 239 | <listitem><para> contains the <acronym>API</acronym> functions required by
|
---|
| 240 | <application>Stunnel</application>.</para>
|
---|
[0b5a693] | 241 | <indexterm zone="stunnel libstunnel">
|
---|
[9f6698c] | 242 | <primary sortas="c-libstunnel">libstunnel.so</primary></indexterm>
|
---|
[0ef1837] | 243 | </listitem>
|
---|
| 244 | </varlistentry>
|
---|
| 245 | </variablelist>
|
---|
[2a7d6c3e] | 246 |
|
---|
| 247 | </sect2>
|
---|
| 248 |
|
---|
| 249 | </sect1>
|
---|
| 250 |
|
---|