SHOREWALL-ZONES(5)
β¨ NAME β¨
zones β the Shorewall zone declaration file, aka where you tell Shorewall who's who on your network π
π SYNOPSIS π
/etc/shorewall/zones
π DESCRIPTION π
okay bestie, so the /etc/shorewall/zones file is literally where you declare your network zones. That's the whole job. You don't list hosts here though β you go specify the hosts in each zone over in /etc/shorewall/interfaces or /etc/shorewall/hosts. zones file = the vibes, interfaces/hosts = the guest list π
The columns go like this (and heads up: where a column name is followed by a different name in parentheses, that different name is what you use in the alternate specification syntax):
πΈ ZONE β zone[:parent-zone[,parent-zone]...] πΈ
Name of the zone, periodt. It must start with a letter and be made of letters, digits or _. The names "all", "none", "any", "SOURCE" and "DEST" are reserved and you may not use them as zone names, no exceptions. π«
The max length of a zone name is determined by the LOGFORMAT option in shorewall.conf[1](5). With the default LOGFORMAT, zone names can be at most 5 characters long. The maximum length of an iptables log prefix is 29 bytes. As explained in shorewall.conf[1](5), the legacy default LOGPREFIX formatting string is "Shorewall:%s:%s:" where the first %s is replaced by the chain name and the second is replaced by the disposition.
- The
"Shorewall:%s:%s:"formatting string has 12 fixed characters ("Shorewall"and three colons). - The longest of the standard dispositions are
ACCEPTandREJECTwhich have 6 characters each. - The canonical name for the chain containing the rules for traffic going from zone 1 to zone 2 is
"<zone 1>2<zone 2>"or"<zone 1>-<zone 2>". - So if M is the maximum zone name length, such chains can have length
2*M + 1.
12 + 6 + 2*M + 1 = 29 which reduces to
2*M = 29 - 12 - 6 - 1 = 10 or
M = 5
In Shorewall 5.1.0, the LOGFORMAT in the default and sample shorewall.conf files was changed to "%s:%s ".
- That formatting string has 2 fixed characters (
":"and a space). - So the maximum zone name length M is calculated as:
2 + 6 + 2*M + 1 = 29
2M = 29 - 2 - 6 - 1 = 20
M = 10
The order in which Shorewall matches addresses from packets to zones is determined by the order of zone declarations. Where a zone is nested in one or more other zones, you may either ensure that the nested zone precedes its parents in this file, or you may follow the (sub)zone name by ":" and a comma-separated list of the parent zones. The parent zones must have been declared in earlier records in this file β no jumping the queue, bestie. See shorewall-nesting[2](5) for additional information. πͺΊ
Example:
#ZONE TYPE OPTIONS IN OPTIONS OUT OPTIONS
a ip
b ip
c:a,b ip
Currently, Shorewall uses this information to reorder the zone list so that parent zones appear after their subzones in the list. The IMPLICIT_CONTINUE option in shorewall.conf[1](5) can also create implicit CONTINUE policies to/from the subzone.
Where an ipsec zone is explicitly included as a child of an ip zone, the ruleset allows CONTINUE policies (explicit or implicit) to work as expected. β
In the future, Shorewall may make additional use of nesting information. (foreshadowing π)
π¦ TYPE π¦
ipβ This is the standard Shorewall zone type and is the default if you leave this column empty or if you enter-in the column. Communication with some zone hosts may be encrypted. Encrypted hosts are designated using the'ipsec'option inshorewall-hosts[3](5). For clarity, this zone type may be specified asipv4in IPv4 configurations andipv6in IPv6 configurations.ipsecβ Communication with all zone hosts is encrypted. Your kernel and iptables must include policy match support. For clarity, this zone type may be specified asipsec4in IPv4 configurations andipsec6in IPv6 configurations.firewallβ Designates the firewall itself. You must have exactly one'firewall'zone. No options are permitted with a'firewall'zone. The name that you enter in theZONEcolumn will be stored in the shell variable$FWwhich you may use in other configuration files to designate the firewall zone. πbportβ The zone is associated with one or more ports on a single bridge. For clarity, this zone type may be specified asbport4in IPv4 configurations andbport6in IPv6 configurations.vserverβ Added in Shorewall 4.4.11 Beta 2 β A zone composed of Linux-vserver guests. The zone contents must be defined inshorewall-hosts[3](5).
Vserver zones are implicitly handled as subzones of the firewall zone.
loopbackβ Added in Shorewall 4.5.17.
Normally, Shorewall treats the loopback interface (lo) in the following way:
- By default, all traffic through the interface is
ACCEPTed. - If a
$FW->$FWpolicy is defined or$FW->$FWrules are defined, they are placed in a chain named${FW}2${F2}or${FW}-${FW}(e.g.,'fw2fw'or'fw-fw') depending on theZONE2ZONEsetting inshorewall.conf[1](5). $FW->$FWtraffic is only filtered in theOUTPUTchain.
By defining a loopback zone and associating it with the loopback interface in shorewall-interfaces(5), you can effect a slightly different model. Suppose that the loopback zone name is 'local'; then:
- Both
$FW->localandlocal->$FWchains are created. - The
$FW->localandlocal->$FWpolicies may be different. - Both
$FW->localandlocal->$FWrules may be specified.
Rules to/from the loopback zone and any zone other than the firewall zone are ignored with a warning. β οΈ
loopback zones may be nested within other loopback zones.
localβ Added in Shorewall 4.5.17.localis the same asipv4with the exception that the zone is only accessible from the firewall and vserver zones.
π OPTIONS, IN OPTIONS and OUT OPTIONS (options, in_options, out_options) β [option[,option]...] π
A comma-separated list of options. With the exception of the mss and blacklist options, these only apply to TYPE ipsec zones. π
dynamic_sharedβ Added in Shorewall 4.5.9. May only be specified in theOPTIONScolumn and indicates that only a single ipset should be created for this zone if it has multiple dynamic entries inshorewall-hosts[3](5). Without this option, a separate ipset is created for each interface.reqid=number β where number is specified usingsetkey(8)using the'unique:number option for the SPD level.spi=<number>β where number is the SPI of the SA used to encrypt/decrypt packets.proto=ah|esp|ipcompβ IPSEC Encapsulation Protocolmss=number β sets theMSSfield in TCP packets. If you supply this option, you should also setFASTACCEPT=Noinshorewall.conf[1](5) to insure that both theSYNandSYN,ACKpackets have theirMSSfield adjusted.mode=transport|tunnelβ IPSEC modetunnel-src=address[/mask]β only available withmode=tunneltunnel-dst=address[/mask]β only available withmode=tunnelstrictβ Means that packets must match all rules.nextβ Separates rules; can only be used withstrict
The options in the OPTIONS column are applied to both incoming and outgoing traffic. The IN OPTIONS are applied to incoming traffic (in addition to OPTIONS) and the OUT OPTIONS are applied to outgoing traffic.
If you wish to leave a column empty but need to make an entry in a following column, use -. π«Ά
π FILES π
/etc/shorewall/zones/etc/shorewall6/zones
π SEE ALSO π
https://shorewall.org/Multiple_Zones.html[4].https://shorewall.org/configuration_file_basics.htm#Pairs[5]shorewall(8)
π NOTES π
- shorewall.conf
https://shorewall.org/manpages/shorewall.conf.html - shorewall-nesting
https://shorewall.org/manpages/shorewall-nesting.html - shorewall-hosts
https://shorewall.org/manpages/shorewall-hosts.html https://shorewall.org/Multiple_Zones.htmlhttps://shorewall.org/Multiple_Zones.htmlhttps://shorewall.org/configuration_file_basics.htm#Pairshttps://shorewall.org/configuration_file_basics.htm#Pairs
and that's the whole page, bestie β this one's from the Configuration Files section, dated 09/24/2020, and it's living in the SHOREWALL-ZONES(5) era. zone responsibly, ily ππ¦β¨
π¦ where this page comes from
- alpine 3.22: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.23: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.24: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- debian bookworm: shorewall6 5.2.8-2 Β· GPL-2.0-or-later
- debian trixie: shorewall6 5.2.8-6 Β· GPL-2.0-or-later
- fedora 43: shorewall6 5.2.8-17.fc43 Β· GPL-2.0-or-later
- fedora 44: shorewall6 5.2.8-18.fc44 Β· GPL-2.0-or-later
- nixos 26.05: shorewall 5.2.8
- nixpkgs unstable: shorewall 5.2.8
- ubuntu noble: shorewall6 5.2.8-5 Β· GPL-2.0-or-later
- ubuntu questing: shorewall6 5.2.8-6
- ubuntu resolute: shorewall6 5.2.8-6build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms