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