source: postlfs/security/stunnel.xml@ 894d7107

12.0 12.1 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 894d7107 was 14891a90, checked in by Xi Ruoyao <xry111@…>, 11 months ago

treewide: More "User Notes" clean up

Remove links to pages w/o real contents.

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