Simple Shorewall config on Ubuntu server
Here are the steps I used to configure a simple Shorewall firewall on Ubuntu Lucid (10.04). The firewall provides SSH and webserver access only; all other ports are blocked.
Install the Shorewall firewall. Version 4.4.x was available on Lucid at the time of writing.
sudo apt-get install shorewall
Backup the original configuration, just in case.
sudo cp -p /etc/shorewall/shorewall.conf /etc/shorewall/shorewall.conf.orig
Copy the provided configuration for a single-interface machine.
sudo cp -p /usr/share/doc/shorewall/examples/one-interface/* /etc/shorewall/
Add rules to allow SSH and web access.
sudo nano /etc/shorewall/rules
SSH(ACCEPT) net $FW Web(ACCEPT) net $FW
Edit Shorewall config to allow the firewall to start.
sudo nano /etc/shorewall/shorewall.conf
Edit Ubuntu's Shorewall config to allow the firewall to start.
sudo nano /etc/default/shorewall
startup = 1
Start the firewall.
sudo /etc/init.d/shorewall start
Observe the new rules.
sudo /sbin/iptables -L