Rules
Rules define what should happen with the trafiic matched by the zones.
Each rule has a list of from zones and to zones.
A rule only gets applied, if the traffic in question originated in one of the from zones and is heading to one of the to zones.
If matched, the rule can define ports to open, a terminating verdict or any custom nft rules by using extraLines.
Rules are applied from most specific to least specific, traversing the from side before the to side.
To allow for more complex setups (mostly custom drop/reject rules) rules are applied in multipe passes.
Each rule has a ruleType.
Rules are gruped by their type and applied in these groups, so that all rules are applied for the first type, before rules of the next type are taken into consideration.
Options in networking.nftables.firewall.rules.<name>
Section titled “Options in networking.nftables.firewall.rules.<name>”...after
Section titled “...after”| Name | networking.nftables.firewall.rules.<name>.after |
|---|---|
| Type | non-empty (list of string) |
| Declared in |
...allowedTCPPortRanges
Section titled “...allowedTCPPortRanges”| Name | networking.nftables.firewall.rules.<name>.allowedTCPPortRanges |
|---|---|
| Type | list of (submodule) |
| Default | [ ] |
| Example | [ { from = 1337; to = 1347; } ] |
| Declared in |
...allowedTCPPortRanges.*.from
Section titled “...allowedTCPPortRanges.*.from”| Name | networking.nftables.firewall.rules.<name>.allowedTCPPortRanges.*.from |
|---|---|
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Declared in |
...allowedTCPPortRanges.*.to
Section titled “...allowedTCPPortRanges.*.to”| Name | networking.nftables.firewall.rules.<name>.allowedTCPPortRanges.*.to |
|---|---|
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Declared in |
...allowedTCPPorts
Section titled “...allowedTCPPorts”| Name | networking.nftables.firewall.rules.<name>.allowedTCPPorts |
|---|---|
| Type | list of signed integer |
| Default | [ ] |
| Declared in |
...allowedUDPPortRanges
Section titled “...allowedUDPPortRanges”| Name | networking.nftables.firewall.rules.<name>.allowedUDPPortRanges |
|---|---|
| Type | list of (submodule) |
| Default | [ ] |
| Example | [ { from = 55000; to = 56000; } ] |
| Declared in |
...allowedUDPPortRanges.*.from
Section titled “...allowedUDPPortRanges.*.from”| Name | networking.nftables.firewall.rules.<name>.allowedUDPPortRanges.*.from |
|---|---|
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Declared in |
...allowedUDPPortRanges.*.to
Section titled “...allowedUDPPortRanges.*.to”| Name | networking.nftables.firewall.rules.<name>.allowedUDPPortRanges.*.to |
|---|---|
| Type | 16 bit unsigned integer; between 0 and 65535 (both inclusive) |
| Declared in |
...allowedUDPPorts
Section titled “...allowedUDPPorts”| Name | networking.nftables.firewall.rules.<name>.allowedUDPPorts |
|---|---|
| Type | list of signed integer |
| Default | [ ] |
| Declared in |
...before
Section titled “...before”| Name | networking.nftables.firewall.rules.<name>.before |
|---|---|
| Type | non-empty (list of string) |
| Declared in |
...early
Section titled “...early”| Name | networking.nftables.firewall.rules.<name>.early |
|---|---|
| Type | boolean |
| Default | false |
| Declared in |
...enable
Section titled “...enable”| Name | networking.nftables.firewall.rules.<name>.enable |
|---|---|
| Type | boolean |
| Default | true |
| Declared in |
...extraLines
Section titled “...extraLines”| Name | networking.nftables.firewall.rules.<name>.extraLines |
|---|---|
| Type | list of string |
| Default | [ ] |
| Declared in |
...from
Section titled “...from”| Name | networking.nftables.firewall.rules.<name>.from |
|---|---|
| Type | value "all" (singular enum) or list of string |
| Declared in |
...ignoreEmptyRule
Section titled “...ignoreEmptyRule”| Name | networking.nftables.firewall.rules.<name>.ignoreEmptyRule |
|---|---|
| Description | Usually rules without effect will fail the build. Enable this switch to suppress the check for this rule. |
| Type | boolean |
| Default | false |
| Declared in |
...late
Section titled “...late”| Name | networking.nftables.firewall.rules.<name>.late |
|---|---|
| Type | boolean |
| Default | false |
| Declared in |
...ruleType
Section titled “...ruleType”| Name | networking.nftables.firewall.rules.<name>.ruleType |
|---|---|
| Description | The type of the rule specifies when rules are applied.
The rules are applied in the following order:
Usually most rules are of the type |
| Type | one of "ban", "rule", "policy" |
| Default | "rule" |
| Declared in |
| Name | networking.nftables.firewall.rules.<name>.to |
|---|---|
| Type | value "all" (singular enum) or list of string |
| Declared in |
...verdict
Section titled “...verdict”| Name | networking.nftables.firewall.rules.<name>.verdict |
|---|---|
| Type | null or one of "accept", "drop", "reject" |
| Default | null |
| Declared in |