Chapter 9. Installation - step 6: configure Shorewall

One of the distintive feature of Bering is that it relies on Shorewall to provide it's firewall facility.

The reasons behind this choice are numerous:

The shorwall.lrp package provided on the Bering distro (starting with v1.0-rc2) is built as follow:

Important

Bering shorwall.lrp package is provided by default with the Two-interfaces Masquerading Firewall and the two extra rules mentionned earlier. This setup assumes that eth0 is connected to the Internet via a dynamic IP and that your local network is interfaced through eth1.

To configure Shorewall, start the LEAF packages configuration menu and choose shorwall. The following menu will appear:


                        shorwall configuration files

        1) Params     Assign parameter values
        2) Zones      Partition the network into Zones
        3) Ifaces     Shorewall Networking Interfaces
        4) Hosts      Define specific zones
        5) Policy     Firewall high-level policy
        6) Rules      Exceptions to policy
	7) Maclist    MAC verification
        8) Masq       Internal MASQ Server Configuration
        9) ProxyArp   Proxy ARP Configuration
	10) Stopped   Hosts admitted after 'shorewall stop'
        11) Nat       Static NAT Configuration
        12) Tunnels   Tunnel Definition (ipsec)
        13) TCRules   FWMark Rules
        14) Config    Shorewall Global Parameters
        15) Modules   Netfilter modules to load
        16) TOS       Type of Service policy
        17) Blacklist Blacklisted hosts
	18) RFC1918   Defines 'norfc1918' interface option
        19) ECN       Disable ECN to hosts and networks
	20) Init      Commands executed before [re]start
	21) Start     Commands executed after [re]start
	22) Stop      Commands executed before stop
	23) Stopped   Commands executed after stop

  q) quit
  ----------------------------------------------------------------------------
        Selection:

Check the hyperlinks above, the Quickstart Guide or the Shorewall documentation to have a full explanation on those configuration files.

Four files must be checked absolutely to make sure they fit your needs:

A/ The zone file (entry 2). For a two interfaces setting - Bering's default - it looks like:

#ZONE   DISPLAY         COMMENTS
net     Net             Internet
loc     Local           Local networks
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE  a>

B/ The interfaces file (entry 3) defines your interfaces. Default in Bering is:

(...)
#ZONE   INTERFACE       BROADCAST       OPTIONS
net     eth0            detect          dhcp,routefilter,norfc1918
loc     eth1            detect
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE

C/ The rules file (entry 6) is one of the most important files in Shorewall. Here is the one from Bering:

(...)
##############################################################################
#ACTION         SOURCE          DEST            PROTO   DEST    SOURCE  ORIGINAL
#                                                       PORT    PORT(S) DEST
#
#       Accept DNS connections from the firewall to the network
#
ACCEPT          fw              net             tcp     53
ACCEPT          fw              net             udp     53
#
#       Accept SSH connections from the local network for administration
#
ACCEPT          loc             fw              tcp     22
#
#       Allow Ping To And From Firewall
#
ACCEPT          loc             fw              icmp    8
ACCEPT          net             fw              icmp    8
ACCEPT          fw              loc             icmp    8
ACCEPT          fw              net             icmp    8
#
# Bering specific rules:
# allow loc to fw udp/53 for dnscache to work
# allow loc to fw tcp/80 for weblet to work
#
ACCEPT          loc       fw            udp     53
ACCEPT          loc       fw            tcp     80
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE

As you can notice from above, two rules have been added to the two-interfaces file. They allow:

D/ Finally the masq file (entry 7). In Bering it looks like:

(...)
#INTERFACE              SUBNET
eth0                    eth1
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE

Important

If you change any of the shorewall parameters, remember to backup shorwall.lrp !