[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 |
|
---|
[6c70af9b] | 7 | <!ENTITY stunnel-download-http "http://mirrors.zerg.biz/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
| 8 | <!ENTITY stunnel-download-ftp "ftp://ftp.stunnel.org/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
[06b565e] | 9 | <!ENTITY stunnel-md5sum "c10edd84ecbc676a5a48c7e34ab3d1c5">
|
---|
| 10 | <!ENTITY stunnel-size "588 KB">
|
---|
[2a37b9e] | 11 | <!ENTITY stunnel-buildsize "5.7 MB">
|
---|
[372898b] | 12 | <!ENTITY stunnel-time "0.1 SBU">
|
---|
[2a7d6c3e] | 13 | ]>
|
---|
| 14 |
|
---|
[436c2f7e] | 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 |
|
---|
[436c2f7e] | 23 | <title>stunnel-&stunnel-version;</title>
|
---|
[d3469f0] | 24 |
|
---|
| 25 | <indexterm zone="stunnel">
|
---|
[436c2f7e] | 26 | <primary sortas="a-stunnel">stunnel</primary>
|
---|
[d3469f0] | 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
[436c2f7e] | 30 | <title>Introduction to stunnel</title>
|
---|
[d3469f0] | 31 |
|
---|
[436c2f7e] | 32 | <para>The <application>stunnel</application> package contains a program
|
---|
[d3469f0] | 33 | that allows you to encrypt arbitrary TCP connections inside SSL (Secure
|
---|
| 34 | Sockets Layer) so you can easily communicate with clients over secure
|
---|
[436c2f7e] | 35 | channels. <application>stunnel</application> can be used to add SSL
|
---|
[d3469f0] | 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 |
|
---|
[bb49ea0] | 41 | &lfs76_checked;
|
---|
[ee792ef] | 42 |
|
---|
[d3469f0] | 43 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 44 | <itemizedlist spacing="compact">
|
---|
| 45 | <listitem>
|
---|
| 46 | <para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para>
|
---|
| 47 | </listitem>
|
---|
| 48 | <listitem>
|
---|
| 49 | <para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>Download MD5 sum: &stunnel-md5sum;</para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>Download size: &stunnel-size;</para>
|
---|
| 56 | </listitem>
|
---|
| 57 | <listitem>
|
---|
| 58 | <para>Estimated disk space required: &stunnel-buildsize;</para>
|
---|
| 59 | </listitem>
|
---|
| 60 | <listitem>
|
---|
| 61 | <para>Estimated build time: &stunnel-time;</para>
|
---|
| 62 | </listitem>
|
---|
| 63 | </itemizedlist>
|
---|
| 64 |
|
---|
[436c2f7e] | 65 | <bridgehead renderas="sect3">stunnel Dependencies</bridgehead>
|
---|
[d3469f0] | 66 |
|
---|
| 67 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[372898b] | 68 | <para role="required">
|
---|
| 69 | <xref linkend="openssl"/>
|
---|
| 70 | </para>
|
---|
| 71 |
|
---|
| 72 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 73 | <para role="optional">
|
---|
| 74 | <ulink url="ftp://ftp.porcupine.org/pub/security/">tcpwrappers</ulink>
|
---|
| 75 | </para>
|
---|
[d3469f0] | 76 |
|
---|
[3597eb6] | 77 | <para condition="html" role="usernotes">User Notes:
|
---|
| 78 | <ulink url="&blfs-wiki;/stunnel"/></para>
|
---|
| 79 |
|
---|
[d3469f0] | 80 | </sect2>
|
---|
| 81 |
|
---|
| 82 | <sect2 role="installation">
|
---|
[436c2f7e] | 83 | <title>Installation of stunnel</title>
|
---|
[d3469f0] | 84 |
|
---|
| 85 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
| 86 | <command>chroot</command> jail by an unprivileged user. Create the
|
---|
[1ae11c9] | 87 | new user and group using the following commands as the
|
---|
[50d61ed] | 88 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[d3469f0] | 89 |
|
---|
[b785ab29] | 90 | <screen role="root"><userinput>groupadd -g 51 stunnel &&
|
---|
[436c2f7e] | 91 | useradd -c "stunnel Daemon" -d /var/lib/stunnel \
|
---|
[1ae11c9] | 92 | -g stunnel -s /bin/false -u 51 stunnel</userinput></screen>
|
---|
[d3469f0] | 93 |
|
---|
| 94 | <note>
|
---|
[372898b] | 95 | <para>A signed SSL Certificate and a Private Key is necessary to run the
|
---|
[3d37094] | 96 | <command>stunnel</command> daemon. Further below, after
|
---|
| 97 | <command>make ... install</command>, we include instructions to generate
|
---|
| 98 | them. However, if you own, or have already created a signed SSL
|
---|
| 99 | Certificate you wish to use, copy it to
|
---|
[50d61ed] | 100 | <filename>/etc/stunnel/stunnel.pem</filename> before starting the build
|
---|
[8ba08b56] | 101 | (ensure only <systemitem class="username">root</systemitem> has read and
|
---|
[372898b] | 102 | write access). The <filename class="extension">.pem</filename> file must
|
---|
| 103 | be formatted as shown below:</para>
|
---|
[d3469f0] | 104 |
|
---|
[30ca77d2] | 105 | <screen><literal>-----BEGIN PRIVATE KEY-----
|
---|
| 106 | <replaceable><many encrypted lines of private key></replaceable>
|
---|
| 107 | -----END PRIVATE KEY-----
|
---|
[2a7d6c3e] | 108 | -----BEGIN CERTIFICATE-----
|
---|
[3597eb6] | 109 | <replaceable><many encrypted lines of certificate></replaceable>
|
---|
[30ca77d2] | 110 | -----END CERTIFICATE-----
|
---|
| 111 | -----BEGIN DH PARAMETERS-----
|
---|
| 112 | <replaceable><encrypted lines of dh parms></replaceable>
|
---|
| 113 | -----END DH PARAMETERS-----</literal></screen>
|
---|
[d3469f0] | 114 | </note>
|
---|
[2a7d6c3e] | 115 |
|
---|
[436c2f7e] | 116 | <para>Install <application>stunnel</application> by running the following
|
---|
[d3469f0] | 117 | commands:</para>
|
---|
| 118 |
|
---|
[06b565e] | 119 | <screen><userinput>./configure --prefix=/usr \
|
---|
| 120 | --sysconfdir=/etc \
|
---|
| 121 | --localstatedir=/var \
|
---|
| 122 | --disable-systemd &&
|
---|
[d3469f0] | 123 | make</userinput></screen>
|
---|
| 124 |
|
---|
[50d61ed] | 125 | <para>This package does not come with a test suite.</para>
|
---|
| 126 |
|
---|
[d3469f0] | 127 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[305e60de] | 128 |
|
---|
[1ae11c9] | 129 | <screen role="root"><userinput>make docdir=/usr/share/doc/stunnel-&stunnel-version; install</userinput></screen>
|
---|
[305e60de] | 130 |
|
---|
[372898b] | 131 | <para>To create the <filename>stunnel.pem</filename> in the
|
---|
| 132 | <filename class="directory">/etc/stunnel</filename> directory,
|
---|
| 133 | you need to create one. The following command prompts you
|
---|
| 134 | for the necessary information. Ensure you reply to the</para>
|
---|
| 135 |
|
---|
| 136 | <screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
|
---|
| 137 |
|
---|
| 138 | <para>prompt with the name or IP address you will be using
|
---|
| 139 | to access the service(s).</para>
|
---|
| 140 |
|
---|
| 141 | <para>To generate a certificate, as the
|
---|
| 142 | <systemitem class="username">root</systemitem> user, run:</para>
|
---|
| 143 |
|
---|
| 144 | <screen role="root"><userinput>make cert</userinput></screen>
|
---|
| 145 |
|
---|
[d3469f0] | 146 | </sect2>
|
---|
[2a7d6c3e] | 147 |
|
---|
[d3469f0] | 148 | <sect2 role="commands">
|
---|
| 149 | <title>Command Explanations</title>
|
---|
[2a7d6c3e] | 150 |
|
---|
[06b565e] | 151 | <para><parameter>--disable-systemd</parameter>: This switch disables
|
---|
| 152 | systemd socket activation support, not available in BLFS.</para>
|
---|
| 153 |
|
---|
[1ae11c9] | 154 | <para><command>make docdir=... install</command>: This command installs the
|
---|
| 155 | package, changes the documentation installation directory to standard
|
---|
[372898b] | 156 | naming conventions.</para>
|
---|
[2a7d6c3e] | 157 |
|
---|
[d3469f0] | 158 | </sect2>
|
---|
[2a7d6c3e] | 159 |
|
---|
[d3469f0] | 160 | <sect2 role="configuration">
|
---|
[436c2f7e] | 161 | <title>Configuring stunnel</title>
|
---|
[2a7d6c3e] | 162 |
|
---|
[d3469f0] | 163 | <sect3 id="stunnel-config">
|
---|
| 164 | <title>Config Files</title>
|
---|
[2a7d6c3e] | 165 |
|
---|
[d3469f0] | 166 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
[2a7d6c3e] | 167 |
|
---|
[d3469f0] | 168 | <indexterm zone="stunnel stunnel-config">
|
---|
| 169 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
| 170 | </indexterm>
|
---|
[2a7d6c3e] | 171 |
|
---|
[d3469f0] | 172 | </sect3>
|
---|
[2a7d6c3e] | 173 |
|
---|
[d3469f0] | 174 | <sect3>
|
---|
| 175 | <title>Configuration Information</title>
|
---|
| 176 |
|
---|
[1ae11c9] | 177 | <para>As the <systemitem class="username">root</systemitem> user,
|
---|
| 178 | create the directory used for the
|
---|
[8ba08b56] | 179 | <filename class="extension">.pid</filename> file that is created
|
---|
[436c2f7e] | 180 | when the <application>stunnel</application> daemon starts:</para>
|
---|
[1ae11c9] | 181 |
|
---|
[8ba08b56] | 182 | <screen role="root"><userinput>install -v -m750 -o stunnel -g stunnel -d /var/lib/stunnel/run &&
|
---|
| 183 | chown stunnel:stunnel /var/lib/stunnel</userinput></screen>
|
---|
[1ae11c9] | 184 |
|
---|
| 185 | <para>Next, create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
| 186 | configuration file using the following commands as the
|
---|
| 187 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[d3469f0] | 188 |
|
---|
[708f97e9] | 189 | <screen role="root"><userinput>cat >/etc/stunnel/stunnel.conf << "EOF" &&
|
---|
[1ae11c9] | 190 | <literal>; File: /etc/stunnel/stunnel.conf
|
---|
[2a7d6c3e] | 191 |
|
---|
[372898b] | 192 | ; Note: The pid and output locations are relative to the chroot location.
|
---|
| 193 |
|
---|
[1ae11c9] | 194 | pid = /run/stunnel.pid
|
---|
[2a7d6c3e] | 195 | chroot = /var/lib/stunnel
|
---|
| 196 | client = no
|
---|
| 197 | setuid = stunnel
|
---|
[30ca77d2] | 198 | setgid = stunnel
|
---|
[372898b] | 199 | cert = /etc/stunnel/stunnel.pem
|
---|
| 200 |
|
---|
| 201 | ;debug = 7
|
---|
| 202 | ;output = stunnel.log
|
---|
| 203 |
|
---|
| 204 | ;[https]
|
---|
| 205 | ;accept = 443
|
---|
| 206 | ;connect = 80
|
---|
| 207 | ;; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SSL
|
---|
| 208 | ;; Microsoft implementations do not use SSL close-notify alert and thus
|
---|
| 209 | ;; they are vulnerable to truncation attacks
|
---|
| 210 | ;TIMEOUTclose = 0</literal>
|
---|
[2a7d6c3e] | 211 |
|
---|
[708f97e9] | 212 | EOF
|
---|
| 213 | chmod -v 644 /etc/stunnel/stunnel.conf</userinput></screen>
|
---|
[2a7d6c3e] | 214 |
|
---|
[1ae11c9] | 215 | <para>Finally, you need to add the service(s) you wish to encrypt to the
|
---|
| 216 | configuration file. The format is as follows:</para>
|
---|
[2a7d6c3e] | 217 |
|
---|
[3597eb6] | 218 | <screen><literal>[<replaceable><service></replaceable>]
|
---|
| 219 | accept = <replaceable><hostname:portnumber></replaceable>
|
---|
| 220 | connect = <replaceable><hostname:portnumber></replaceable></literal></screen>
|
---|
[d3469f0] | 221 |
|
---|
[436c2f7e] | 222 | <para>If you use <application>stunnel</application> to encrypt a daemon
|
---|
[d3469f0] | 223 | started from <command>[x]inetd</command>, you may need to disable that
|
---|
| 224 | daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
|
---|
[3597eb6] | 225 | corresponding <replaceable><service></replaceable>_stunnel service. You
|
---|
[d3469f0] | 226 | may have to add an appropriate entry in <filename>/etc/services</filename>
|
---|
| 227 | as well.</para>
|
---|
| 228 |
|
---|
| 229 | <para>For a full explanation of the commands and syntax used in the
|
---|
[96770a19] | 230 | configuration file, run <command>man stunnel</command>.</para>
|
---|
[d3469f0] | 231 |
|
---|
| 232 | </sect3>
|
---|
| 233 |
|
---|
| 234 | <sect3 id="stunnel-init">
|
---|
| 235 | <title>Boot Script</title>
|
---|
| 236 |
|
---|
| 237 | <para>To automatically start the <command>stunnel</command> daemon
|
---|
| 238 | when the system is rebooted, install the
|
---|
| 239 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
[5254d12] | 240 | <xref linkend="bootscripts"/> package.</para>
|
---|
[d3469f0] | 241 |
|
---|
| 242 | <indexterm zone="stunnel stunnel-init">
|
---|
| 243 | <primary sortas="f-stunnel">stunnel</primary>
|
---|
| 244 | </indexterm>
|
---|
| 245 |
|
---|
| 246 | <screen role="root"><userinput>make install-stunnel</userinput></screen>
|
---|
| 247 |
|
---|
| 248 | </sect3>
|
---|
| 249 |
|
---|
| 250 | </sect2>
|
---|
| 251 |
|
---|
| 252 | <sect2 role="content">
|
---|
| 253 | <title>Contents</title>
|
---|
| 254 |
|
---|
| 255 | <segmentedlist>
|
---|
| 256 | <segtitle>Installed Programs</segtitle>
|
---|
| 257 | <segtitle>Installed Library</segtitle>
|
---|
| 258 | <segtitle>Installed Directories</segtitle>
|
---|
| 259 |
|
---|
| 260 | <seglistitem>
|
---|
| 261 | <seg>stunnel and stunnel3</seg>
|
---|
| 262 | <seg>libstunnel.so</seg>
|
---|
[372898b] | 263 | <seg>/etc/stunnel,
|
---|
| 264 | /usr/lib/stunnel,
|
---|
| 265 | /usr/share/doc/stunnel-&stunnel-version;, and
|
---|
| 266 | /var/lib/stunnel</seg>
|
---|
[d3469f0] | 267 | </seglistitem>
|
---|
| 268 | </segmentedlist>
|
---|
| 269 |
|
---|
| 270 | <variablelist>
|
---|
| 271 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 272 | <?dbfo list-presentation="list"?>
|
---|
[869b15ae] | 273 | <?dbhtml list-presentation="table"?>
|
---|
[d3469f0] | 274 |
|
---|
| 275 | <varlistentry id="stunnel-prog">
|
---|
| 276 | <term><command>stunnel</command></term>
|
---|
| 277 | <listitem>
|
---|
| 278 | <para> is a program designed to work as an SSL
|
---|
| 279 | encryption wrapper between remote clients and local
|
---|
[3597eb6] | 280 | (<command>{x}inetd</command>-startable) or remote servers.</para>
|
---|
[d3469f0] | 281 | <indexterm zone="stunnel stunnel-prog">
|
---|
| 282 | <primary sortas="b-stunnel">stunnel</primary>
|
---|
| 283 | </indexterm>
|
---|
| 284 | </listitem>
|
---|
| 285 | </varlistentry>
|
---|
| 286 |
|
---|
| 287 | <varlistentry id="stunnel3">
|
---|
| 288 | <term><command>stunnel3</command></term>
|
---|
| 289 | <listitem>
|
---|
| 290 | <para>is a <application>Perl</application> wrapper script to use
|
---|
| 291 | <command>stunnel</command> 3.x syntax with <command>stunnel</command>
|
---|
| 292 | >=4.05.</para>
|
---|
| 293 | <indexterm zone="stunnel stunnel3">
|
---|
| 294 | <primary sortas="b-stunnel3">stunnel3</primary>
|
---|
| 295 | </indexterm>
|
---|
| 296 | </listitem>
|
---|
| 297 | </varlistentry>
|
---|
| 298 |
|
---|
| 299 | <varlistentry id="libstunnel">
|
---|
| 300 | <term><filename class='libraryfile'>libstunnel.so</filename></term>
|
---|
| 301 | <listitem>
|
---|
| 302 | <para> contains the API functions required by
|
---|
[436c2f7e] | 303 | <application>stunnel</application>.</para>
|
---|
[d3469f0] | 304 | <indexterm zone="stunnel libstunnel">
|
---|
| 305 | <primary sortas="c-libstunnel">libstunnel.so</primary>
|
---|
| 306 | </indexterm>
|
---|
| 307 | </listitem>
|
---|
| 308 | </varlistentry>
|
---|
| 309 |
|
---|
| 310 | </variablelist>
|
---|
| 311 |
|
---|
| 312 | </sect2>
|
---|
[2a7d6c3e] | 313 |
|
---|
| 314 | </sect1>
|
---|