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