[2a7d6c3e] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[2a7d6c3e] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[884db0e3] | 7 | <!ENTITY stunnel-download-http "http://www.stunnel.org/download/stunnel/src/stunnel-&stunnel-version;.tar.gz">
|
---|
[423b1d94] | 8 | <!ENTITY stunnel-download-ftp "ftp://stunnel.mirt.net/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
[ab47e379] | 9 | <!ENTITY stunnel-md5sum "2c00153ad099a5f9c5609e8d1dbbe470">
|
---|
| 10 | <!ENTITY stunnel-size "497 KB">
|
---|
| 11 | <!ENTITY stunnel-buildsize "4.2 MB">
|
---|
[50d61ed] | 12 | <!ENTITY stunnel-time "0.1 SBU">
|
---|
[2a7d6c3e] | 13 | ]>
|
---|
| 14 |
|
---|
[0b5a693] | 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>
|
---|
[e19ad480] | 21 | <keywordset>
|
---|
| 22 | <keyword role="package">stunnel-&stunnel-version;.tar</keyword>
|
---|
[9084c2eb] | 23 | <keyword role="ftpdir">stunnel</keyword>
|
---|
[e19ad480] | 24 | </keywordset>
|
---|
[d3469f0] | 25 | </sect1info>
|
---|
| 26 |
|
---|
| 27 | <title>Stunnel-&stunnel-version;</title>
|
---|
| 28 |
|
---|
| 29 | <indexterm zone="stunnel">
|
---|
| 30 | <primary sortas="a-Stunnel">Stunnel</primary>
|
---|
| 31 | </indexterm>
|
---|
| 32 |
|
---|
| 33 | <sect2 role="package">
|
---|
| 34 | <title>Introduction to Stunnel</title>
|
---|
| 35 |
|
---|
| 36 | <para>The <application>Stunnel</application> package contains a program
|
---|
| 37 | that allows you to encrypt arbitrary TCP connections inside SSL (Secure
|
---|
| 38 | Sockets Layer) so you can easily communicate with clients over secure
|
---|
| 39 | channels. <application>Stunnel</application> can be used to add SSL
|
---|
| 40 | functionality to commonly used <application>Inetd</application> daemons
|
---|
| 41 | like POP-2, POP-3, and IMAP servers, to standalone daemons like NNTP,
|
---|
| 42 | SMTP and HTTP, and in tunneling PPP over network sockets without changes
|
---|
| 43 | to the server package source code.</para>
|
---|
| 44 |
|
---|
| 45 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 46 | <itemizedlist spacing="compact">
|
---|
| 47 | <listitem>
|
---|
| 48 | <para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para>
|
---|
| 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
| 51 | <para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para>
|
---|
| 52 | </listitem>
|
---|
| 53 | <listitem>
|
---|
| 54 | <para>Download MD5 sum: &stunnel-md5sum;</para>
|
---|
| 55 | </listitem>
|
---|
| 56 | <listitem>
|
---|
| 57 | <para>Download size: &stunnel-size;</para>
|
---|
| 58 | </listitem>
|
---|
| 59 | <listitem>
|
---|
| 60 | <para>Estimated disk space required: &stunnel-buildsize;</para>
|
---|
| 61 | </listitem>
|
---|
| 62 | <listitem>
|
---|
| 63 | <para>Estimated build time: &stunnel-time;</para>
|
---|
| 64 | </listitem>
|
---|
| 65 | </itemizedlist>
|
---|
| 66 |
|
---|
| 67 | <bridgehead renderas="sect3">Stunnel Dependencies</bridgehead>
|
---|
| 68 |
|
---|
| 69 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[e19ad480] | 70 | <para role="required"><xref linkend="openssl"/></para>
|
---|
[d3469f0] | 71 |
|
---|
| 72 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[e19ad480] | 73 | <para role="optional"><xref linkend="tcpwrappers"/></para>
|
---|
[d3469f0] | 74 |
|
---|
[3597eb6] | 75 | <para condition="html" role="usernotes">User Notes:
|
---|
| 76 | <ulink url="&blfs-wiki;/stunnel"/></para>
|
---|
| 77 |
|
---|
[d3469f0] | 78 | </sect2>
|
---|
| 79 |
|
---|
| 80 | <sect2 role="installation">
|
---|
| 81 | <title>Installation of Stunnel</title>
|
---|
| 82 |
|
---|
| 83 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
| 84 | <command>chroot</command> jail by an unprivileged user. Create the
|
---|
| 85 | new user, group and <command>chroot</command> home directory structure
|
---|
[50d61ed] | 86 | using the following commands as the
|
---|
| 87 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[d3469f0] | 88 |
|
---|
[b785ab29] | 89 | <screen role="root"><userinput>groupadd -g 51 stunnel &&
|
---|
[8d9eb0f] | 90 | useradd -c "Stunnel Daemon" -d /var/lib/stunnel \
|
---|
[b785ab29] | 91 | -g stunnel -s /bin/false -u 51 stunnel &&
|
---|
[ab47e379] | 92 | install -v -m 1770 -o stunnel -g stunnel -d /var/lib/stunnel/run</userinput></screen>
|
---|
[d3469f0] | 93 |
|
---|
| 94 | <note>
|
---|
| 95 | <para>A signed SSL Certificate and a Private Key is necessary to run
|
---|
| 96 | the <command>stunnel</command> daemon. If you own, or have already
|
---|
| 97 | created a signed SSL Certificate you wish to use, copy it to
|
---|
[50d61ed] | 98 | <filename>/etc/stunnel/stunnel.pem</filename> before starting the build
|
---|
[823b1a3] | 99 | (ensure only <systemitem class='username'>root</systemitem> has read and
|
---|
| 100 | write access), otherwise you will be
|
---|
[50d61ed] | 101 | prompted to create one during the installation process. The
|
---|
[708f97e9] | 102 | <filename class='extension'>.pem</filename> file must be formatted as
|
---|
| 103 | shown below:</para>
|
---|
[d3469f0] | 104 |
|
---|
| 105 | <screen><literal>-----BEGIN RSA PRIVATE KEY-----
|
---|
[3597eb6] | 106 | <replaceable><many encrypted lines of unencrypted key></replaceable>
|
---|
[2a7d6c3e] | 107 | -----END RSA PRIVATE KEY-----
|
---|
| 108 | -----BEGIN CERTIFICATE-----
|
---|
[3597eb6] | 109 | <replaceable><many encrypted lines of certificate></replaceable>
|
---|
[ab47e379] | 110 | -----END CERTIFICATE-----</literal></screen>
|
---|
[d3469f0] | 111 | </note>
|
---|
[2a7d6c3e] | 112 |
|
---|
[d3469f0] | 113 | <para>Install <application>Stunnel</application> by running the following
|
---|
| 114 | commands:</para>
|
---|
| 115 |
|
---|
[ab47e379] | 116 | <screen><userinput>sed -i -e 's|nogroup|stunnel|' \
|
---|
| 117 | -e 's|$(prefix)/var/lib|$(localstatedir)|' \
|
---|
| 118 | tools/Makefile.in
|
---|
| 119 | sed -i 's|doc/stunnel|&-$(VERSION)|' {,doc/,tools/}Makefile.in &&
|
---|
| 120 |
|
---|
| 121 | ./configure --prefix=/usr --sysconfdir=/etc \
|
---|
[a49d0f2d] | 122 | --localstatedir=/var/lib --disable-libwrap &&
|
---|
[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 |
|
---|
[d3469f0] | 129 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
[305e60de] | 130 |
|
---|
[d3469f0] | 131 | </sect2>
|
---|
[2a7d6c3e] | 132 |
|
---|
[d3469f0] | 133 | <sect2 role="commands">
|
---|
| 134 | <title>Command Explanations</title>
|
---|
[2a7d6c3e] | 135 |
|
---|
[ab47e379] | 136 | <para><command>sed -i -e '...' -e '...' tools/Makefile.in</command>:
|
---|
| 137 | This <command>sed</command> command modifies the group and directory
|
---|
| 138 | used for the <command>chroot</command> jail to conform with the parameters
|
---|
| 139 | created earlier.</para>
|
---|
| 140 |
|
---|
| 141 | <para><command>sed -i '...' {,doc/,tools/}Makefile.in</command>: This
|
---|
| 142 | <command>sed</command> command modifies the location of the installed
|
---|
| 143 | docs to a versioned directory.</para>
|
---|
| 144 |
|
---|
[d3469f0] | 145 | <para><parameter>--sysconfdir=/etc</parameter>: This parameter forces
|
---|
| 146 | the configuration directory to <filename class='directory'>/etc</filename>
|
---|
| 147 | instead of <filename class='directory'>/usr/etc</filename>.</para>
|
---|
[2a7d6c3e] | 148 |
|
---|
[d3469f0] | 149 | <para><parameter>--localstatedir=/var/lib</parameter>: This parameter
|
---|
[ab47e379] | 150 | sets the installation to use
|
---|
[d3469f0] | 151 | <filename class='directory'>/var/lib/stunnel</filename> instead of
|
---|
[ab47e379] | 152 | creating and using
|
---|
[d3469f0] | 153 | <filename class='directory'>/usr/var/stunnel</filename>.</para>
|
---|
[2a7d6c3e] | 154 |
|
---|
[a49d0f2d] | 155 | <para><parameter>--disable-libwrap</parameter>: This parameter is required
|
---|
| 156 | if you don't have <application>tcpwrappers</application> installed. Remove
|
---|
| 157 | the parameter if <application>tcpwrappers</application> is installed.</para>
|
---|
| 158 |
|
---|
[d3469f0] | 159 | <para><command>make install</command>: This command installs the package
|
---|
| 160 | and, if you did not copy an <filename>stunnel.pem</filename> file to the
|
---|
| 161 | <filename class='directory'>/etc/stunnel</filename> directory, prompts you
|
---|
| 162 | for the necessary information to create one. Ensure you reply to the</para>
|
---|
[0ef1837] | 163 |
|
---|
[d3469f0] | 164 | <screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
|
---|
[2a7d6c3e] | 165 |
|
---|
[d3469f0] | 166 | <para>prompt with the name or IP address you will be using
|
---|
[50d61ed] | 167 | to access the service(s).</para>
|
---|
[2a7d6c3e] | 168 |
|
---|
[d3469f0] | 169 | </sect2>
|
---|
[2a7d6c3e] | 170 |
|
---|
[d3469f0] | 171 | <sect2 role="configuration">
|
---|
| 172 | <title>Configuring Stunnel</title>
|
---|
[2a7d6c3e] | 173 |
|
---|
[d3469f0] | 174 | <sect3 id="stunnel-config">
|
---|
| 175 | <title>Config Files</title>
|
---|
[2a7d6c3e] | 176 |
|
---|
[d3469f0] | 177 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
[2a7d6c3e] | 178 |
|
---|
[d3469f0] | 179 | <indexterm zone="stunnel stunnel-config">
|
---|
| 180 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
| 181 | </indexterm>
|
---|
[2a7d6c3e] | 182 |
|
---|
[d3469f0] | 183 | </sect3>
|
---|
[2a7d6c3e] | 184 |
|
---|
[d3469f0] | 185 | <sect3>
|
---|
| 186 | <title>Configuration Information</title>
|
---|
| 187 |
|
---|
| 188 | <para>Create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
| 189 | configuration file using the following commands:</para>
|
---|
| 190 |
|
---|
[708f97e9] | 191 | <screen role="root"><userinput>cat >/etc/stunnel/stunnel.conf << "EOF" &&
|
---|
[d3469f0] | 192 | <literal># File: /etc/stunnel/stunnel.conf
|
---|
[2a7d6c3e] | 193 |
|
---|
| 194 | pid = /run/stunnel.pid
|
---|
| 195 | chroot = /var/lib/stunnel
|
---|
| 196 | client = no
|
---|
| 197 | setuid = stunnel
|
---|
[d3469f0] | 198 | setgid = stunnel</literal>
|
---|
[2a7d6c3e] | 199 |
|
---|
[708f97e9] | 200 | EOF
|
---|
| 201 | chmod -v 644 /etc/stunnel/stunnel.conf</userinput></screen>
|
---|
[2a7d6c3e] | 202 |
|
---|
[50d61ed] | 203 | <para>Next, you need to add the service(s) you wish to encrypt to the
|
---|
[d3469f0] | 204 | configuration file. The format is as follows:</para>
|
---|
[2a7d6c3e] | 205 |
|
---|
[3597eb6] | 206 | <screen><literal>[<replaceable><service></replaceable>]
|
---|
| 207 | accept = <replaceable><hostname:portnumber></replaceable>
|
---|
| 208 | connect = <replaceable><hostname:portnumber></replaceable></literal></screen>
|
---|
[d3469f0] | 209 |
|
---|
| 210 | <para>If you use <application>Stunnel</application> to encrypt a daemon
|
---|
| 211 | started from <command>[x]inetd</command>, you may need to disable that
|
---|
| 212 | daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
|
---|
[3597eb6] | 213 | corresponding <replaceable><service></replaceable>_stunnel service. You
|
---|
[d3469f0] | 214 | may have to add an appropriate entry in <filename>/etc/services</filename>
|
---|
| 215 | as well.</para>
|
---|
| 216 |
|
---|
| 217 | <para>For a full explanation of the commands and syntax used in the
|
---|
| 218 | configuration file, run <command>man stunnel</command>. To see a
|
---|
| 219 | BLFS example of an actual setup of an <command>stunnel</command> encrypted
|
---|
| 220 | service, read the <xref linkend="samba3-swat-config"/> in the
|
---|
| 221 | <application>Samba</application> instructions.</para>
|
---|
| 222 |
|
---|
| 223 | </sect3>
|
---|
| 224 |
|
---|
| 225 | <sect3 id="stunnel-init">
|
---|
| 226 | <title>Boot Script</title>
|
---|
| 227 |
|
---|
| 228 | <para>To automatically start the <command>stunnel</command> daemon
|
---|
| 229 | when the system is rebooted, install the
|
---|
| 230 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
[5254d12] | 231 | <xref linkend="bootscripts"/> package.</para>
|
---|
[d3469f0] | 232 |
|
---|
| 233 | <indexterm zone="stunnel stunnel-init">
|
---|
| 234 | <primary sortas="f-stunnel">stunnel</primary>
|
---|
| 235 | </indexterm>
|
---|
| 236 |
|
---|
| 237 | <screen role="root"><userinput>make install-stunnel</userinput></screen>
|
---|
| 238 |
|
---|
| 239 | </sect3>
|
---|
| 240 |
|
---|
| 241 | </sect2>
|
---|
| 242 |
|
---|
| 243 | <sect2 role="content">
|
---|
| 244 | <title>Contents</title>
|
---|
| 245 |
|
---|
| 246 | <segmentedlist>
|
---|
| 247 | <segtitle>Installed Programs</segtitle>
|
---|
| 248 | <segtitle>Installed Library</segtitle>
|
---|
| 249 | <segtitle>Installed Directories</segtitle>
|
---|
| 250 |
|
---|
| 251 | <seglistitem>
|
---|
| 252 | <seg>stunnel and stunnel3</seg>
|
---|
| 253 | <seg>libstunnel.so</seg>
|
---|
[ab47e379] | 254 | <seg>/etc/stunnel, /var/lib/stunnel and
|
---|
| 255 | /usr/share/doc/stunnel-&stunnel-version;</seg>
|
---|
[d3469f0] | 256 | </seglistitem>
|
---|
| 257 | </segmentedlist>
|
---|
| 258 |
|
---|
| 259 | <variablelist>
|
---|
| 260 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 261 | <?dbfo list-presentation="list"?>
|
---|
[869b15ae] | 262 | <?dbhtml list-presentation="table"?>
|
---|
[d3469f0] | 263 |
|
---|
| 264 | <varlistentry id="stunnel-prog">
|
---|
| 265 | <term><command>stunnel</command></term>
|
---|
| 266 | <listitem>
|
---|
| 267 | <para> is a program designed to work as an SSL
|
---|
| 268 | encryption wrapper between remote clients and local
|
---|
[3597eb6] | 269 | (<command>{x}inetd</command>-startable) or remote servers.</para>
|
---|
[d3469f0] | 270 | <indexterm zone="stunnel stunnel-prog">
|
---|
| 271 | <primary sortas="b-stunnel">stunnel</primary>
|
---|
| 272 | </indexterm>
|
---|
| 273 | </listitem>
|
---|
| 274 | </varlistentry>
|
---|
| 275 |
|
---|
| 276 | <varlistentry id="stunnel3">
|
---|
| 277 | <term><command>stunnel3</command></term>
|
---|
| 278 | <listitem>
|
---|
| 279 | <para>is a <application>Perl</application> wrapper script to use
|
---|
| 280 | <command>stunnel</command> 3.x syntax with <command>stunnel</command>
|
---|
| 281 | >=4.05.</para>
|
---|
| 282 | <indexterm zone="stunnel stunnel3">
|
---|
| 283 | <primary sortas="b-stunnel3">stunnel3</primary>
|
---|
| 284 | </indexterm>
|
---|
| 285 | </listitem>
|
---|
| 286 | </varlistentry>
|
---|
| 287 |
|
---|
| 288 | <varlistentry id="libstunnel">
|
---|
| 289 | <term><filename class='libraryfile'>libstunnel.so</filename></term>
|
---|
| 290 | <listitem>
|
---|
| 291 | <para> contains the API functions required by
|
---|
| 292 | <application>Stunnel</application>.</para>
|
---|
| 293 | <indexterm zone="stunnel libstunnel">
|
---|
| 294 | <primary sortas="c-libstunnel">libstunnel.so</primary>
|
---|
| 295 | </indexterm>
|
---|
| 296 | </listitem>
|
---|
| 297 | </varlistentry>
|
---|
| 298 |
|
---|
| 299 | </variablelist>
|
---|
| 300 |
|
---|
| 301 | </sect2>
|
---|
[2a7d6c3e] | 302 |
|
---|
| 303 | </sect1>
|
---|