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