source: postlfs/security/stunnel.xml@ 45ab6c7

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 45ab6c7 was 45ab6c7, checked in by Xi Ruoyao <xry111@…>, 3 years ago

more SVN prop clean up

Remove "$LastChanged$" everywhere, and also some unused $Date$

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