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