2006-02-28 00:55:26 +01:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
|
|
|
<article>
|
|
|
|
<!--$Id$-->
|
|
|
|
|
|
|
|
<articleinfo>
|
2006-06-03 19:16:27 +02:00
|
|
|
<title>Compiled Firewall Programs and Shorewall Lite</title>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
|
|
|
<authorgroup>
|
|
|
|
<author>
|
|
|
|
<firstname>Tom</firstname>
|
|
|
|
|
|
|
|
<surname>Eastep</surname>
|
|
|
|
</author>
|
|
|
|
</authorgroup>
|
|
|
|
|
2006-06-14 16:55:49 +02:00
|
|
|
<pubdate>2006-06-14</pubdate>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
|
|
|
<copyright>
|
|
|
|
<year>2006</year>
|
|
|
|
|
|
|
|
<holder>Thomas M. Eastep</holder>
|
|
|
|
</copyright>
|
|
|
|
|
|
|
|
<legalnotice>
|
|
|
|
<para>Permission is granted to copy, distribute and/or modify this
|
|
|
|
document under the terms of the GNU Free Documentation License, Version
|
|
|
|
1.2 or any later version published by the Free Software Foundation; with
|
|
|
|
no Invariant Sections, with no Front-Cover, and with no Back-Cover
|
|
|
|
Texts. A copy of the license is included in the section entitled
|
|
|
|
<quote><ulink url="GnuCopyright.htm">GNU Free Documentation
|
|
|
|
License</ulink></quote>.</para>
|
|
|
|
</legalnotice>
|
|
|
|
</articleinfo>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Overview</title>
|
|
|
|
|
|
|
|
<para>Beginning with Shorewall version 3.1, Shorewall has the capability
|
|
|
|
to compile a Shorewall configuration and produce a runnable firewall
|
2006-06-13 02:07:00 +02:00
|
|
|
program script. The script is a complete program which can be placed on a
|
|
|
|
system with <emphasis>Shorewall Lite</emphasis> installed and can serve as
|
|
|
|
the firewall creation script for that system.</para>
|
2006-03-09 22:02:15 +01:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>Restrictions</title>
|
|
|
|
|
|
|
|
<para>While compiled Shorewall programs are useful in many cases, there
|
|
|
|
are some important restrictions that you should be aware of before
|
|
|
|
attempting to use them.</para>
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>The <emphasis role="bold">detectnets</emphasis> interface
|
|
|
|
option is not supported.</para>
|
|
|
|
</listitem>
|
|
|
|
|
2006-06-05 02:19:04 +02:00
|
|
|
<listitem>
|
|
|
|
<para>DYNAMIC_ZONES=Yes in <filename>shorewall.conf</filename> is
|
|
|
|
not supported.</para>
|
|
|
|
</listitem>
|
|
|
|
|
2006-03-09 22:02:15 +01:00
|
|
|
<listitem>
|
|
|
|
<para>All extension scripts used are copied into the program. The
|
|
|
|
ramifications of this are:</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>If you update an extension script, the compiled program
|
|
|
|
will not use the updated script.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>The <filename>/etc/shorewall/params</filename> extension
|
|
|
|
script is executed at compile time as well as at run
|
|
|
|
time.</para>
|
|
|
|
|
|
|
|
<para>Running the script at compile time allows variable
|
|
|
|
expansion (expanding $variable to it's defined value) of
|
|
|
|
variables used in Shorewall configuration files to occur at
|
|
|
|
compile time. Running it at run-time allows your extension
|
|
|
|
scripts to use the variables that it creates. BUT -- for any
|
|
|
|
given variable, the value at compile time may be different from
|
|
|
|
the value at run-time unless you only assign constant
|
|
|
|
values.</para>
|
|
|
|
|
|
|
|
<para>For example, if you have:</para>
|
|
|
|
|
2006-03-09 22:05:59 +01:00
|
|
|
<programlisting>EXT_IP=$(fiind_first_interface_address eth0)</programlisting>
|
2006-03-09 22:02:15 +01:00
|
|
|
|
|
|
|
<para>in <filename>/etc/shorewall/params</filename> then all
|
|
|
|
occurrences of $EXT_IP in Shorewall configuration files will be
|
|
|
|
replaced with eth0's IP address when the program is being
|
|
|
|
compiled. On the other hand, if you use $EXT_IP in your
|
|
|
|
/etc/shorewall/start script, the value will be the IP address of
|
|
|
|
eth0 when the program is run.</para>
|
|
|
|
|
|
|
|
<para>Bottom line: You probably want to use only constant values
|
|
|
|
for variables set in
|
|
|
|
<filename>/etc/shorewall/params</filename>.</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
</listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>You must install Shorewall Lite on the system where you want
|
|
|
|
to run the script. You then install the compiled program in
|
|
|
|
/usr/share/shorewall/firewall and use the /sbin/shorewall program
|
|
|
|
included with Shorewall Lite to control the firewall just as if the
|
|
|
|
full Shorewall distribution was installed.</para>
|
|
|
|
</listitem>
|
2006-03-09 22:02:15 +01:00
|
|
|
</orderedlist>
|
|
|
|
</section>
|
2006-02-28 00:55:26 +01:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>The "shorewall compile" command</title>
|
|
|
|
|
|
|
|
<para>A compiled script is produced using the <command>compile</command>
|
|
|
|
command:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para><command>shorewall compile [ -e ] [ <directory name> ]
|
|
|
|
<path name></command></para>
|
2006-02-28 00:55:26 +01:00
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<para>where</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>-e</term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>Indicates that the program is to be "exported" to another
|
|
|
|
system. When this flag is set, the "detectnets" interface is not
|
2006-06-03 19:16:27 +02:00
|
|
|
allowed but the created program may be run on a system that has
|
|
|
|
only Shorewall Lite installed</para>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
|
|
|
<para>When this flag is given, Shorewall does not probe the
|
|
|
|
current system to determine the kernel/iptables features that it
|
|
|
|
supports. It rather reads those capabilities from
|
|
|
|
<filename>/etc/shorewall/capabilities</filename>. See below for
|
|
|
|
details.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><directory name></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>specifies a directory to be searched for configuration files
|
|
|
|
before those directories listed in the CONFIG_PATH variable in
|
|
|
|
<filename>shorewall.conf</filename>.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><path name></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>specifies the name of the script to be created.</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</blockquote>
|
|
|
|
</section>
|
|
|
|
|
2006-06-07 19:52:45 +02:00
|
|
|
<section id="Lite">
|
2006-06-03 19:16:27 +02:00
|
|
|
<title>Shorewall Lite (Added in version 3.2.0 RC 1)</title>
|
2006-05-31 16:13:39 +02:00
|
|
|
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>Shorewall Lite is a companion product to Shorewall and is designed
|
|
|
|
to allow you to maintain all Shorewall configuration information on a
|
|
|
|
single system within your network.</para>
|
2006-05-31 16:13:39 +02:00
|
|
|
|
2006-06-03 19:16:27 +02:00
|
|
|
<orderedlist numeration="loweralpha">
|
2006-05-31 16:13:39 +02:00
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>You install the full Shorewall release on one system within your
|
|
|
|
network. You need not configure Shorewall there and you may totally
|
|
|
|
disable startup of Shorewall in your init scripts. For ease of
|
|
|
|
reference, we call this system the 'administrative system'.</para>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>On each system where you wish to run a Shorewall-generated
|
|
|
|
firewall, you install Shorewall Lite. For ease of reference, we will
|
|
|
|
call these systems the 'firewall systems'.</para>
|
2006-06-06 22:12:09 +02:00
|
|
|
|
|
|
|
<note>
|
|
|
|
<para>The firewall systems do <emphasis role="bold">NOT</emphasis>
|
2006-06-09 21:53:12 +02:00
|
|
|
need to have the full Shorewall product installed but rather only
|
|
|
|
the Shorewall Lite product. Shorewall and Shorewall LIte may be
|
2006-06-13 02:07:00 +02:00
|
|
|
installed on the same system but that isn't encouraged.</para>
|
2006-06-06 22:12:09 +02:00
|
|
|
</note>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>On the administrative system you create a separete
|
|
|
|
'configuration directory' for each firewall system. You copy the
|
|
|
|
contents of /usr/share/shorewall/configfiles into each configuration
|
2006-05-31 18:56:06 +02:00
|
|
|
directory.</para>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>On each firewall system, you run:</para>
|
2006-05-31 16:13:39 +02:00
|
|
|
|
2006-06-09 21:53:12 +02:00
|
|
|
<programlisting><command>/usr/share/shorewall-lite/shorecap > capabilities</command>
|
2006-06-03 19:16:27 +02:00
|
|
|
<command>scp capabilities <admin system>:<this system's config dir></command></programlisting>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>On the administrative system, for each firewall system you do
|
|
|
|
the following (this may be done by a non-root user):</para>
|
2006-05-31 16:13:39 +02:00
|
|
|
|
2006-06-03 19:16:27 +02:00
|
|
|
<orderedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>modify the files in the corresponding configuration
|
2006-06-07 19:52:45 +02:00
|
|
|
directory appropriately. It's a good idea to include the IP
|
|
|
|
address of the administrative system in the
|
|
|
|
<filename>routestopped</filename> file.</para>
|
2006-06-13 02:07:00 +02:00
|
|
|
|
|
|
|
<para>It is important to understand that with Shorewall Lite, the
|
|
|
|
firewall's configuration directory on the administrative system
|
|
|
|
acts as <filename class="directory">/etc/shorewall</filename> for
|
|
|
|
that firewall. So when the Shorewall documentation gives
|
|
|
|
instructions for placing entries in files in the firewall's
|
|
|
|
<filename class="directory">/etc/shorewall</filename>, when using
|
|
|
|
Shorewall Lite you make those changes in the firewall's
|
|
|
|
configuration directory on the administrative system.</para>
|
2006-06-03 19:16:27 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<programlisting><command>cd <configuration directory></command>
|
|
|
|
<command>/sbin/shorewall compile -e . firewall</command>
|
2006-06-09 21:53:12 +02:00
|
|
|
<command>scp firewall root@<firewall system>:/usr/share/shorewall-lite/</command></programlisting>
|
2006-06-03 19:16:27 +02:00
|
|
|
</listitem>
|
|
|
|
</orderedlist>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>On each firewall system:</para>
|
|
|
|
|
2006-06-09 21:53:12 +02:00
|
|
|
<para>Modify <filename>/etc/shorewall-lite/shorewall.conf</filename>
|
|
|
|
as needed.</para>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-10 15:32:56 +02:00
|
|
|
<para>If you are running Debian or one of its derivatives like Ubuntu
|
|
|
|
then edit /etc/default/shorewall-lite and set startup=1.</para>
|
|
|
|
|
2006-06-12 19:48:20 +02:00
|
|
|
<programlisting><command>shorewall-lite start</command></programlisting>
|
2006-05-31 16:13:39 +02:00
|
|
|
</listitem>
|
|
|
|
</orderedlist>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
|
|
|
<para>Shorewall Lite includes a very limited version of
|
2006-06-14 18:32:13 +02:00
|
|
|
<filename>shorewall.conf
|
|
|
|
</filename>(<filename>/etc/shorewall-lite/shorewall.conf</filename>). It
|
|
|
|
includes the following options which have the same meaning as in a full
|
|
|
|
Shorewall installation except as noted below:</para>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<blockquote>
|
|
|
|
<simplelist>
|
|
|
|
<member>VERBOSITY</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>LOGFILE</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>LOGFORMAT — used by <filename>/sbin/shorewall</filename> for
|
2006-06-14 18:32:13 +02:00
|
|
|
finding 'Shorewall' log messages. If LOGFORMAT was specified in the
|
|
|
|
shorewall.conf file used at compile time on the administrative system,
|
|
|
|
then the format of the messages themselves is defined by that value.
|
|
|
|
If LOGFORMAT was not specified at compile time then the firewall
|
|
|
|
script will use the value from
|
2006-06-09 21:53:12 +02:00
|
|
|
<filename>/etc/shorewall-lite/shorewall.conf</filename> on the
|
|
|
|
firewall system.</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>IPTABLES — determines the iptables binary to be used by
|
2006-06-08 23:49:34 +02:00
|
|
|
<filename>/sbin/shorewall</filename>. The compiled firewall script
|
|
|
|
will use the IPTABLES specified in <filename>shorewall.conf</filename>
|
2006-06-14 18:32:13 +02:00
|
|
|
at compile time on the administrative system, if any; if IPTABLES was
|
|
|
|
not specified at compile time then the IPTABLES value from
|
2006-06-09 21:53:12 +02:00
|
|
|
<filename>/etc/shorewall-lite/shorewall.conf</filename> on the
|
|
|
|
firewall system will be used by the firewall script.</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>PATH</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>SHOREWALL_SHELL</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>SUBSYSLOCK</member>
|
2006-06-14 16:55:49 +02:00
|
|
|
|
|
|
|
<member>RESTOREFILE</member>
|
2006-06-07 21:15:55 +02:00
|
|
|
</simplelist>
|
|
|
|
</blockquote>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-12 19:48:20 +02:00
|
|
|
<para>The <filename>/sbin/shorewall-lite</filename> program included with
|
|
|
|
Shorewall Lite supports the same set of commands as the
|
|
|
|
<filename>/sbin/shorewall</filename> program in a full Shorewall
|
|
|
|
installation with the following exceptions:</para>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<blockquote>
|
|
|
|
<simplelist>
|
|
|
|
<member>add</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>compile</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>delete</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-13 02:04:15 +02:00
|
|
|
<member>refresh</member>
|
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>try</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>safe-start</member>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-07 21:15:55 +02:00
|
|
|
<member>safe-restart</member>
|
2006-06-13 02:04:15 +02:00
|
|
|
|
|
|
|
<member>show actions</member>
|
|
|
|
|
|
|
|
<member>show macros</member>
|
2006-06-07 21:15:55 +02:00
|
|
|
</simplelist>
|
|
|
|
</blockquote>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-12 19:48:20 +02:00
|
|
|
<para>On systems with only Shorewall Lite installed, I recommend that you
|
|
|
|
create a symbolic link <filename>/sbin/shorewall</filename> and point it
|
|
|
|
at <filename>/sbin/shorewall-lite</filename>. That way, you can use
|
|
|
|
<command>shorewall</command> as the command regardless of which product is
|
|
|
|
installed.</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<programlisting><command>ln -sf shorewall-lite /sbin/shorewall</command></programlisting>
|
|
|
|
</blockquote>
|
|
|
|
|
2006-06-07 19:52:45 +02:00
|
|
|
<section>
|
|
|
|
<title>Converting a system from Shorewall to Shorewall Lite</title>
|
|
|
|
|
|
|
|
<para>Converting a firewall system that is currently running Shorewall
|
|
|
|
to run Shorewall Lite instead is straight-forward.</para>
|
|
|
|
|
|
|
|
<orderedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>On the administrative system, create a configuration directory
|
|
|
|
for the firewall system.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>Copy the contents of <filename
|
|
|
|
class="directory">/etc/shorewall/</filename> from the firewall
|
|
|
|
system to the configuration directory on the administrative
|
|
|
|
system.</para>
|
|
|
|
</listitem>
|
|
|
|
|
2006-06-10 03:32:22 +02:00
|
|
|
<listitem>
|
|
|
|
<para>On the firewall system:</para>
|
|
|
|
|
|
|
|
<para>Be sure that the IP address of the administrative system is
|
|
|
|
included in <filename>/etc/shorewall/routestopped</filename>.</para>
|
|
|
|
|
|
|
|
<programlisting><command>shorewall stop</command></programlisting>
|
2006-06-12 17:13:45 +02:00
|
|
|
|
2006-06-13 02:07:00 +02:00
|
|
|
<para><emphasis role="bold">We recommend that you uninstall
|
2006-06-12 17:13:45 +02:00
|
|
|
Shorewall at this point.</emphasis></para>
|
2006-06-10 03:32:22 +02:00
|
|
|
</listitem>
|
|
|
|
|
2006-06-07 19:52:45 +02:00
|
|
|
<listitem>
|
2006-06-13 02:07:00 +02:00
|
|
|
<para>Install Shorewall Lite on the firewall system.</para>
|
2006-06-07 19:52:45 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>On the firewall system:</para>
|
|
|
|
|
2006-06-09 21:53:12 +02:00
|
|
|
<programlisting><command>/usr/share/shorewall-lite/shorecap > capabilities</command>
|
2006-06-07 19:52:45 +02:00
|
|
|
<command>scp capabilities <admin system>:<this system's config dir></command></programlisting>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>On the administrative system:</para>
|
|
|
|
|
|
|
|
<para>It's a good idea to include the IP address of the
|
|
|
|
administrative system in the firewall system's
|
|
|
|
<filename>routestopped</filename> file.</para>
|
|
|
|
|
|
|
|
<programlisting><command>cd <configuration directory></command>
|
|
|
|
<command>/sbin/shorewall compile -e . firewall</command>
|
2006-06-09 21:53:12 +02:00
|
|
|
<command>scp firewall root@<firewall system>:/usr/share/shorewall-lite/</command></programlisting>
|
2006-06-07 19:52:45 +02:00
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>On the firewall system:</para>
|
|
|
|
|
2006-06-09 21:53:12 +02:00
|
|
|
<para>Modify <filename>/etc/shorewall-lite/shorewall.conf</filename>
|
|
|
|
as needed.</para>
|
2006-06-07 19:52:45 +02:00
|
|
|
|
2006-06-10 15:32:56 +02:00
|
|
|
<para>If you are running Debian or one of its derivatives like
|
|
|
|
Ubuntu then edit /etc/default/shorewall-lite and set
|
|
|
|
startup=1.</para>
|
|
|
|
|
2006-06-12 19:48:20 +02:00
|
|
|
<programlisting><command>shorewall-lite start</command></programlisting>
|
2006-06-07 19:52:45 +02:00
|
|
|
</listitem>
|
|
|
|
</orderedlist>
|
|
|
|
</section>
|
2006-06-14 18:32:13 +02:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<title>A simple shell program for remote firewall replacement</title>
|
|
|
|
|
|
|
|
<para>I use the following <ulink
|
|
|
|
url="ftp://ftp1.shorewall.net/pub/shorewall/contrib/compile">simple
|
|
|
|
shell program</ulink> for compiling firewall scripts and installing them
|
|
|
|
on firewall systems:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<programlisting>#/bin/bash
|
|
|
|
|
|
|
|
[ $# -eq 1 ] || { echo "Usage: $(basename $0) <system>" >&2; exit 2; }
|
|
|
|
|
|
|
|
/sbin/shorewall compile -e . firewall && scp firewall root@${1}:/usr/share/shorewall-lite/ && ssh root@${1} 'shorewall-lite restart'</programlisting>
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<para>I install this program in
|
|
|
|
<filename>/usr/local/bin/compile</filename> and I have my configuration
|
|
|
|
directories in ~/Config. So, for example, to recompile the firewall
|
|
|
|
script for the 'gateway' system and install the script on gateway, I do
|
|
|
|
the following:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<programlisting>teastep@wookie:~$ <command>cd Configs/gateway</command>
|
|
|
|
teastep@wookie:~/Configs/gateway$ <command>compile gateway</command>
|
|
|
|
Compiling...
|
|
|
|
Shorewall configuration compiled to firewall
|
|
|
|
firewall 100% 29KB 29.3KB/s 00:00
|
|
|
|
Restarting Shorewall Lite....
|
|
|
|
done.
|
|
|
|
teastep@wookie:~/Configs/gateway$</programlisting>
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<para>I use RSA keys and ssh-agent so I don't need to enter a password
|
|
|
|
to run scp or ssh.</para>
|
|
|
|
</section>
|
2006-05-31 16:13:39 +02:00
|
|
|
</section>
|
|
|
|
|
2006-02-28 00:55:26 +01:00
|
|
|
<section>
|
|
|
|
<title>The /etc/shorewall/capabilities file and the shorecap
|
|
|
|
program</title>
|
|
|
|
|
|
|
|
<para>As mentioned above, the /etc/shorewall/capabilities file specifies
|
|
|
|
that kernel/iptables capabilities of the target system. Here is a sample
|
|
|
|
file:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<programlisting>NAT_ENABLED=Yes # NAT
|
|
|
|
MANGLE_ENABLED=Yes # Packet Mangling
|
|
|
|
MULTIPORT=Yes # Multi-port Match
|
|
|
|
XMULTIPORT=Yes # Extended Multi-port Match
|
2006-06-03 19:16:27 +02:00
|
|
|
CONNTRACK_MATCH=Yes # Connection Tracking Match
|
|
|
|
USEPKTTYPE= # Packet Type Match
|
2006-02-28 00:55:26 +01:00
|
|
|
POLICY_MATCH=Yes # Policy Match
|
|
|
|
PHYSDEV_MATCH=Yes # Physdev Match
|
|
|
|
LENGTH_MATCH=Yes # Packet Length Match
|
|
|
|
IPRANGE_MATCH=Yes # IP range Match
|
|
|
|
RECENT_MATCH=Yes # Recent Match
|
|
|
|
OWNER_MATCH=Yes # Owner match
|
|
|
|
IPSET_MATCH= # Ipset Match
|
|
|
|
CONNMARK=Yes # CONNMARK Target
|
2006-06-03 19:16:27 +02:00
|
|
|
XCONNMARK=Yes # Extended CONNMARK Target
|
2006-02-28 00:55:26 +01:00
|
|
|
CONNMARK_MATCH=Yes # Connmark Match
|
2006-06-03 19:16:27 +02:00
|
|
|
XCONNMARK_MATCH=Yes # Extended Connmark Match
|
2006-02-28 00:55:26 +01:00
|
|
|
RAW_TABLE=Yes # Raw Table
|
|
|
|
IPP2P_MATCH= # IPP2P Match
|
|
|
|
CLASSIFY_TARGET=Yes # CLASSIFY Target
|
2006-03-29 21:26:53 +02:00
|
|
|
ENHANCED_REJECT=Yes # Extended REJECT
|
2006-06-03 19:16:27 +02:00
|
|
|
KLUDGEFREE= # iptables accepts multiple "-m iprange" or "-m physdev" in a single command
|
|
|
|
MARK=Yes # MARK Target Support
|
|
|
|
XMARK=YES # Extended MARK Target Support
|
|
|
|
MANGLE_FORWARD # Mangle table has FORWARD chain</programlisting>
|
2006-02-28 00:55:26 +01:00
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<para>As you can see, the file contains a simple list of shell variable
|
|
|
|
assignments -- the variables correspond to the capabilities listed by the
|
2006-06-14 16:55:49 +02:00
|
|
|
<command>shorewall show capabilities</command> command and they appear in
|
|
|
|
the same order as the output of that command.</para>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
2006-06-03 19:16:27 +02:00
|
|
|
<para>To aid in creating this file, Shorewall Lite includes a
|
|
|
|
<command>shorecap</command> program. The program is installed in the
|
2006-06-12 18:48:07 +02:00
|
|
|
<filename>/usr/share/shorewall-lite/</filename> directory and may be run
|
|
|
|
as follows:</para>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
|
|
|
<blockquote>
|
2006-03-04 19:16:33 +01:00
|
|
|
<para><command>[ IPTABLES=<iptables binary> ] [
|
2006-06-03 19:16:27 +02:00
|
|
|
MODULESDIR=<kernel modules directory> ]
|
2006-06-12 18:48:07 +02:00
|
|
|
/usr/share/shorewall-lite/shorecap > capabilities</command></para>
|
2006-02-28 00:55:26 +01:00
|
|
|
</blockquote>
|
|
|
|
|
2006-03-04 19:16:33 +01:00
|
|
|
<para>The IPTABLES and MODULESDIR options have their <ulink
|
|
|
|
url="Documentation.htm#Conf">usual Shorewall default
|
|
|
|
values</ulink>.</para>
|
|
|
|
|
2006-02-28 00:55:26 +01:00
|
|
|
<para>The <filename>capabilities</filename> file may then be copied to a
|
|
|
|
system with Shorewall installed and used when compiling firewall programs
|
|
|
|
to run on the remote system.</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2006-06-03 19:16:27 +02:00
|
|
|
<title>Running compiled programs directly</title>
|
2006-02-28 00:55:26 +01:00
|
|
|
|
|
|
|
<para>Compiled firewall programs are complete programs that support the
|
|
|
|
following run-line commands:</para>
|
|
|
|
|
|
|
|
<blockquote>
|
|
|
|
<simplelist>
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
start</command></member>
|
|
|
|
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
stop</command></member>
|
|
|
|
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
clear</command></member>
|
|
|
|
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
restart</command></member>
|
|
|
|
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
status</command></member>
|
|
|
|
|
|
|
|
<member><command><program> [ -q ] [ -v ] [ -n ]
|
|
|
|
version</command></member>
|
|
|
|
</simplelist>
|
|
|
|
</blockquote>
|
|
|
|
|
|
|
|
<para>The options have their same meaning is when they are passed to
|
|
|
|
<filename>/sbin/shorewall</filename> itself. The default VERBOSITY level
|
|
|
|
is the level specified in the shorewall.conf file used when then program
|
|
|
|
was compiled.</para>
|
|
|
|
</section>
|
2006-06-11 03:01:58 +02:00
|
|
|
</article>
|