source: postlfs/security/stunnel.xml@ c1798f3

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt perl-modules 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 c1798f3 was a9c87c7, checked in by Bruce Dubbs <bdubbs@…>, 7 years ago

Update to feh-2.19.1.
Update to libgusb-0.2.11.
Update to tumbler-0.2.0.
Update to stunnel-5.42.

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

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