<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Shorewall Installation and Upgrade</title><link rel="stylesheet" href="html.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="article" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="Install"></a>Shorewall Installation and Upgrade</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Tom</span> <span class="surname">Eastep</span></h3></div></div></div><div><p class="copyright">Copyright © 2001-, 2006 Thomas M. Eastep</p></div><div><div class="legalnotice"><a id="id285614"></a><p>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 “<span class="quote"><a class="ulink" href="GnuCopyright.htm" target="_self">GNU Free Documentation License</a></span>”.</p></div></div><div><p class="pubdate">2008/12/15</p></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#Install_RPM">Install using RPM</a></span></dt><dt><span class="section"><a href="#Install_Tarball">Install using tarball</a></span></dt><dt><span class="section"><a href="#Debian">Install the .deb</a></span></dt><dt><span class="section"><a href="#Upgrade">General Notes about Upgrading Shorewall</a></span></dt><dt><span class="section"><a href="#Upgrade_RPM">Upgrade using RPM</a></span></dt><dt><span class="section"><a href="#Upgrade_Tarball">Upgrade using tarball</a></span></dt><dt><span class="section"><a href="#Upgrade_Deb">Upgrading the .deb</a></span></dt><dt><span class="section"><a href="#LRP_Upgrade">Upgrade the .lrp</a></span></dt><dt><span class="section"><a href="#Config_Files">Configuring Shorewall</a></span></dt><dt><span class="section"><a href="#Uninstall">Uninstall/Fallback</a></span></dt></dl></div><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p><span class="bold"><strong>This article applies to Shorewall 3.0 and later. If you are installing or upgrading to a version of Shorewall earlier than Shorewall 3.0.0 then please see the documentation for that release.</strong></span></p></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Before attempting installation, I strongly urge you to read and print a copy of the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">Shorewall QuickStart</a> Guide for the configuration that most closely matches your own.</p></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Before upgrading, be sure to review the <a class="ulink" href="upgrade_issues.htm" target="_self">Upgrade Issues</a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Shorewall RPMs are signed. To avoid warnings such as the following</p><pre class="programlisting">warning: shorewall-3.2.1-1.noarch.rpm: V3 DSA signature: NOKEY, key ID 6c562ac4</pre><p>download the <a class="ulink" href="https://lists.shorewall.net/shorewall.gpg.key" target="_self">Shorewall GPG key</a> and run this command:</p><pre class="programlisting"><span class="command"><strong>rpm --import shorewall.gpg.key</strong></span></pre></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Install_RPM"></a>Install using RPM</h2></div></div></div><p>To install Shorewall using the RPM:</p><div class="orderedlist"><ol type="1"><li><p><span class="bold"><strong>Be sure that you have the correct RPM package!</strong></span></p><p>The standard RPM package from shorewall.net and the mirrors is known to work with <span class="bold"><strong><span class="trademark">SUSE</span>™</strong></span>, <span class="bold"><strong><span class="trademark">Power PPC</span>™</strong></span>, <span class="bold"><strong><span class="trademark">Trustix</span>™</strong></span> and <span class="bold"><strong><span class="trademark">TurboLinux</span>™</strong></span>. There is also an RPM package provided by Simon Matter that is tailored for <span class="trademark"><span class="bold"><strong>RedHat/Fedora</strong></span></span>™ and another package from Jack Coates that is customized for <span class="bold"><strong><span class="trademark">Mandriva</span>™</strong></span>. All of these are available from the <a class="ulink" href="http://www.shorewall.net/download.htm" target="_self">download page</a>.</p><p>If you try to install the wrong package, it probably won't work.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you are installing Shorewall 4.0.0 or later then you need to install at least two packages.</p><div class="itemizedlist"><ul type="disc"><li><p>Either Shorewall-shell (the classic shell-based configuration compiler) and/or Shorewall-perl (the newer and faster compiler written in Perl).</p></li><li><p>Shorewall-common</p></li></ul></div><p>If you are installing Shorewall for the first time, we strongly suggest that you install Shorewall-perl.</p></div></li><li><p>Install the RPMs</p><pre class="programlisting"><span class="command"><strong>rpm -ivh <compiler rpm> ... <shorewall-common rpm></strong></span></pre><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>Some users are in the habit of using the <span class="command"><strong>rpm -U</strong></span> command for installing packages as well as for updating them. If you use that command when installing the Shorewall RPM then you will have to manually enable Shorewall startup at boot time by running <span class="command"><strong>chkconfig</strong></span>, <span class="command"><strong>insserv</strong></span> or whatever utility you use to manipulate you init symbolic links.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some <span class="trademark">SUSE</span>™ users have encountered a problem whereby rpm reports a conflict with kernel <= 2.2 even though a 2.4 kernel is installed. If this happens, simply use the --nodeps option to rpm.</p><pre class="programlisting"><code class="filename"><span class="command"><strong>rpm -ivh --nodeps <rpms></strong></span></code></pre></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Shorewall is dependent on the iproute package. Unfortunately, some distributions call this package iproute2 which will cause the installation of Shorewall to fail with the diagnostic:</p><pre class="programlisting">error: failed dependencies:iproute is needed by shorewall-3.2.x-1</pre><p>This problem should not occur if you are using the correct RPM package (see 1., above) but may be worked around by using the --nodeps option of rpm.</p><pre class="programlisting"><span class="command"><strong>rpm -ivh --nodeps <rpms></strong></span></pre></div><p>Example:</p><pre class="programlisting"><span class="command"><strong>rpm -ivh shorewall-perl-4.0.0-1.noarch.rpm shorewall-common-4.0.0-1.noarch.rpm</strong></span></pre><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Simon Matter names his '<span class="emphasis"><em>common</em></span>' rpm '<span class="emphasis"><em>shorewall</em></span>' rather than '<span class="emphasis"><em>shorewall-common</em></span>'. So if you are installing his RPMs, the command would be:</p><pre class="programlisting"><span class="command"><strong>rpm -ivh shorewall-perl-4.0.0-1.noarch.rpm shorewall-4.0.0-1.noarch.rpm</strong></span></pre></div></li><li><p>Edit the <a class="link" href="#Config_Files" title="Configuring Shorewall">configuration files</a> to match your configuration.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>YOU CAN <span class="bold"><strong>NOT</strong></span> SIMPLY INSTALL THE RPM AND ISSUE A “<span class="quote">shorewall start</span>” COMMAND. SOME CONFIGURATION IS REQUIRED BEFORE THE FIREWALL WILL START. IF YOU ISSUE A “<span class="quote">start</span>” COMMAND AND THE FIREWALL FAILS TO START, YOUR SYSTEM WILL NO LONGER ACCEPT ANY NETWORK TRAFFIC. IF THIS HAPPENS, ISSUE A “<span class="quote">shorewall clear</span>” COMMAND TO RESTORE NETWORK CONNECTIVITY.</p></div></li><li><p>Enable startup by editing /<code class="filename">etc/shorewall/shorewall.conf</code> and set STARTUP_ENABLED to Yes).</p></li><li><p>Start the firewall by typing</p><pre class="programlisting"><span class="command"><strong>shorewall start</strong></span></pre></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Install_Tarball"></a>Install using tarball</h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you are installing Shorewall 4.0.0 or later then you need to install at least two packages.</p><div class="itemizedlist"><ul type="disc"><li><p>Either Shorewall-shell (the classic shell-based configuration compiler) and/or Shorewall-perl (the newer and faster compiler written in Perl).</p></li><li><p>Shorewall-common</p></li></ul></div><p>If you are installing Shorewall for the first time, we strongly suggest that you install Shorewall-perl.</p></div><p>To install Shorewall-perl and Shorewall-common using the tarball and install scripts:</p><div class="orderedlist"><ol type="1"><li><p>unpack the tarballs:</p><pre class="programlisting"><span class="command"><strong>tar -jxf shorewall-common-4.0.0.tar.bz2</strong></span> <span class="command"><strong>tar -jxf shorewall-perl-4.0.0.tar.bz2 </strong></span></pre></li><li><p>cd to the shorewall-perl directory (the version is encoded in the directory name as in “<span class="quote">shorewall-perl-4.0.0</span>”).</p></li><li><p>Type:</p><pre class="programlisting"><span class="command"><strong>./install.sh</strong></span></pre></li><li><p>cd to the shorewall-common directory (the version is encoded in the directory name as in “<span class="quote">shorewall-common-4.0.0</span>”)</p></li><li><p>Type:</p><pre class="programlisting"><span class="command"><strong>./install.sh</strong></span></pre></li><li><p>Edit the <a class="link" href="#Config_Files" title="Configuring Shorewall">configuration files</a> to match your configuration.</p></li><li><p>Enable Startup by editing <code class="filename">/etc/shorewall/shorewall.conf</code> and set STARTUP_ENABLED=Yes.</p></li><li><p>Start the firewall by typing</p><pre class="programlisting"><span class="command"><strong>shorewall start</strong></span></pre></li><li><p>If the install script was unable to configure Shorewall to be started automatically at boot, see <a class="ulink" href="starting_and_stopping_shorewall.htm" target="_self">these instructions</a>.</p></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Debian"></a>Install the .deb</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Once you have installed the .deb packages and before you attempt to configure Shorewall, please heed the advice of Lorenzo Martignoni, the Shorewall Debian Maintainer:</p><p>“<span class="quote">For more information about Shorewall usage on Debian system please look at /usr/share/doc/shorewall-common/README.Debian provided by [the] shorewall-common Debian package.</span>”</p></div><p>The easiest way to install Shorewall on Debian, is to use apt-get<span class="command"><strong>. </strong></span></p><p>First, to ensure that you are installing the latest version of Shorewall, please modify your <code class="filename">/etc/apt/preferences:</code></p><pre class="programlisting">Package: shorewall Pin: release o=Debian,a=testing Pin-Priority: 700 Package: shorewall-doc Pin: release o=Debian,a=testing Pin-Priority: 700</pre><p><span class="bold"><strong><span class="emphasis"><em>Then run:</em></span></strong></span></p><pre class="programlisting"># apt-get update # apt-get install shorewall</pre><p><span class="emphasis"><em><span class="bold"><strong>Once you have completed configuring Shorewall, you can enable startup at boot time by setting startup=1 in <code class="filename">/etc/default/shorewall</code>.</strong></span></em></span></p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Upgrade"></a>General Notes about Upgrading Shorewall</h2></div></div></div><p>Most problems associated with upgrades come from two causes:</p><div class="itemizedlist"><ul type="disc"><li><p>The user didn't read and follow the migration considerations in the release notes (these are also reproduced in the <a class="ulink" href="upgrade_issues.htm" target="_self">Shorewall Upgrade Issues</a>).</p></li><li><p>The user mis-handled the <code class="filename">/etc/shorewall/shorewall.conf</code> file during upgrade. Shorewall is designed to allow the default behavior of the product to evolve over time. To make this possible, the design assumes that <span class="bold"><strong>you will not replace your current shorewall.conf</strong></span> <span class="bold"><strong>file during upgrades</strong></span>. It is recommended that after you first install Shorewall that you modify <code class="filename">/etc/shorewall/shorewall.conf</code> so as to prevent your package manager from overwriting it during subsequent upgrades (since the addition of STARTUP_ENABLED, such modification is assured since you must manually change the setting of that option). If you feel absolutely compelled to have the latest comments and options in your shorewall.conf then you must proceed carefully. You should determine which new options have been added and you must reset their value (e.g. OPTION=""); otherwise, you will get different behavior from what you expect.</p></li></ul></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Upgrade_RPM"></a>Upgrade using RPM</h2></div></div></div><p>If you already have the Shorewall RPM installed and are upgrading to a new version:</p><div class="orderedlist"><ol type="1"><li><p><span class="bold"><strong>Be sure that you have the correct RPM package!</strong></span></p><p>The standard RPM package from shorewall.net and the mirrors is known to work with <span class="trademark">SUSE</span>™, Power PPC, Trustix and TurboLinux. There is also an RPM package provided by Simon Matter that is tailored for RedHat/Fedora and another package from Jack Coates that is customized for Mandriva. If you try to upgrade using the wrong package, it probably won't work.</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>Simon Matter names his '<span class="emphasis"><em>common</em></span>' rpm '<span class="emphasis"><em>shorewall</em></span>' rather than '<span class="emphasis"><em>shorewall-common</em></span>'.</p></div></li><li><p>If you are upgrading from a 2.x or 3.x version to a 4.x version or later, please see the <a class="ulink" href="upgrade_issues.htm" target="_self">upgrade issues</a> for specific instructions.</p></li><li><p>Upgrade the RPM</p><pre class="programlisting"><span class="command"><strong>rpm -Uvh <compiler rpm file> ... <shorewall-common rpm file> </strong></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some <span class="trademark">SUSE</span>™ users have encountered a problem whereby rpm reports a conflict with kernel <= 2.2 even though a 2.4 kernel is installed. If this happens, simply use the --nodeps option to rpm.</p><pre class="programlisting"><span class="command"><strong>rpm -Uvh --nodeps <shorewall-common rpm> <compiler rpm> ...</strong></span></pre></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Shorewall is dependent on the iproute package. Unfortunately, some distributions call this package iproute2 which will cause the upgrade of Shorewall to fail with the diagnostic:</p><pre class="programlisting">error: failed dependencies:iproute is needed by shorewall-3.2.1-1</pre><p>This may be worked around by using the --nodeps option of rpm.</p><pre class="programlisting"><span class="command"><strong>rpm -Uvh --nodeps <shorewall rpm> <compiler-rpm> ...</strong></span></pre></div></li><li><p>See if there are any incompatibilities between your configuration and the new Shorewall version and correct as necessary.</p><pre class="programlisting"><span class="command"><strong>shorewall check</strong></span></pre></li><li><p>Restart the firewall.</p><pre class="programlisting"><span class="command"><strong>shorewall restart</strong></span></pre></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Upgrade_Tarball"></a>Upgrade using tarball</h2></div></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>If you are upgrading from a 2.x or 3.x version to a 4.x version or later, please see the <a class="ulink" href="upgrade_issues.htm" target="_self">upgrade issues</a> for specific instructions.</p></div><p>If you already have Shorewall installed and are upgrading to a new version using the tarball:</p><div class="orderedlist"><ol type="1"><li><p>unpack the tarballs:</p><pre class="programlisting"><span class="command"><strong>tar -jxf shorewall-common-4.0.0.tar.bz2</strong></span> <span class="command"><strong>tar -jxf shorewall-perl-4.0.0.tar.bz2 tar -jxf shorewall-shell-4.0.0.tar.bz2</strong></span> (if you use this compiler)</pre></li><li><p>cd to the shorewall-perl directory (the version is encoded in the directory name as in “<span class="quote">shorewall-perl-4.0.0</span>”).</p></li><li><p>Type:</p><pre class="programlisting"><span class="command"><strong>./install.sh</strong></span></pre></li><li><p>Perform the above two steps for the shorewall-shell directory if you use that compiler.</p></li><li><p>cd to the shorewall-common directory (the version is encoded in the directory name as in “<span class="quote">shorewall-perl-4.0.0</span>”)</p></li><li><p>Type:</p><pre class="programlisting"><span class="command"><strong>./install.sh</strong></span></pre></li><li><p>See if there are any incompatibilities between your configuration and the new Shorewall version and correct as necessary.</p><pre class="programlisting"><span class="command"><strong>shorewall check</strong></span></pre></li><li><p>Start the firewall by typing</p><pre class="programlisting"><span class="command"><strong>shorewall start</strong></span></pre></li><li><p>If the install script was unable to configure Shorewall to be started automatically at boot, see <a class="ulink" href="starting_and_stopping_shorewall.htm" target="_self">these instructions</a>.</p></li></ol></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Upgrade_Deb"></a>Upgrading the .deb</h2></div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>When the installer asks if you want to replace /etc/shorewall/shorewall.conf with the new version, we strongly advise you to say No. See <a class="link" href="#Upgrade" title="General Notes about Upgrading Shorewall">above</a>.</p></div></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="LRP_Upgrade"></a>Upgrade the .lrp</h2></div></div></div><p>The following was contributed by Charles Steinkuehler on the Leaf mailing list:</p><div class="blockquote"><blockquote class="blockquote"><p>It's *VERY* simple...just put in a new CD and reboot! :-) Actually, I'm only slightly kidding...that's exactly how I upgrade my production firewalls. The partial backup feature I added to Dachstein allows configuration data to be stored separately from the rest of the package.</p><p>Once the config data is separated from the rest of the package, it's an easy matter to upgrade the package while keeping your current configuration (in my case, just inserting a new CD and re-booting).</p><p>Users who aren't running with multiple package paths and using partial backups can still upgrade a package, it just takes a bit of extra work. The general idea is to use a partial backup to save your configuration, replace the package, and restore your old configuration files. Step-by-step instructions for one way to do this (assuming a conventional single-floppy LEAF system) would be:</p><div class="itemizedlist"><ul type="disc"><li><p>Make a backup copy of your firewall disk ('NEW'). This is the disk you will add the upgraded package(s) to.</p></li><li><p>Format a floppy to use as a temporary location for your configuration file(s) ('XFER'). This disk should have the same format as your firewall disk (and could simply be another backup copy of your current firewall).</p></li><li><p>Make sure you have a working copy of your existing firewall ('OLD') in a safe place, that you *DO NOT* use during this process. That way, if anything goes wrong you can simply reboot off the OLD disk to get back to a working configuration.</p></li><li><p>Remove your current firewall configuration disk and replace it with the XFER disk.</p></li><li><p>Use the lrcfg backup menu to make a partial backup of the package(s) you want to upgrade, being sure to backup the files to the XFER disk. From the backup menu:</p><pre class="programlisting">t e <enter> p <enter> b <package1> <enter> b <package2> <enter> ...</pre></li><li><p>Download and copy the package(s) you want to upgrade onto the NEW disk.</p></li><li><p>Reboot your firewall using the NEW disk...at this point your upgraded packages will have their default configuration.</p></li><li><p>Mount the XFER disk (mount -t msdos /dev/fd0u1680 /mnt)</p></li><li><p>CD to the root directory (cd /)</p></li><li><p>Manually extract configuration data for each package you upgraded:</p><pre class="programlisting">tar -xzvf /mnt/package1.lrp tar -xzvf /mnt/package2.lrp ...</pre></li><li><p>Unmount (umount /mnt) and remove the XFER disk</p></li><li><p>Using lrcfg, do *FULL* backups of your upgraded packages.</p></li><li><p>Reboot, verifying the firewall works as expected. Some configuration files may need to be 'tweaked' to work properly with the upgraded package binaries.</p></li></ul></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>The new package file <package>.local can be used to fine-tune which files are included (and excluded) from the partial backup (see the Dachstein-CD README for details). If this file doesn't exist, the backup scripts assume anything from the <package>.list file that resides in /etc or /var/lib/lrpkg is part of the configuration data and is used to create the partial backup. If shorewall puts anything in /etc that isn't a user modified configuration file, a proper shorewall.local file should be created prior to making the partial backup [<span class="bold"><strong>Editor's note</strong></span>: Shorewall places only user-modifiable files in /etc].</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It's obviously possible to do the above 'in-place', without using multiple disks, and even without making a partial backup (ie: copy current config files to /tmp, manually extract new package on top of current running firewall, then copy or merge config data from /tmp and backup...or similar), but anyone capable of that level of command line gymnastics is probably doing it already, without needing detailed instructions! :-)</p></div></blockquote></div><p>For information on other LEAF/Bering upgrade tools, check out <a class="ulink" href="http://leaf.cvs.sourceforge.net/*checkout*/leaf/devel/alexrh/lck/README.html" target="_self">this article by Alex Rhomberg</a>.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Config_Files"></a>Configuring Shorewall</h2></div></div></div><p>You will need to edit some or all of the configuration files to match your setup. In most cases, the <a class="ulink" href="shorewall_quickstart_guide.htm" target="_self">Shorewall QuickStart Guides</a> contain all of the information you need.</p></div><div class="section" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="Uninstall"></a>Uninstall/Fallback</h2></div></div></div><p>See “<span class="quote"><a class="ulink" href="fallback.htm" target="_self">Fallback and Uninstall</a></span>”.</p></div></div></body></html>