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 shorewallBackup the original configuration, just in case.
sudo cp -p /etc/shorewall/shorewall.conf /etc/shorewall/shorewall.conf.origCopy 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/rulesChanges:
SSH(ACCEPT) net $FW Web(ACCEPT) net $FWEdit Shorewall config to allow the firewall to start.
sudo nano /etc/shorewall/shorewall.confChanges:
STARTUP_ENABLED=YesEdit Ubuntu’s Shorewall config to allow the firewall to start.
sudo nano /etc/default/shorewallChanges:
startup = 1Start the firewall.
sudo /etc/init.d/shorewall startObserve the new rules.
sudo /sbin/iptables -L
More information:
- Standalone Firewall on Shorewall site
- Installing Shorewall Firewall In Ubuntu/Debian