Debian / Ubuntu Linux: Install and Configure Shoreline Firewall (Shorewall)

www‮.‬lautturi.com
Debian / Ubuntu Linux: Install and Configure Shoreline Firewall (Shorewall)

Shoreline Firewall (Shorewall) is a firewall configuration tool for Linux systems that allows you to define rules for filtering network traffic. To install and configure Shorewall on a Debian-based Linux system, such as Ubuntu, you can follow these steps:

  1. Install the shorewall package by running the following command:
sudo apt-get install shorewall
  1. Create the Shorewall configuration files. Shorewall uses a set of configuration files to define the firewall rules. The main configuration file is /etc/shorewall/shorewall.conf, and there are several other configuration files in the /etc/shorewall directory. You can copy the default configuration files and modify them to suit your needs. For example:
sudo cp -R /usr/share/doc/shorewall/default-config/ /etc/shorewall/
  1. Modify the configuration files as needed. You will need to at least specify the interfaces and zones in the /etc/shorewall/interfaces and /etc/shorewall/zones files, respectively. For example:
/etc/shorewall/interfaces:

#ZONE   INTERFACE   BROADCAST   OPTIONS
net     eth0        detect

/etc/shorewall/zones:

#ZONE   TYPE        OPTIONS   IN                 OUT
net     ipv4

This defines a zone called net that uses the eth0 interface, and specifies that the zone is an IPv4 zone.

  1. Define the firewall rules. The firewall rules are defined in the /etc/shorewall/rules file. You can use this file to specify which traffic is allowed and which is denied. For example:
/etc/shorewall/rules:

#ACTION         SOURCE          DEST            PROTO   DEST    SOURCE  ORIGINAL
#                                                       PORT
Created Time:2017-10-28 14:02:26  Author:lautturi