| 1 |
# zone-zone |
| 2 |
|
| 3 |
FromZone-ToZone section defines [rules](../rule/index.md) for traffic coming from |
| 4 |
FromZone and going to ToZone. Normally you first accept some traffic |
| 5 |
and then [reject or drop](../rule/statement.md#accept-drop-reject) everything else as final |
| 6 |
rule. Rules inside zone-zone section are (mostly, see below) processed in |
| 7 |
listed order. Example: |
| 8 |
|
| 9 |
``` |
| 10 |
public-localhost { |
| 11 |
# Allow some incoming traffic |
| 12 |
dhcp-client |
| 13 |
ping |
| 14 |
ssh |
| 15 |
|
| 16 |
# Drop everything else |
| 17 |
drop log |
| 18 |
} |
| 19 |
|
| 20 |
localhost-public { |
| 21 |
# Allow some outgoing traffic |
| 22 |
dhcp-server |
| 23 |
domain |
| 24 |
https |
| 25 |
ping |
| 26 |
ssh |
| 27 |
|
| 28 |
# Reject everything else |
| 29 |
reject log |
| 30 |
} |
| 31 |
``` |
| 32 |
|
| 33 |
Foomuuri will automatically add final `drop log` (or `reject log` for |
| 34 |
`localhost-something`) rule to zone-zone section if not specified. It is |
| 35 |
always better to add explicit final rule to configuration. |
| 36 |
|
| 37 |
Zone-zone section `localhost-localhost` (aka loopback traffic, aka |
| 38 |
`127.0.0.1` and `::1`) is special case. It's final rule is `accept`. Usually |
| 39 |
there is no need to add `localhost-localhost`section. |
| 40 |
|
| 41 |
Normal use case for `localhost-localhost` is to deny some traffic and then |
| 42 |
accept everything else. |
| 43 |
|
| 44 |
``` |
| 45 |
localhost-localhost { |
| 46 |
# Don't allow user "untrusted" to connect local services |
| 47 |
uid untrusted drop log |
| 48 |
|
| 49 |
# Don't allow local http traffic |
| 50 |
http reject log |
| 51 |
|
| 52 |
# Accept everything else |
| 53 |
accept |
| 54 |
} |
| 55 |
``` |
| 56 |
|
| 57 |
Please note that loopback traffic from your public IP to your public IP |
| 58 |
belongs to `localhost-localhost`, not `public-public`. |
| 59 |
|
| 60 |
If you have a lot of zones there will be a lot of zone-zone pairs. See |
| 61 |
[configuration files](../basic.md#configuration-files) for recommendations |
| 62 |
how to split them to multiple files. |
| 63 |
|
| 64 |
"Mostly": Rules inside zone-zone section are automatically sorted and |
| 65 |
processed in following block order: |
| 66 |
|
| 67 |
1. ICMP rules in listed order |
| 68 |
2. Previously accepted established and related traffic is accepted by conntrack |
| 69 |
3. Incoming multicast and broadcast rules in listed order |
| 70 |
4. Everything else in listed order |