source: postlfs/security/stunnel-systemd.xml@ 4761754

kde5-14686 systemd-13485
Last change on this file since 4761754 was 0ccf16ef, checked in by Christopher Gregory <cjg@…>, 10 years ago

Merge more updates from trunk.

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

  • Property mode set to 100644
File size: 11.3 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
[6c70af9b]7 <!ENTITY stunnel-download-http "http://mirrors.zerg.biz/stunnel/stunnel-&stunnel-version;.tar.gz">
8 <!ENTITY stunnel-download-ftp "ftp://ftp.stunnel.org/stunnel/stunnel-&stunnel-version;.tar.gz">
[0ccf16ef]9 <!ENTITY stunnel-md5sum "53ac78cedabb00ec09564cbd20eaa7c8">
[372898b]10 <!ENTITY stunnel-size "580 KB">
[0ccf16ef]11 <!ENTITY stunnel-buildsize "7.4 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
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
[b8c3180]41 &lfs76_checked;
[ee792ef]42
[d3469f0]43 <bridgehead renderas="sect3">Package Information</bridgehead>
44 <itemizedlist spacing="compact">
45 <listitem>
46 <para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para>
47 </listitem>
48 <listitem>
49 <para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para>
50 </listitem>
51 <listitem>
52 <para>Download MD5 sum: &stunnel-md5sum;</para>
53 </listitem>
54 <listitem>
55 <para>Download size: &stunnel-size;</para>
56 </listitem>
57 <listitem>
58 <para>Estimated disk space required: &stunnel-buildsize;</para>
59 </listitem>
60 <listitem>
61 <para>Estimated build time: &stunnel-time;</para>
62 </listitem>
63 </itemizedlist>
64
[436c2f7e]65 <bridgehead renderas="sect3">stunnel Dependencies</bridgehead>
[d3469f0]66
67 <bridgehead renderas="sect4">Required</bridgehead>
[372898b]68 <para role="required">
69 <xref linkend="openssl"/>
70 </para>
71
72 <bridgehead renderas="sect4">Optional</bridgehead>
73 <para role="optional">
74 <ulink url="ftp://ftp.porcupine.org/pub/security/">tcpwrappers</ulink>
75 </para>
[d3469f0]76
[3597eb6]77 <para condition="html" role="usernotes">User Notes:
78 <ulink url="&blfs-wiki;/stunnel"/></para>
79
[d3469f0]80 </sect2>
81
82 <sect2 role="installation">
[436c2f7e]83 <title>Installation of stunnel</title>
[d3469f0]84
85 <para>The <command>stunnel</command> daemon will be run in a
86 <command>chroot</command> jail by an unprivileged user. Create the
[1ae11c9]87 new user and group using the following commands as the
[50d61ed]88 <systemitem class="username">root</systemitem> user:</para>
[d3469f0]89
[b785ab29]90<screen role="root"><userinput>groupadd -g 51 stunnel &amp;&amp;
[436c2f7e]91useradd -c "stunnel Daemon" -d /var/lib/stunnel \
[1ae11c9]92 -g stunnel -s /bin/false -u 51 stunnel</userinput></screen>
[d3469f0]93
94 <note>
[372898b]95 <para>A signed SSL Certificate and a Private Key is necessary to run the
[3d37094]96 <command>stunnel</command> daemon. Further below, after
97 <command>make ... install</command>, we include instructions to generate
98 them. However, if you own, or have already created a signed SSL
99 Certificate you wish to use, copy it to
[50d61ed]100 <filename>/etc/stunnel/stunnel.pem</filename> before starting the build
[8ba08b56]101 (ensure only <systemitem class="username">root</systemitem> has read and
[372898b]102 write access). The <filename class="extension">.pem</filename> file must
103 be formatted as shown below:</para>
[d3469f0]104
[30ca77d2]105<screen><literal>-----BEGIN PRIVATE KEY-----
106<replaceable>&lt;many encrypted lines of private key&gt;</replaceable>
107-----END PRIVATE KEY-----
[2a7d6c3e]108-----BEGIN CERTIFICATE-----
[3597eb6]109<replaceable>&lt;many encrypted lines of certificate&gt;</replaceable>
[30ca77d2]110-----END CERTIFICATE-----
111-----BEGIN DH PARAMETERS-----
112<replaceable>&lt;encrypted lines of dh parms&gt;</replaceable>
113-----END DH PARAMETERS-----</literal></screen>
[d3469f0]114 </note>
[2a7d6c3e]115
[4da2d9f]116 <para>
117 Fix the bundled systemd unit so it does not use a deprecated dependency:
118 </para>
119
[b8c3180]120<screen><userinput>sed -i /syslog.target/d tools/stunnel.service.in</userinput></screen>
[4da2d9f]121
[436c2f7e]122 <para>Install <application>stunnel</application> by running the following
[d3469f0]123 commands:</para>
124
[ee792ef]125<screen><userinput>./configure --prefix=/usr \
[e1c116d]126 --sysconfdir=/etc \
[372898b]127 --localstatedir=/var &amp;&amp;
[d3469f0]128make</userinput></screen>
129
[50d61ed]130 <para>This package does not come with a test suite.</para>
131
[d3469f0]132 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
[305e60de]133
[1ae11c9]134<screen role="root"><userinput>make docdir=/usr/share/doc/stunnel-&stunnel-version; install</userinput></screen>
[305e60de]135
[4da2d9f]136 <para>
137 Install the systemd unit by running the following command as the
138 <systemitem class="username">root</systemitem> user:
139 </para>
140
141<screen role="root"><userinput>install -v -m644 tools/stunnel.service /lib/systemd/system/stunnel.service</userinput></screen>
142
[372898b]143 <para>To create the <filename>stunnel.pem</filename> in the
144 <filename class="directory">/etc/stunnel</filename> directory,
145 you need to create one. The following command prompts you
146 for the necessary information. Ensure you reply to the</para>
147
148<screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
149
150 <para>prompt with the name or IP address you will be using
151 to access the service(s).</para>
152
153 <para>To generate a certificate, as the
154 <systemitem class="username">root</systemitem> user, run:</para>
155
156<screen role="root"><userinput>make cert</userinput></screen>
157
[d3469f0]158 </sect2>
[2a7d6c3e]159
[d3469f0]160 <sect2 role="commands">
161 <title>Command Explanations</title>
[2a7d6c3e]162
[1ae11c9]163 <para><command>make docdir=... install</command>: This command installs the
164 package, changes the documentation installation directory to standard
[372898b]165 naming conventions.</para>
[2a7d6c3e]166
[d3469f0]167 </sect2>
[2a7d6c3e]168
[d3469f0]169 <sect2 role="configuration">
[436c2f7e]170 <title>Configuring stunnel</title>
[2a7d6c3e]171
[d3469f0]172 <sect3 id="stunnel-config">
173 <title>Config Files</title>
[2a7d6c3e]174
[d3469f0]175 <para><filename>/etc/stunnel/stunnel.conf</filename></para>
[2a7d6c3e]176
[d3469f0]177 <indexterm zone="stunnel stunnel-config">
178 <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
179 </indexterm>
[2a7d6c3e]180
[d3469f0]181 </sect3>
[2a7d6c3e]182
[d3469f0]183 <sect3>
184 <title>Configuration Information</title>
185
[1ae11c9]186 <para>As the <systemitem class="username">root</systemitem> user,
187 create the directory used for the
[8ba08b56]188 <filename class="extension">.pid</filename> file that is created
[436c2f7e]189 when the <application>stunnel</application> daemon starts:</para>
[1ae11c9]190
[8ba08b56]191<screen role="root"><userinput>install -v -m750 -o stunnel -g stunnel -d /var/lib/stunnel/run &amp;&amp;
192chown stunnel:stunnel /var/lib/stunnel</userinput></screen>
[1ae11c9]193
194 <para>Next, create a basic <filename>/etc/stunnel/stunnel.conf</filename>
195 configuration file using the following commands as the
196 <systemitem class="username">root</systemitem> user:</para>
[d3469f0]197
[708f97e9]198<screen role="root"><userinput>cat &gt;/etc/stunnel/stunnel.conf &lt;&lt; "EOF" &amp;&amp;
[1ae11c9]199<literal>; File: /etc/stunnel/stunnel.conf
[2a7d6c3e]200
[372898b]201; Note: The pid and output locations are relative to the chroot location.
202
[1ae11c9]203pid = /run/stunnel.pid
[2a7d6c3e]204chroot = /var/lib/stunnel
205client = no
206setuid = stunnel
[30ca77d2]207setgid = stunnel
[372898b]208cert = /etc/stunnel/stunnel.pem
209
210;debug = 7
211;output = stunnel.log
212
213;[https]
214;accept = 443
215;connect = 80
216;; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SSL
217;; Microsoft implementations do not use SSL close-notify alert and thus
218;; they are vulnerable to truncation attacks
219;TIMEOUTclose = 0</literal>
[2a7d6c3e]220
[708f97e9]221EOF
222chmod -v 644 /etc/stunnel/stunnel.conf</userinput></screen>
[2a7d6c3e]223
[1ae11c9]224 <para>Finally, you need to add the service(s) you wish to encrypt to the
225 configuration file. The format is as follows:</para>
[2a7d6c3e]226
[3597eb6]227<screen><literal>[<replaceable>&lt;service&gt;</replaceable>]
228accept = <replaceable>&lt;hostname:portnumber&gt;</replaceable>
229connect = <replaceable>&lt;hostname:portnumber&gt;</replaceable></literal></screen>
[d3469f0]230
[436c2f7e]231 <para>If you use <application>stunnel</application> to encrypt a daemon
[d3469f0]232 started from <command>[x]inetd</command>, you may need to disable that
233 daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
[3597eb6]234 corresponding <replaceable>&lt;service&gt;</replaceable>_stunnel service. You
[d3469f0]235 may have to add an appropriate entry in <filename>/etc/services</filename>
236 as well.</para>
237
238 <para>For a full explanation of the commands and syntax used in the
[96770a19]239 configuration file, run <command>man stunnel</command>.</para>
[d3469f0]240
241 </sect3>
242
243 <sect3 id="stunnel-init">
[96733af]244 <title>Systemd Units</title>
245
246 <para>
247 To start the <command>stunnel</command> daemon at boot,
248 enable the previously installed systemd unit by
249 running the following command as the
250 <systemitem class="username">root</systemitem> user:
251 </para>
[d3469f0]252
253 <indexterm zone="stunnel stunnel-init">
254 <primary sortas="f-stunnel">stunnel</primary>
255 </indexterm>
256
[4da2d9f]257<screen role="root"><userinput>systemctl enable stunnel</userinput></screen>
[d3469f0]258
259 </sect3>
260
261 </sect2>
262
263 <sect2 role="content">
264 <title>Contents</title>
265
266 <segmentedlist>
267 <segtitle>Installed Programs</segtitle>
268 <segtitle>Installed Library</segtitle>
269 <segtitle>Installed Directories</segtitle>
270
271 <seglistitem>
272 <seg>stunnel and stunnel3</seg>
273 <seg>libstunnel.so</seg>
[372898b]274 <seg>/etc/stunnel,
275 /usr/lib/stunnel,
276 /usr/share/doc/stunnel-&stunnel-version;, and
277 /var/lib/stunnel</seg>
[d3469f0]278 </seglistitem>
279 </segmentedlist>
280
281 <variablelist>
282 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
283 <?dbfo list-presentation="list"?>
[869b15ae]284 <?dbhtml list-presentation="table"?>
[d3469f0]285
286 <varlistentry id="stunnel-prog">
287 <term><command>stunnel</command></term>
288 <listitem>
289 <para> is a program designed to work as an SSL
290 encryption wrapper between remote clients and local
[3597eb6]291 (<command>{x}inetd</command>-startable) or remote servers.</para>
[d3469f0]292 <indexterm zone="stunnel stunnel-prog">
293 <primary sortas="b-stunnel">stunnel</primary>
294 </indexterm>
295 </listitem>
296 </varlistentry>
297
298 <varlistentry id="stunnel3">
299 <term><command>stunnel3</command></term>
300 <listitem>
301 <para>is a <application>Perl</application> wrapper script to use
302 <command>stunnel</command> 3.x syntax with <command>stunnel</command>
303 >=4.05.</para>
304 <indexterm zone="stunnel stunnel3">
305 <primary sortas="b-stunnel3">stunnel3</primary>
306 </indexterm>
307 </listitem>
308 </varlistentry>
309
310 <varlistentry id="libstunnel">
311 <term><filename class='libraryfile'>libstunnel.so</filename></term>
312 <listitem>
313 <para> contains the API functions required by
[436c2f7e]314 <application>stunnel</application>.</para>
[d3469f0]315 <indexterm zone="stunnel libstunnel">
316 <primary sortas="c-libstunnel">libstunnel.so</primary>
317 </indexterm>
318 </listitem>
319 </varlistentry>
320
321 </variablelist>
322
323 </sect2>
[2a7d6c3e]324
325</sect1>
Note: See TracBrowser for help on using the repository browser.