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