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