source: postlfs/security/stunnel.xml@ 1c4b4e9

10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 1c4b4e9 was 1c4b4e9, checked in by Douglas R. Reno <renodr@…>, 3 years ago

Downgrade to BIND-9.16.11, add a security fix
Update to stunnel-5.58
Tags

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@24263 af4574ff-66df-0310-9fd7-8a98e5e911e0

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