User Tools

Site Tools


build:firewall

This is an old revision of the document!


Firewall

We originally went with PCX Firewall on our test/development server, as James Pattie was most familiar with it. When we built the production servers, we decided to go with something more standard, so that others would be able to work with it later, if James isn't around. (And he wasn't around when we built the production servers.) So we decided to go with Shorewall. Shorewall also has the advantage that we don't need to provide the IP addresses of the system – it determines them dynamically. So when we change IP addresses, we don't have to re-configure the firewall.

Requirements

Shorewall doesn't seem to have any requirements, except perhaps a working network stack.

All we want from the firewall is basic host protection. (We don't do any routing, so we don't need to worry about packets going through the system.) We want to allow all outbound connections, and allow inbound connections to only the following ports:

  • 22 – SSH
  • 25 – SMTP
  • 80 – HTTP
  • 110 – POP
  • 123 – NTP (UDP)
  • 143 – IMAP
  • 443 – HTTPS
  • 993 – IMAPS
  • 995 – POPS
  • 10000 – Webmin (HTTPS)

Installation

Install shorewall (and its documentation):

apt-get install shorewall shorewall-doc

Configuration

In /etc/default/shorewall, set shorewall to run by changing this line:

startup=1

Install default config files for systems with one interface:

cd /tmp
tar xfz /usr/share/doc/shorewall-doc/examples/one-interface.tgz
cp one-interface/* /etc/shorewall/

In /etc/shorewall/shorewall.conf, set some configuration options:

LOGFILE=/var/log/shorewall.log
LOGRATE=10/minute
LOGBURST=5
IPTABLES=/sbin/iptables

Edit /etc/shorewall/rules to add some rules to allow various ports inbound:

ACCEPT net fw tcp 22
ACCEPT net fw tcp 25
ACCEPT net fw tcp 80
ACCEPT net fw tcp 110
ACCEPT net fw udp 123
ACCEPT net fw tcp 143
ACCEPT net fw tcp 443
ACCEPT net fw tcp 993
ACCEPT net fw tcp 995
ACCEPT net fw tcp 10000

Startup

Start shorewall:

touch /var/log/shorewall.log
/etc/init.d/shorewall start

Testing

To check whether Shorewall is running, check what IP Tables are configured:

iptables -L -vn

This should show a large number of tables.

If Shorewall is not running, check the /var/log/shorewall-init.log file for details.

TODO

Determine if our port list is correct for what we need open. We might want to open up additional ports for LMTP, SMTP w/ SSL, and SMTP w/ forced STARTTLS. Perhaps Squid caching and Rsync as well. We might want to remove Webmin and some of the other ports.

Is Shorewall configured to start on boot at the proper time? Is there a window of time where the network starts up (and there are services running) before Shorewall is protecting the system?

How can we back up our configuration on a regular basis?

How much ICMP do we block? How much do we want to block?

Credits

Shorewall was initially installed and configured by Jeff Muse on 2005-07-30. Craig Buchek assisted and documented.

PCX Firewall was initially installed, configured, and documented on the test/development system by James Pattie and Carl Fitch, 2005-02-19.

Comments

build/firewall.1169225458.txt.gz · Last modified: 2007/05/30 20:47 (external edit)