source: postlfs/security/stunnel.xml@ 3c7bd00

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 8.0 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 nosym 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 3c7bd00 was 3c7bd00, checked in by DJ Lucas <dj@…>, 8 years ago

Temporary render fix for bootscripts with REV=systemd.

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

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