1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.3/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://ftp.fu-berlin.de/unix/linux/mirrors/gentoo/distfiles/stunnel-&stunnel-version;.tar.gz">
|
---|
9 | <!ENTITY stunnel-size "341 KB">
|
---|
10 | <!ENTITY stunnel-buildsize "2.9 MB">
|
---|
11 | <!ENTITY stunnel-time "0.08 SBU">
|
---|
12 | ]>
|
---|
13 |
|
---|
14 | <sect1 id="stunnel" xreflabel="Stunnel-&stunnel-version;">
|
---|
15 | <sect1info>
|
---|
16 | <othername>$LastChangedBy$</othername>
|
---|
17 | <date>$Date$</date>
|
---|
18 | </sect1info>
|
---|
19 | <?dbhtml filename="stunnel.html"?>
|
---|
20 | <title>Stunnel-&stunnel-version;</title>
|
---|
21 |
|
---|
22 | <sect2>
|
---|
23 | <title>Introduction to <application>Stunnel</application></title>
|
---|
24 |
|
---|
25 | <para>The <application>Stunnel</application> package contains a program that
|
---|
26 | allows you to encrypt arbitrary <acronym>TCP</acronym> connections inside
|
---|
27 | <acronym>SSL</acronym> (Secure Sockets Layer) so you can easily communicate
|
---|
28 | with clients over secure channels. <application>Stunnel</application> can be
|
---|
29 | used to add <acronym>SSL</acronym> functionality to commonly used Inetd
|
---|
30 | daemons like <acronym>POP</acronym>-2, <acronym>POP</acronym>-3, and
|
---|
31 | <acronym>IMAP</acronym> servers, to standalone daemons like
|
---|
32 | <acronym>NNTP</acronym>, <acronym>SMTP</acronym> and <acronym>HTTP</acronym>,
|
---|
33 | and in tunneling <acronym>PPP</acronym> over network sockets without changes
|
---|
34 | to the server package source code.</para>
|
---|
35 |
|
---|
36 | <sect3><title>Package information</title>
|
---|
37 | <itemizedlist spacing="compact">
|
---|
38 | <listitem><para>Download (HTTP): <ulink url="&stunnel-download-http;"/></para></listitem>
|
---|
39 | <listitem><para>Download (FTP): <ulink url="&stunnel-download-ftp;"/></para></listitem>
|
---|
40 | <listitem><para>Download size: &stunnel-size;</para></listitem>
|
---|
41 | <listitem><para>Estimated disk space required: &stunnel-buildsize;</para></listitem>
|
---|
42 | <listitem><para>Estimated build time: &stunnel-time;</para></listitem></itemizedlist>
|
---|
43 | </sect3>
|
---|
44 |
|
---|
45 | <sect3><title><application>Stunnel</application> dependencies</title>
|
---|
46 | <sect4><title>Required</title>
|
---|
47 | <para><xref linkend="openssl"/></para>
|
---|
48 | </sect4>
|
---|
49 |
|
---|
50 | <sect4><title>Optional</title>
|
---|
51 | <para><xref linkend="tcpwrappers"/></para>
|
---|
52 | </sect4>
|
---|
53 | </sect3>
|
---|
54 |
|
---|
55 | </sect2>
|
---|
56 |
|
---|
57 | <sect2>
|
---|
58 | <title>Installation of <application>Stunnel</application></title>
|
---|
59 |
|
---|
60 | <para>The <command>stunnel</command> daemon will be run in a
|
---|
61 | <command>chroot</command> jail by an unprivileged user. Create the new user,
|
---|
62 | group and <command>chroot</command> home directory structure using the
|
---|
63 | following commands:</para>
|
---|
64 |
|
---|
65 | <screen><userinput><command>groupadd stunnel &&
|
---|
66 | useradd -c "Stunnel Daemon" -d /var/lib/stunnel -g stunnel -s /bin/false stunnel &&
|
---|
67 | install -d -m 700 -o stunnel -g stunnel /var/lib/stunnel/run</command></userinput></screen>
|
---|
68 |
|
---|
69 | <note><para>A signed <acronym>SSL</acronym> Certificate and a Private Key is
|
---|
70 | necessary to run the <command>stunnel</command> daemon. If you own, or have
|
---|
71 | already created a signed <acronym>SSL</acronym> Certificate you wish to use,
|
---|
72 | copy it to <filename>tools/stunnel.pem</filename> in the source directory
|
---|
73 | before starting the build, otherwise you will be prompted to create one. The
|
---|
74 | <filename>.pem</filename> file must be formatted as shown below:</para>
|
---|
75 |
|
---|
76 | <screen>-----BEGIN RSA PRIVATE KEY-----
|
---|
77 | <replaceable>[many encrypted lines of unencrypted key]</replaceable>
|
---|
78 | -----END RSA PRIVATE KEY-----
|
---|
79 | -----BEGIN CERTIFICATE-----
|
---|
80 | <replaceable>[many encrypted lines of certificate]</replaceable>
|
---|
81 | -----END CERTIFICATE-----</screen></note>
|
---|
82 |
|
---|
83 | <para>Install <application>Stunnel</application> by running the following
|
---|
84 | commands:</para>
|
---|
85 |
|
---|
86 | <screen><userinput><command>./configure --prefix=/usr --sysconfdir=/etc &&
|
---|
87 | make &&
|
---|
88 | make install</command></userinput></screen>
|
---|
89 |
|
---|
90 | </sect2>
|
---|
91 |
|
---|
92 | <sect2>
|
---|
93 | <title>Command explanations</title>
|
---|
94 |
|
---|
95 | <para><parameter>--sysconfdir=/etc</parameter>: This parameter forces the
|
---|
96 | configuration directory to <filename class='directory'>/etc</filename> instead
|
---|
97 | of <filename class='directory'>/usr/etc</filename>.</para>
|
---|
98 |
|
---|
99 | <para><command>make</command>: This command builds the package and, if you
|
---|
100 | did not copy an <filename>stunnel.pem</filename> file to the source
|
---|
101 | <filename class='directory'>tools/</filename> directory, prompts you for the
|
---|
102 | necessary information to create one. Ensure you reply to the</para>
|
---|
103 |
|
---|
104 | <screen><computeroutput>Common Name (FQDN of your server) [localhost]:</computeroutput></screen>
|
---|
105 |
|
---|
106 | <para>prompt with the name or <acronym>IP</acronym> address you will be using
|
---|
107 | to access the service.</para>
|
---|
108 |
|
---|
109 | </sect2>
|
---|
110 |
|
---|
111 | <sect2>
|
---|
112 | <title>Configuring <application>Stunnel</application></title>
|
---|
113 |
|
---|
114 | <sect3><title>Config files</title>
|
---|
115 | <para><filename>/etc/stunnel/stunnel.conf</filename></para>
|
---|
116 | </sect3>
|
---|
117 |
|
---|
118 | <sect3><title>Configuration Information</title>
|
---|
119 |
|
---|
120 | <para>Create a basic <filename>/etc/stunnel/stunnel.conf</filename>
|
---|
121 | configuration file using the following commands:</para>
|
---|
122 |
|
---|
123 | <screen><userinput><command>cat >/etc/stunnel/stunnel.conf << "EOF"</command>
|
---|
124 | # File: /etc/stunnel/stunnel.conf
|
---|
125 |
|
---|
126 | pid = /run/stunnel.pid
|
---|
127 | chroot = /var/lib/stunnel
|
---|
128 | client = no
|
---|
129 | setuid = stunnel
|
---|
130 | setgid = stunnel
|
---|
131 |
|
---|
132 | <command>EOF</command></userinput></screen>
|
---|
133 |
|
---|
134 | <para>Next, you need to add the service you wish to encrypt to the
|
---|
135 | configuration file. The format is as follows:</para>
|
---|
136 |
|
---|
137 | <screen><userinput>[<replaceable>[service]</replaceable>]
|
---|
138 | accept = <replaceable>[hostname:portnumber]</replaceable>
|
---|
139 | connect = <replaceable>[hostname:portnumber]</replaceable></userinput></screen>
|
---|
140 |
|
---|
141 | <para>If you use <application>Stunnel</application> to encrypt a daemon
|
---|
142 | started from <command>[x]inetd</command>, you may need to disable that daemon
|
---|
143 | in the <filename>/etc/[x]inetd.conf</filename> file and enable a corresponding
|
---|
144 | <replaceable>[service]</replaceable>_stunnel service. You may have to add an
|
---|
145 | appropriate entry in <filename>/etc/services</filename> as well.</para>
|
---|
146 |
|
---|
147 | <para>For a full explanation of the commands and syntax used in the
|
---|
148 | configuration file, run <command>man stunnel</command>. To see a
|
---|
149 | <acronym>BLFS</acronym> example of an actual setup of an
|
---|
150 | <command>stunnel</command> encrypted service, read the
|
---|
151 | <acronym>SWAT</acronym> configuration section in the <xref linkend="samba3"/>
|
---|
152 | instructions.</para>
|
---|
153 |
|
---|
154 | <para>To automatically start the <command>stunnel</command> daemon when the system
|
---|
155 | is rebooted, install the <filename>/etc/rc.d/init.d/stunnel</filename>
|
---|
156 | bootscript from the <xref linkend="intro-important-bootscripts"/>
|
---|
157 | package.</para>
|
---|
158 |
|
---|
159 | <screen><userinput><command>make install-stunnel</command></userinput></screen>
|
---|
160 | </sect3>
|
---|
161 |
|
---|
162 | </sect2>
|
---|
163 |
|
---|
164 | <sect2>
|
---|
165 | <title>Contents</title>
|
---|
166 |
|
---|
167 | <para>The <application>Stunnel</application> package contains
|
---|
168 | <command>stunnel</command> and
|
---|
169 | <filename class='libraryfile'>libstunnel</filename>.</para>
|
---|
170 |
|
---|
171 | </sect2>
|
---|
172 |
|
---|
173 | <sect2><title>Description</title>
|
---|
174 |
|
---|
175 | <sect3><title>stunnel</title>
|
---|
176 | <para><command>stunnel</command> is a program designed to work as an
|
---|
177 | <acronym>SSL</acronym> encryption wrapper between remote clients and local
|
---|
178 | (<command>[x]inetd</command>-startable) or remote servers.</para></sect3>
|
---|
179 |
|
---|
180 | </sect2>
|
---|
181 |
|
---|
182 | </sect1>
|
---|
183 |
|
---|