[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"> -->
|
---|
[884db0e3] | 8 | <!ENTITY stunnel-download-http "http://www.stunnel.org/download/stunnel/src/stunnel-&stunnel-version;.tar.gz">
|
---|
[423b1d94] | 9 | <!ENTITY stunnel-download-ftp "ftp://stunnel.mirt.net/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
[708f97e9] | 10 | <!ENTITY stunnel-md5sum "0969cc4868dfd75f22792ecccc9ec555">
|
---|
| 11 | <!ENTITY stunnel-size "488 KB">
|
---|
[50d61ed] | 12 | <!ENTITY stunnel-buildsize "4.0 MB">
|
---|
| 13 | <!ENTITY stunnel-time "0.1 SBU">
|
---|
[2a7d6c3e] | 14 | ]>
|
---|
| 15 |
|
---|
[0b5a693] | 16 | <sect1 id="stunnel" xreflabel="Stunnel-&stunnel-version;">
|
---|
[d3469f0] | 17 | <?dbhtml filename="stunnel.html"?>
|
---|
| 18 |
|
---|
| 19 | <sect1info>
|
---|
| 20 | <othername>$LastChangedBy$</othername>
|
---|
| 21 | <date>$Date$</date>
|
---|
[e19ad480] | 22 | <keywordset>
|
---|
| 23 | <keyword role="package">stunnel-&stunnel-version;.tar</keyword>
|
---|
[9084c2eb] | 24 | <keyword role="ftpdir">stunnel</keyword>
|
---|
[e19ad480] | 25 | </keywordset>
|
---|
[d3469f0] | 26 | </sect1info>
|
---|
| 27 |
|
---|
| 28 | <title>Stunnel-&stunnel-version;</title>
|
---|
| 29 |
|
---|
| 30 | <indexterm zone="stunnel">
|
---|
| 31 | <primary sortas="a-Stunnel">Stunnel</primary>
|
---|
| 32 | </indexterm>
|
---|
| 33 |
|
---|
| 34 | <sect2 role="package">
|
---|
| 35 | <title>Introduction to Stunnel</title>
|
---|
| 36 |
|
---|
| 37 | <para>The <application>Stunnel</application> package contains a program
|
---|
| 38 | that allows you to encrypt arbitrary TCP connections inside SSL (Secure
|
---|
| 39 | Sockets Layer) so you can easily communicate with clients over secure
|
---|
| 40 | channels. <application>Stunnel</application> can be used to add SSL
|
---|
| 41 | functionality to commonly used <application>Inetd</application> daemons
|
---|
| 42 | like POP-2, POP-3, and IMAP servers, to standalone daemons like NNTP,
|
---|
| 43 | SMTP and HTTP, and in tunneling PPP over network sockets without changes
|
---|
| 44 | to the server package source code.</para>
|
---|
| 45 |
|
---|
| 46 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 47 | <itemizedlist spacing="compact">
|
---|
| 48 | <listitem>
|
---|
| 49 | <para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>Download MD5 sum: &stunnel-md5sum;</para>
|
---|
| 56 | </listitem>
|
---|
| 57 | <listitem>
|
---|
| 58 | <para>Download size: &stunnel-size;</para>
|
---|
| 59 | </listitem>
|
---|
| 60 | <listitem>
|
---|
| 61 | <para>Estimated disk space required: &stunnel-buildsize;</para>
|
---|
| 62 | </listitem>
|
---|
| 63 | <listitem>
|
---|
| 64 | <para>Estimated build time: &stunnel-time;</para>
|
---|
| 65 | </listitem>
|
---|
| 66 | </itemizedlist>
|
---|
| 67 |
|
---|
| 68 | <bridgehead renderas="sect3">Stunnel Dependencies</bridgehead>
|
---|
| 69 |
|
---|
| 70 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[e19ad480] | 71 | <para role="required"><xref linkend="openssl"/></para>
|
---|
[d3469f0] | 72 |
|
---|
| 73 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[e19ad480] | 74 | <para role="optional"><xref linkend="tcpwrappers"/></para>
|
---|
[d3469f0] | 75 |
|
---|
| 76 | </sect2>
|
---|
| 77 |
|
---|
| 78 | <sect2 role="installation">
|
---|
| 79 | <title>Installation of Stunnel</title>
|
---|
| 80 |
|
---|
| 81 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
| 82 | <command>chroot</command> jail by an unprivileged user. Create the
|
---|
| 83 | new user, group and <command>chroot</command> home directory structure
|
---|
[50d61ed] | 84 | using the following commands as the
|
---|
| 85 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[d3469f0] | 86 |
|
---|
[b785ab29] | 87 | <screen role="root"><userinput>groupadd -g 51 stunnel &&
|
---|
[8d9eb0f] | 88 | useradd -c "Stunnel Daemon" -d /var/lib/stunnel \
|
---|
[b785ab29] | 89 | -g stunnel -s /bin/false -u 51 stunnel &&
|
---|
[50d61ed] | 90 | install -v -m700 -o stunnel -g stunnel -d /var/lib/stunnel/run</userinput></screen>
|
---|
[d3469f0] | 91 |
|
---|
| 92 | <note>
|
---|
| 93 | <para>A signed SSL Certificate and a Private Key is necessary to run
|
---|
| 94 | the <command>stunnel</command> daemon. If you own, or have already
|
---|
| 95 | created a signed SSL Certificate you wish to use, copy it to
|
---|
[50d61ed] | 96 | <filename>/etc/stunnel/stunnel.pem</filename> before starting the build
|
---|
[823b1a3] | 97 | (ensure only <systemitem class='username'>root</systemitem> has read and
|
---|
| 98 | write access), otherwise you will be
|
---|
[50d61ed] | 99 | prompted to create one during the installation process. The
|
---|
[708f97e9] | 100 | <filename class='extension'>.pem</filename> file must be formatted as
|
---|
| 101 | shown below:</para>
|
---|
[d3469f0] | 102 |
|
---|
| 103 | <screen><literal>-----BEGIN RSA PRIVATE KEY-----
|
---|
[2a7d6c3e] | 104 | <replaceable>[many encrypted lines of unencrypted key]</replaceable>
|
---|
| 105 | -----END RSA PRIVATE KEY-----
|
---|
| 106 | -----BEGIN CERTIFICATE-----
|
---|
| 107 | <replaceable>[many encrypted lines of certificate]</replaceable>
|
---|
[50d61ed] | 108 | -----END CERTIFICATE-----
|
---|
| 109 | -----BEGIN DH PARAMETERS-----
|
---|
| 110 | <replaceable>[multiple encrypted lines of DH parameters]</replaceable>
|
---|
| 111 | -----END DH PARAMETERS-----</literal></screen>
|
---|
[d3469f0] | 112 | </note>
|
---|
[2a7d6c3e] | 113 |
|
---|
[d3469f0] | 114 | <para>Install <application>Stunnel</application> by running the following
|
---|
| 115 | commands:</para>
|
---|
| 116 |
|
---|
[50d61ed] | 117 | <screen><userinput>./configure --prefix=/usr --sysconfdir=/etc \
|
---|
[a49d0f2d] | 118 | --localstatedir=/var/lib --disable-libwrap &&
|
---|
[d3469f0] | 119 | make</userinput></screen>
|
---|
| 120 |
|
---|
[50d61ed] | 121 | <para>This package does not come with a test suite.</para>
|
---|
| 122 |
|
---|
[d3469f0] | 123 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[305e60de] | 124 |
|
---|
[d3469f0] | 125 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
[305e60de] | 126 |
|
---|
[d3469f0] | 127 | </sect2>
|
---|
[2a7d6c3e] | 128 |
|
---|
[d3469f0] | 129 | <sect2 role="commands">
|
---|
| 130 | <title>Command Explanations</title>
|
---|
[2a7d6c3e] | 131 |
|
---|
[d3469f0] | 132 | <para><parameter>--sysconfdir=/etc</parameter>: This parameter forces
|
---|
| 133 | the configuration directory to <filename class='directory'>/etc</filename>
|
---|
| 134 | instead of <filename class='directory'>/usr/etc</filename>.</para>
|
---|
[2a7d6c3e] | 135 |
|
---|
[d3469f0] | 136 | <para><parameter>--localstatedir=/var/lib</parameter>: This parameter
|
---|
| 137 | causes the installation process to create
|
---|
| 138 | <filename class='directory'>/var/lib/stunnel</filename> instead of
|
---|
| 139 | <filename class='directory'>/usr/var/stunnel</filename>.</para>
|
---|
[2a7d6c3e] | 140 |
|
---|
[a49d0f2d] | 141 | <para><parameter>--disable-libwrap</parameter>: This parameter is required
|
---|
| 142 | if you don't have <application>tcpwrappers</application> installed. Remove
|
---|
| 143 | the parameter if <application>tcpwrappers</application> is installed.</para>
|
---|
| 144 |
|
---|
[d3469f0] | 145 | <para><command>make install</command>: This command installs the package
|
---|
| 146 | and, if you did not copy an <filename>stunnel.pem</filename> file to the
|
---|
| 147 | <filename class='directory'>/etc/stunnel</filename> directory, prompts you
|
---|
| 148 | for the necessary information to create one. Ensure you reply to the</para>
|
---|
[0ef1837] | 149 |
|
---|
[d3469f0] | 150 | <screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
|
---|
[2a7d6c3e] | 151 |
|
---|
[d3469f0] | 152 | <para>prompt with the name or IP address you will be using
|
---|
[50d61ed] | 153 | to access the service(s).</para>
|
---|
[2a7d6c3e] | 154 |
|
---|
[d3469f0] | 155 | </sect2>
|
---|
[2a7d6c3e] | 156 |
|
---|
[d3469f0] | 157 | <sect2 role="configuration">
|
---|
| 158 | <title>Configuring Stunnel</title>
|
---|
[2a7d6c3e] | 159 |
|
---|
[d3469f0] | 160 | <sect3 id="stunnel-config">
|
---|
| 161 | <title>Config Files</title>
|
---|
[2a7d6c3e] | 162 |
|
---|
[d3469f0] | 163 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
[2a7d6c3e] | 164 |
|
---|
[d3469f0] | 165 | <indexterm zone="stunnel stunnel-config">
|
---|
| 166 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
| 167 | </indexterm>
|
---|
[2a7d6c3e] | 168 |
|
---|
[d3469f0] | 169 | </sect3>
|
---|
[2a7d6c3e] | 170 |
|
---|
[d3469f0] | 171 | <sect3>
|
---|
| 172 | <title>Configuration Information</title>
|
---|
| 173 |
|
---|
| 174 | <para>Create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
| 175 | configuration file using the following commands:</para>
|
---|
| 176 |
|
---|
[708f97e9] | 177 | <screen role="root"><userinput>cat >/etc/stunnel/stunnel.conf << "EOF" &&
|
---|
[d3469f0] | 178 | <literal># File: /etc/stunnel/stunnel.conf
|
---|
[2a7d6c3e] | 179 |
|
---|
| 180 | pid = /run/stunnel.pid
|
---|
| 181 | chroot = /var/lib/stunnel
|
---|
| 182 | client = no
|
---|
| 183 | setuid = stunnel
|
---|
[d3469f0] | 184 | setgid = stunnel</literal>
|
---|
[2a7d6c3e] | 185 |
|
---|
[708f97e9] | 186 | EOF
|
---|
| 187 | chmod -v 644 /etc/stunnel/stunnel.conf</userinput></screen>
|
---|
[2a7d6c3e] | 188 |
|
---|
[50d61ed] | 189 | <para>Next, you need to add the service(s) you wish to encrypt to the
|
---|
[d3469f0] | 190 | configuration file. The format is as follows:</para>
|
---|
[2a7d6c3e] | 191 |
|
---|
[d3469f0] | 192 | <screen><literal>[<replaceable>[service]</replaceable>]
|
---|
[2a7d6c3e] | 193 | accept = <replaceable>[hostname:portnumber]</replaceable>
|
---|
[d3469f0] | 194 | connect = <replaceable>[hostname:portnumber]</replaceable></literal></screen>
|
---|
| 195 |
|
---|
| 196 | <para>If you use <application>Stunnel</application> to encrypt a daemon
|
---|
| 197 | started from <command>[x]inetd</command>, you may need to disable that
|
---|
| 198 | daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
|
---|
| 199 | corresponding <replaceable>[service]</replaceable>_stunnel service. You
|
---|
| 200 | may have to add an appropriate entry in <filename>/etc/services</filename>
|
---|
| 201 | as well.</para>
|
---|
| 202 |
|
---|
| 203 | <para>For a full explanation of the commands and syntax used in the
|
---|
| 204 | configuration file, run <command>man stunnel</command>. To see a
|
---|
| 205 | BLFS example of an actual setup of an <command>stunnel</command> encrypted
|
---|
| 206 | service, read the <xref linkend="samba3-swat-config"/> in the
|
---|
| 207 | <application>Samba</application> instructions.</para>
|
---|
| 208 |
|
---|
| 209 | </sect3>
|
---|
| 210 |
|
---|
| 211 | <sect3 id="stunnel-init">
|
---|
| 212 | <title>Boot Script</title>
|
---|
| 213 |
|
---|
| 214 | <para>To automatically start the <command>stunnel</command> daemon
|
---|
| 215 | when the system is rebooted, install the
|
---|
| 216 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
[5254d12] | 217 | <xref linkend="bootscripts"/> package.</para>
|
---|
[d3469f0] | 218 |
|
---|
| 219 | <indexterm zone="stunnel stunnel-init">
|
---|
| 220 | <primary sortas="f-stunnel">stunnel</primary>
|
---|
| 221 | </indexterm>
|
---|
| 222 |
|
---|
| 223 | <screen role="root"><userinput>make install-stunnel</userinput></screen>
|
---|
| 224 |
|
---|
| 225 | </sect3>
|
---|
| 226 |
|
---|
| 227 | </sect2>
|
---|
| 228 |
|
---|
| 229 | <sect2 role="content">
|
---|
| 230 | <title>Contents</title>
|
---|
| 231 |
|
---|
| 232 | <segmentedlist>
|
---|
| 233 | <segtitle>Installed Programs</segtitle>
|
---|
| 234 | <segtitle>Installed Library</segtitle>
|
---|
| 235 | <segtitle>Installed Directories</segtitle>
|
---|
| 236 |
|
---|
| 237 | <seglistitem>
|
---|
| 238 | <seg>stunnel and stunnel3</seg>
|
---|
| 239 | <seg>libstunnel.so</seg>
|
---|
| 240 | <seg>/etc/stunnel, /var/lib/stunnel, and /usr/share/doc/stunnel</seg>
|
---|
| 241 | </seglistitem>
|
---|
| 242 | </segmentedlist>
|
---|
| 243 |
|
---|
| 244 | <variablelist>
|
---|
| 245 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 246 | <?dbfo list-presentation="list"?>
|
---|
[869b15ae] | 247 | <?dbhtml list-presentation="table"?>
|
---|
[d3469f0] | 248 |
|
---|
| 249 | <varlistentry id="stunnel-prog">
|
---|
| 250 | <term><command>stunnel</command></term>
|
---|
| 251 | <listitem>
|
---|
| 252 | <para> is a program designed to work as an SSL
|
---|
| 253 | encryption wrapper between remote clients and local
|
---|
| 254 | (<command>[x]inetd</command>-startable) or remote servers.</para>
|
---|
| 255 | <indexterm zone="stunnel stunnel-prog">
|
---|
| 256 | <primary sortas="b-stunnel">stunnel</primary>
|
---|
| 257 | </indexterm>
|
---|
| 258 | </listitem>
|
---|
| 259 | </varlistentry>
|
---|
| 260 |
|
---|
| 261 | <varlistentry id="stunnel3">
|
---|
| 262 | <term><command>stunnel3</command></term>
|
---|
| 263 | <listitem>
|
---|
| 264 | <para>is a <application>Perl</application> wrapper script to use
|
---|
| 265 | <command>stunnel</command> 3.x syntax with <command>stunnel</command>
|
---|
| 266 | >=4.05.</para>
|
---|
| 267 | <indexterm zone="stunnel stunnel3">
|
---|
| 268 | <primary sortas="b-stunnel3">stunnel3</primary>
|
---|
| 269 | </indexterm>
|
---|
| 270 | </listitem>
|
---|
| 271 | </varlistentry>
|
---|
| 272 |
|
---|
| 273 | <varlistentry id="libstunnel">
|
---|
| 274 | <term><filename class='libraryfile'>libstunnel.so</filename></term>
|
---|
| 275 | <listitem>
|
---|
| 276 | <para> contains the API functions required by
|
---|
| 277 | <application>Stunnel</application>.</para>
|
---|
| 278 | <indexterm zone="stunnel libstunnel">
|
---|
| 279 | <primary sortas="c-libstunnel">libstunnel.so</primary>
|
---|
| 280 | </indexterm>
|
---|
| 281 | </listitem>
|
---|
| 282 | </varlistentry>
|
---|
| 283 |
|
---|
| 284 | </variablelist>
|
---|
| 285 |
|
---|
| 286 | </sect2>
|
---|
[2a7d6c3e] | 287 |
|
---|
| 288 | </sect1>
|
---|