1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY stunnel-download-http "http://www.stunnel.org/download/stunnel/src/stunnel-&stunnel-version;.tar.gz">
|
---|
8 | <!ENTITY stunnel-download-ftp "ftp://stunnel.mirt.net/stunnel/stunnel-&stunnel-version;.tar.gz">
|
---|
9 | <!ENTITY stunnel-md5sum "2c00153ad099a5f9c5609e8d1dbbe470">
|
---|
10 | <!ENTITY stunnel-size "497 KB">
|
---|
11 | <!ENTITY stunnel-buildsize "4.2 MB">
|
---|
12 | <!ENTITY stunnel-time "0.1 SBU">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="stunnel" xreflabel="Stunnel-&stunnel-version;">
|
---|
16 | <?dbhtml filename="stunnel.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>Stunnel-&stunnel-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="stunnel">
|
---|
26 | <primary sortas="a-Stunnel">Stunnel</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to Stunnel</title>
|
---|
31 |
|
---|
32 | <para>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 | like POP-2, POP-3, and IMAP servers, to standalone daemons like NNTP,
|
---|
38 | SMTP and HTTP, and in tunneling PPP over network sockets without changes
|
---|
39 | to the server package source code.</para>
|
---|
40 |
|
---|
41 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
42 | <itemizedlist spacing="compact">
|
---|
43 | <listitem>
|
---|
44 | <para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para>
|
---|
45 | </listitem>
|
---|
46 | <listitem>
|
---|
47 | <para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para>
|
---|
48 | </listitem>
|
---|
49 | <listitem>
|
---|
50 | <para>Download MD5 sum: &stunnel-md5sum;</para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>Download size: &stunnel-size;</para>
|
---|
54 | </listitem>
|
---|
55 | <listitem>
|
---|
56 | <para>Estimated disk space required: &stunnel-buildsize;</para>
|
---|
57 | </listitem>
|
---|
58 | <listitem>
|
---|
59 | <para>Estimated build time: &stunnel-time;</para>
|
---|
60 | </listitem>
|
---|
61 | </itemizedlist>
|
---|
62 |
|
---|
63 | <bridgehead renderas="sect3">Stunnel Dependencies</bridgehead>
|
---|
64 |
|
---|
65 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
66 | <para role="required"><xref linkend="openssl"/></para>
|
---|
67 |
|
---|
68 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
69 | <para role="optional"><xref linkend="tcpwrappers"/></para>
|
---|
70 |
|
---|
71 | <para condition="html" role="usernotes">User Notes:
|
---|
72 | <ulink url="&blfs-wiki;/stunnel"/></para>
|
---|
73 |
|
---|
74 | </sect2>
|
---|
75 |
|
---|
76 | <sect2 role="installation">
|
---|
77 | <title>Installation of Stunnel</title>
|
---|
78 |
|
---|
79 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
80 | <command>chroot</command> jail by an unprivileged user. Create the
|
---|
81 | new user, group and <command>chroot</command> home directory structure
|
---|
82 | using the following commands as the
|
---|
83 | <systemitem class="username">root</systemitem> user:</para>
|
---|
84 |
|
---|
85 | <screen role="root"><userinput>groupadd -g 51 stunnel &&
|
---|
86 | useradd -c "Stunnel Daemon" -d /var/lib/stunnel \
|
---|
87 | -g stunnel -s /bin/false -u 51 stunnel &&
|
---|
88 | install -v -m 1770 -o stunnel -g stunnel -d /var/lib/stunnel/run</userinput></screen>
|
---|
89 |
|
---|
90 | <note>
|
---|
91 | <para>A signed SSL Certificate and a Private Key is necessary to run
|
---|
92 | the <command>stunnel</command> daemon. If you own, or have already
|
---|
93 | created a signed SSL Certificate you wish to use, copy it to
|
---|
94 | <filename>/etc/stunnel/stunnel.pem</filename> before starting the build
|
---|
95 | (ensure only <systemitem class='username'>root</systemitem> has read and
|
---|
96 | write access), otherwise you will be
|
---|
97 | prompted to create one during the installation process. The
|
---|
98 | <filename class='extension'>.pem</filename> file must be formatted as
|
---|
99 | shown below:</para>
|
---|
100 |
|
---|
101 | <screen><literal>-----BEGIN RSA PRIVATE KEY-----
|
---|
102 | <replaceable><many encrypted lines of unencrypted key></replaceable>
|
---|
103 | -----END RSA PRIVATE KEY-----
|
---|
104 | -----BEGIN CERTIFICATE-----
|
---|
105 | <replaceable><many encrypted lines of certificate></replaceable>
|
---|
106 | -----END CERTIFICATE-----</literal></screen>
|
---|
107 | </note>
|
---|
108 |
|
---|
109 | <para>Install <application>Stunnel</application> by running the following
|
---|
110 | commands:</para>
|
---|
111 |
|
---|
112 | <screen><userinput>sed -i -e 's|nogroup|stunnel|' \
|
---|
113 | -e 's|$(prefix)/var/lib|$(localstatedir)|' \
|
---|
114 | tools/Makefile.in
|
---|
115 | sed -i 's|doc/stunnel|&-$(VERSION)|' {,doc/,tools/}Makefile.in &&
|
---|
116 |
|
---|
117 | ./configure --prefix=/usr --sysconfdir=/etc \
|
---|
118 | --localstatedir=/var/lib --disable-libwrap &&
|
---|
119 | make</userinput></screen>
|
---|
120 |
|
---|
121 | <para>This package does not come with a test suite.</para>
|
---|
122 |
|
---|
123 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
124 |
|
---|
125 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
126 |
|
---|
127 | </sect2>
|
---|
128 |
|
---|
129 | <sect2 role="commands">
|
---|
130 | <title>Command Explanations</title>
|
---|
131 |
|
---|
132 | <para><command>sed -i -e '...' -e '...' tools/Makefile.in</command>:
|
---|
133 | This <command>sed</command> command modifies the group and directory
|
---|
134 | used for the <command>chroot</command> jail to conform with the parameters
|
---|
135 | created earlier.</para>
|
---|
136 |
|
---|
137 | <para><command>sed -i '...' {,doc/,tools/}Makefile.in</command>: This
|
---|
138 | <command>sed</command> command modifies the location of the installed
|
---|
139 | docs to a versioned directory.</para>
|
---|
140 |
|
---|
141 | <para><parameter>--sysconfdir=/etc</parameter>: This parameter forces
|
---|
142 | the configuration directory to <filename class='directory'>/etc</filename>
|
---|
143 | instead of <filename class='directory'>/usr/etc</filename>.</para>
|
---|
144 |
|
---|
145 | <para><parameter>--localstatedir=/var/lib</parameter>: This parameter
|
---|
146 | sets the installation to use
|
---|
147 | <filename class='directory'>/var/lib/stunnel</filename> instead of
|
---|
148 | creating and using
|
---|
149 | <filename class='directory'>/usr/var/stunnel</filename>.</para>
|
---|
150 |
|
---|
151 | <para><parameter>--disable-libwrap</parameter>: This parameter is required
|
---|
152 | if you don't have <application>tcpwrappers</application> installed. Remove
|
---|
153 | the parameter if <application>tcpwrappers</application> is installed.</para>
|
---|
154 |
|
---|
155 | <para><command>make install</command>: This command installs the package
|
---|
156 | and, if you did not copy an <filename>stunnel.pem</filename> file to the
|
---|
157 | <filename class='directory'>/etc/stunnel</filename> directory, prompts you
|
---|
158 | for the necessary information to create one. Ensure you reply to the</para>
|
---|
159 |
|
---|
160 | <screen><prompt>Common Name (FQDN of your server) [localhost]:</prompt></screen>
|
---|
161 |
|
---|
162 | <para>prompt with the name or IP address you will be using
|
---|
163 | to access the service(s).</para>
|
---|
164 |
|
---|
165 | </sect2>
|
---|
166 |
|
---|
167 | <sect2 role="configuration">
|
---|
168 | <title>Configuring Stunnel</title>
|
---|
169 |
|
---|
170 | <sect3 id="stunnel-config">
|
---|
171 | <title>Config Files</title>
|
---|
172 |
|
---|
173 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
174 |
|
---|
175 | <indexterm zone="stunnel stunnel-config">
|
---|
176 | <primary sortas="e-etc-stunnel-stunnel.conf">/etc/stunnel/stunnel.conf</primary>
|
---|
177 | </indexterm>
|
---|
178 |
|
---|
179 | </sect3>
|
---|
180 |
|
---|
181 | <sect3>
|
---|
182 | <title>Configuration Information</title>
|
---|
183 |
|
---|
184 | <para>Create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
185 | configuration file using the following commands:</para>
|
---|
186 |
|
---|
187 | <screen role="root"><userinput>cat >/etc/stunnel/stunnel.conf << "EOF" &&
|
---|
188 | <literal># File: /etc/stunnel/stunnel.conf
|
---|
189 |
|
---|
190 | pid = /run/stunnel.pid
|
---|
191 | chroot = /var/lib/stunnel
|
---|
192 | client = no
|
---|
193 | setuid = stunnel
|
---|
194 | setgid = stunnel</literal>
|
---|
195 |
|
---|
196 | EOF
|
---|
197 | chmod -v 644 /etc/stunnel/stunnel.conf</userinput></screen>
|
---|
198 |
|
---|
199 | <para>Next, you need to add the service(s) you wish to encrypt to the
|
---|
200 | configuration file. The format is as follows:</para>
|
---|
201 |
|
---|
202 | <screen><literal>[<replaceable><service></replaceable>]
|
---|
203 | accept = <replaceable><hostname:portnumber></replaceable>
|
---|
204 | connect = <replaceable><hostname:portnumber></replaceable></literal></screen>
|
---|
205 |
|
---|
206 | <para>If you use <application>Stunnel</application> to encrypt a daemon
|
---|
207 | started from <command>[x]inetd</command>, you may need to disable that
|
---|
208 | daemon in the <filename>/etc/[x]inetd.conf</filename> file and enable a
|
---|
209 | corresponding <replaceable><service></replaceable>_stunnel service. You
|
---|
210 | may have to add an appropriate entry in <filename>/etc/services</filename>
|
---|
211 | as well.</para>
|
---|
212 |
|
---|
213 | <para>For a full explanation of the commands and syntax used in the
|
---|
214 | configuration file, run <command>man stunnel</command>. To see a
|
---|
215 | BLFS example of an actual setup of an <command>stunnel</command> encrypted
|
---|
216 | service, read the <xref linkend="samba3-swat-config"/> in the
|
---|
217 | <application>Samba</application> instructions.</para>
|
---|
218 |
|
---|
219 | </sect3>
|
---|
220 |
|
---|
221 | <sect3 id="stunnel-init">
|
---|
222 | <title>Boot Script</title>
|
---|
223 |
|
---|
224 | <para>To automatically start the <command>stunnel</command> daemon
|
---|
225 | when the system is rebooted, install the
|
---|
226 | <filename>/etc/rc.d/init.d/stunnel</filename> bootscript from the
|
---|
227 | <xref linkend="bootscripts"/> package.</para>
|
---|
228 |
|
---|
229 | <indexterm zone="stunnel stunnel-init">
|
---|
230 | <primary sortas="f-stunnel">stunnel</primary>
|
---|
231 | </indexterm>
|
---|
232 |
|
---|
233 | <screen role="root"><userinput>make install-stunnel</userinput></screen>
|
---|
234 |
|
---|
235 | </sect3>
|
---|
236 |
|
---|
237 | </sect2>
|
---|
238 |
|
---|
239 | <sect2 role="content">
|
---|
240 | <title>Contents</title>
|
---|
241 |
|
---|
242 | <segmentedlist>
|
---|
243 | <segtitle>Installed Programs</segtitle>
|
---|
244 | <segtitle>Installed Library</segtitle>
|
---|
245 | <segtitle>Installed Directories</segtitle>
|
---|
246 |
|
---|
247 | <seglistitem>
|
---|
248 | <seg>stunnel and stunnel3</seg>
|
---|
249 | <seg>libstunnel.so</seg>
|
---|
250 | <seg>/etc/stunnel, /var/lib/stunnel and
|
---|
251 | /usr/share/doc/stunnel-&stunnel-version;</seg>
|
---|
252 | </seglistitem>
|
---|
253 | </segmentedlist>
|
---|
254 |
|
---|
255 | <variablelist>
|
---|
256 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
257 | <?dbfo list-presentation="list"?>
|
---|
258 | <?dbhtml list-presentation="table"?>
|
---|
259 |
|
---|
260 | <varlistentry id="stunnel-prog">
|
---|
261 | <term><command>stunnel</command></term>
|
---|
262 | <listitem>
|
---|
263 | <para> is a program designed to work as an SSL
|
---|
264 | encryption wrapper between remote clients and local
|
---|
265 | (<command>{x}inetd</command>-startable) or remote servers.</para>
|
---|
266 | <indexterm zone="stunnel stunnel-prog">
|
---|
267 | <primary sortas="b-stunnel">stunnel</primary>
|
---|
268 | </indexterm>
|
---|
269 | </listitem>
|
---|
270 | </varlistentry>
|
---|
271 |
|
---|
272 | <varlistentry id="stunnel3">
|
---|
273 | <term><command>stunnel3</command></term>
|
---|
274 | <listitem>
|
---|
275 | <para>is a <application>Perl</application> wrapper script to use
|
---|
276 | <command>stunnel</command> 3.x syntax with <command>stunnel</command>
|
---|
277 | >=4.05.</para>
|
---|
278 | <indexterm zone="stunnel stunnel3">
|
---|
279 | <primary sortas="b-stunnel3">stunnel3</primary>
|
---|
280 | </indexterm>
|
---|
281 | </listitem>
|
---|
282 | </varlistentry>
|
---|
283 |
|
---|
284 | <varlistentry id="libstunnel">
|
---|
285 | <term><filename class='libraryfile'>libstunnel.so</filename></term>
|
---|
286 | <listitem>
|
---|
287 | <para> contains the API functions required by
|
---|
288 | <application>Stunnel</application>.</para>
|
---|
289 | <indexterm zone="stunnel libstunnel">
|
---|
290 | <primary sortas="c-libstunnel">libstunnel.so</primary>
|
---|
291 | </indexterm>
|
---|
292 | </listitem>
|
---|
293 | </varlistentry>
|
---|
294 |
|
---|
295 | </variablelist>
|
---|
296 |
|
---|
297 | </sect2>
|
---|
298 |
|
---|
299 | </sect1>
|
---|