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