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 "23ddd3c3bd92873deb0caadba12f9574">
|
---|
13 | <!ENTITY stunnel-size "876 KB">
|
---|
14 | <!ENTITY stunnel-buildsize "7.5 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 | &lfs120_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 &&
|
---|
104 | useradd -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><many encrypted lines of private key></replaceable>
|
---|
121 | -----END PRIVATE KEY-----
|
---|
122 | -----BEGIN CERTIFICATE-----
|
---|
123 | <replaceable><many encrypted lines of certificate></replaceable>
|
---|
124 | -----END CERTIFICATE-----
|
---|
125 | -----BEGIN DH PARAMETERS-----
|
---|
126 | <replaceable><encrypted lines of dh parms></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 | <screen revision="sysv"><userinput>./configure --prefix=/usr \
|
---|
137 | --sysconfdir=/etc \
|
---|
138 | --localstatedir=/var \
|
---|
139 | --disable-systemd &&
|
---|
140 | make</userinput></screen>
|
---|
141 |
|
---|
142 | <screen revision="systemd"><userinput>./configure --prefix=/usr \
|
---|
143 | --sysconfdir=/etc \
|
---|
144 | --localstatedir=/var &&
|
---|
145 | make</userinput></screen>
|
---|
146 |
|
---|
147 | <para>
|
---|
148 | If you have installed the optional netcat application, the
|
---|
149 | regression tests can be run with <command>make check</command>.
|
---|
150 | </para>
|
---|
151 |
|
---|
152 | <para>
|
---|
153 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
154 | </para>
|
---|
155 |
|
---|
156 | <screen role="root"><userinput>make docdir=/usr/share/doc/stunnel-&stunnel-version; install</userinput></screen>
|
---|
157 |
|
---|
158 | <para revision="systemd">
|
---|
159 | Install the included systemd unit by running the following command as the
|
---|
160 | <systemitem class="username">root</systemitem> user:
|
---|
161 | </para>
|
---|
162 |
|
---|
163 | <screen role="root" revision="systemd"><userinput>install -v -m644 tools/stunnel.service /usr/lib/systemd/system</userinput></screen>
|
---|
164 |
|
---|
165 | <para>
|
---|
166 | If you do not already have a signed SSL Certificate and Private Key,
|
---|
167 | create the <filename>stunnel.pem</filename> file in the
|
---|
168 | <filename class="directory">/etc/stunnel</filename> directory using the
|
---|
169 | command below. You will be prompted to enter the necessary
|
---|
170 | information. Ensure you reply to the
|
---|
171 | </para>
|
---|
172 |
|
---|
173 | <screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
|
---|
174 |
|
---|
175 | <para>
|
---|
176 | prompt with the name or IP address you will be using
|
---|
177 | to access the service(s).
|
---|
178 | </para>
|
---|
179 |
|
---|
180 | <para>
|
---|
181 | To generate a certificate, as the
|
---|
182 | <systemitem class="username">root</systemitem> user, issue:
|
---|
183 | </para>
|
---|
184 |
|
---|
185 | <screen role="root"><userinput>make cert</userinput></screen>
|
---|
186 |
|
---|
187 | </sect2>
|
---|
188 |
|
---|
189 | <sect2 role="commands">
|
---|
190 | <title>Command Explanations</title>
|
---|
191 |
|
---|
192 | <para revision="sysv">
|
---|
193 | <parameter>--disable-systemd</parameter>: This switch disables systemd
|
---|
194 | socket activation support which is not available in BLFS.
|
---|
195 | </para>
|
---|
196 |
|
---|
197 | <para>
|
---|
198 | <command>make docdir=... install</command>: This command installs the
|
---|
199 | package and changes the documentation installation directory to standard
|
---|
200 | naming conventions.
|
---|
201 | </para>
|
---|
202 |
|
---|
203 | </sect2>
|
---|
204 |
|
---|
205 | <sect2 role="configuration">
|
---|
206 | <title>Configuring stunnel</title>
|
---|
207 |
|
---|
208 | <sect3 id="stunnel-config">
|
---|
209 | <title>Config Files</title>
|
---|
210 |
|
---|
211 | <para>
|
---|
212 | <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
213 | </para>
|
---|
214 |
|
---|
215 | <indexterm zone="stunnel stunnel-config">
|
---|
216 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
217 | </indexterm>
|
---|
218 |
|
---|
219 | </sect3>
|
---|
220 |
|
---|
221 | <sect3>
|
---|
222 | <title>Configuration Information</title>
|
---|
223 |
|
---|
224 | <para>
|
---|
225 | As the <systemitem class="username">root</systemitem> user,
|
---|
226 | create the directory used for the
|
---|
227 | <filename class="extension">.pid</filename> file created
|
---|
228 | when the <application>stunnel</application> daemon starts:
|
---|
229 | </para>
|
---|
230 |
|
---|
231 | <screen role="root"><userinput>install -v -m750 -o stunnel -g stunnel -d /var/lib/stunnel/run &&
|
---|
232 | chown stunnel:stunnel /var/lib/stunnel</userinput></screen>
|
---|
233 |
|
---|
234 | <para>
|
---|
235 | Next, create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
236 | configuration file using the following commands as the
|
---|
237 | <systemitem class="username">root</systemitem> user:
|
---|
238 | </para>
|
---|
239 |
|
---|
240 | <screen role="root"><userinput>cat > /etc/stunnel/stunnel.conf << "EOF"
|
---|
241 | <literal>; File: /etc/stunnel/stunnel.conf
|
---|
242 |
|
---|
243 | ; Note: The pid and output locations are relative to the chroot location.
|
---|
244 |
|
---|
245 | pid = /run/stunnel.pid
|
---|
246 | chroot = /var/lib/stunnel
|
---|
247 | client = no
|
---|
248 | setuid = stunnel
|
---|
249 | setgid = stunnel
|
---|
250 | cert = /etc/stunnel/stunnel.pem
|
---|
251 |
|
---|
252 | ;debug = 7
|
---|
253 | ;output = stunnel.log
|
---|
254 |
|
---|
255 | ;[https]
|
---|
256 | ;accept = 443
|
---|
257 | ;connect = 80
|
---|
258 | ;; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SSL
|
---|
259 | ;; Microsoft implementations do not use SSL close-notify alert and thus
|
---|
260 | ;; they are vulnerable to truncation attacks
|
---|
261 | ;TIMEOUTclose = 0</literal>
|
---|
262 |
|
---|
263 | EOF</userinput></screen>
|
---|
264 |
|
---|
265 | <para>
|
---|
266 | Finally, add the service(s) you wish to encrypt to the
|
---|
267 | configuration file. The format is as follows:
|
---|
268 | </para>
|
---|
269 |
|
---|
270 | <screen><literal>[<replaceable><service></replaceable>]
|
---|
271 | accept = <replaceable><hostname:portnumber></replaceable>
|
---|
272 | connect = <replaceable><hostname:portnumber></replaceable></literal></screen>
|
---|
273 |
|
---|
274 | <!--
|
---|
275 | <para>
|
---|
276 | If you use <application>stunnel</application> to encrypt a daemon
|
---|
277 | started from <command>[x]inetd</command>, you may need to disable that
|
---|
278 | daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
|
---|
279 | corresponding <replaceable><service></replaceable>_stunnel
|
---|
280 | service. You may have to add an appropriate entry in
|
---|
281 | <filename>/etc/services</filename> as well.
|
---|
282 | </para>
|
---|
283 | -->
|
---|
284 |
|
---|
285 | <para>
|
---|
286 | For a full explanation of the commands and syntax used in the
|
---|
287 | configuration file, issue <command>man stunnel</command>.
|
---|
288 | </para>
|
---|
289 |
|
---|
290 | </sect3>
|
---|
291 |
|
---|
292 | <sect3 id="stunnel-init">
|
---|
293 | <title><phrase revision="sysv">Boot Script</phrase>
|
---|
294 | <phrase revision="systemd">Systemd Unit</phrase></title>
|
---|
295 |
|
---|
296 | <para revision="sysv">
|
---|
297 | To automatically start the <command>stunnel</command> daemon when the
|
---|
298 | system is booted, install the
|
---|
299 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
300 | <xref linkend="bootscripts"/> package.
|
---|
301 | </para>
|
---|
302 |
|
---|
303 | <para revision="systemd">
|
---|
304 | To start the <command>stunnel</command>
|
---|
305 | daemon at boot, enable the previously installed
|
---|
306 | <application>systemd</application> unit by running the following
|
---|
307 | command as the <systemitem class="username">root</systemitem> user:
|
---|
308 | </para>
|
---|
309 |
|
---|
310 | <indexterm zone="stunnel stunnel-init">
|
---|
311 | <primary sortas="f-stunnel">stunnel</primary>
|
---|
312 | </indexterm>
|
---|
313 |
|
---|
314 | <screen role="root" revision="sysv"><userinput>make install-stunnel</userinput></screen>
|
---|
315 |
|
---|
316 | <screen role="root" revision="systemd"><userinput>systemctl enable stunnel</userinput></screen>
|
---|
317 |
|
---|
318 | </sect3>
|
---|
319 |
|
---|
320 | </sect2>
|
---|
321 |
|
---|
322 | <sect2 role="content">
|
---|
323 | <title>Contents</title>
|
---|
324 |
|
---|
325 | <segmentedlist>
|
---|
326 | <segtitle>Installed Programs</segtitle>
|
---|
327 | <segtitle>Installed Library</segtitle>
|
---|
328 | <segtitle>Installed Directories</segtitle>
|
---|
329 |
|
---|
330 | <seglistitem>
|
---|
331 | <seg>
|
---|
332 | stunnel and stunnel3
|
---|
333 | </seg>
|
---|
334 | <seg>
|
---|
335 | libstunnel.so
|
---|
336 | </seg>
|
---|
337 | <seg>
|
---|
338 | /{etc,lib,var/lib}/stunnel and
|
---|
339 | /usr/share/doc/stunnel-&stunnel-version;
|
---|
340 | </seg>
|
---|
341 | </seglistitem>
|
---|
342 | </segmentedlist>
|
---|
343 |
|
---|
344 | <variablelist>
|
---|
345 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
346 | <?dbfo list-presentation="list"?>
|
---|
347 | <?dbhtml list-presentation="table"?>
|
---|
348 |
|
---|
349 | <varlistentry id="stunnel-prog">
|
---|
350 | <term><command>stunnel</command></term>
|
---|
351 | <listitem>
|
---|
352 | <para>
|
---|
353 | is a program designed to work as an SSL
|
---|
354 | encryption wrapper between remote clients and local
|
---|
355 | or remote servers
|
---|
356 | </para>
|
---|
357 | <indexterm zone="stunnel stunnel-prog">
|
---|
358 | <primary sortas="b-stunnel">stunnel</primary>
|
---|
359 | </indexterm>
|
---|
360 | </listitem>
|
---|
361 | </varlistentry>
|
---|
362 |
|
---|
363 | <varlistentry id="stunnel3">
|
---|
364 | <term><command>stunnel3</command></term>
|
---|
365 | <listitem>
|
---|
366 | <para>
|
---|
367 | is a <application>Perl</application> wrapper script to use
|
---|
368 | <command>stunnel</command> 3.x syntax with
|
---|
369 | <command>stunnel</command> 4.05 or later
|
---|
370 | </para>
|
---|
371 | <indexterm zone="stunnel stunnel3">
|
---|
372 | <primary sortas="b-stunnel3">stunnel3</primary>
|
---|
373 | </indexterm>
|
---|
374 | </listitem>
|
---|
375 | </varlistentry>
|
---|
376 |
|
---|
377 | <varlistentry id="libstunnel">
|
---|
378 | <term><filename class="libraryfile">libstunnel.so</filename></term>
|
---|
379 | <listitem>
|
---|
380 | <para>
|
---|
381 | contains the API functions required by
|
---|
382 | <application>stunnel</application>
|
---|
383 | </para>
|
---|
384 | <indexterm zone="stunnel libstunnel">
|
---|
385 | <primary sortas="c-libstunnel">libstunnel.so</primary>
|
---|
386 | </indexterm>
|
---|
387 | </listitem>
|
---|
388 | </varlistentry>
|
---|
389 |
|
---|
390 | </variablelist>
|
---|
391 |
|
---|
392 | </sect2>
|
---|
393 |
|
---|
394 | </sect1>
|
---|