source: postlfs/security/stunnel-systemd.xml@ 1adf07d

systemd-13485
Last change on this file since 1adf07d was 1adf07d, checked in by Douglas R. Reno <renodr@…>, 9 years ago

Update to bind-9.10.2-P4 and BIND-Utilities-9.10.2-P4
Update to stunnel-5.23
Update to libgpg-error-1.20
Update to mutt-1.5.24
Fix a typo in my own changelog.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@16389 af4574ff-66df-0310-9fd7-8a98e5e911e0

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