Firewall nftables settings (firewall.toml)
By default, the settings from the firewall are located here:
/etc/kor-elf-shield/firewall.toml
The path to these settings can be changed in the main settings and can be found here (firewall parameter).
A copy of the full settings file is here.
There are several sections in this file:
Port Settings
These settings should be located at the beginning of the file before the sections: "IPv4 Settings", "IPv6 Settings", "General Settings", "Default Action Policy", "Metadata naming".
| Parameter | [[ports]] |
| Meaning | We specify a group of port settings |
| By default | |
| Description | This is a group of port settings. [[ports]] you can specify an unlimited number of groups. [[ports]] numbers - Port numbers (required field) directions - Incoming (in), outgoing (out) traffic (required field) protocols - Protocol: tcp, udp (required field) action - Action: accept, drop, or reject (required field) limit_rate - Specify restrictions if necessary (optional field) numbers - you can specify one or more ports, but the rules will be created separately for each port. directions - if we specify in and out, then each rule is created separately in its own chain. protocols - if tcp and udp are specified, then each rule is created separately for each protocol. action: accept - allow drop - block silently reject - blocking with feedback limit_rate - set it according to the nftables documentation (limit rate). |
| Examples |
Another example:
Another example:
|
| *** | |
|---|---|
| Parameter | [[ips]] |
| Meaning | We specify a group of IP address settings |
| By default | |
| Description |
Specify the IP addresses to allow or prohibit. [[ips]] an unlimited number of groups can be specified. |
| Examples |
Another example:
|
IPv4 Settings
To specify the parameters for this section, you must first specify [ip4], and then specify the other parameters of this section. Example:
[ip4]
icmp_in = true
icmp_in_rate = "1/second"
icmp_out = true
| Parameter | icmp_in |
| Meaning | true or false |
| By default | true |
| Description | Allow incoming PING. Disabling PING may disrupt external monitoring. true - includes false - turns it off |
| Examples |
|
| *** | |
|---|---|
| Parameter | icmp_in_rate |
| Meaning | Set limits on the number of simultaneous packets per second. |
| By default | 1/second |
| Description | Set limits on the number of simultaneous incoming packets per second. If the number of packets exceeds the specified period, the remaining packets will be discarded. If you notice unwanted losses, increase the value or disable it. To disable the speed limit, set the value to "0", otherwise set it according to the nftables (limit rate) documentation. For example, "1/second" will limit transmission to one packet per second. |
| Examples |
|
| *** | |
| Parameter | icmp_out |
| Meaning | true or false |
| By default | true |
| Description | Allow outgoing PING. If there are no special reasons, it is better not to disable it, otherwise it may disrupt the OS. true - includes false - turns it off |
| Examples |
|
| *** | |
| Parameter | icmp_out_rate |
| Meaning | Set limits on the number of simultaneous packets per second. |
| By default | 0 |
| Description | Set limits on the number of simultaneous outgoing packets per second. If the number of packets exceeds the specified period, the remaining packets will be discarded. If there are no special reasons, it is better not to include restrictions, otherwise it may disrupt the OS. To disable the speed limit, set the value to "0", otherwise set it according to the nftables (limit rate) documentation. For example, "1/second" will limit transmission to one packet per second. |
| Examples |
|
| *** | |
| Parameter | icmp_timestamp_drop |
| Meaning | true or false |
| By default | false |
| Description | Block ICMP timestamp requests. In fact, there is almost no real threat, but sometimes IT auditors insist on blocking ICMP timestamp requests. true - includes false - turns it off |
| Examples |
|
IP6 Settings
To specify the parameters for this section, you must first specify [ip6], and then specify the remaining parameters of this section. Example:
[ip6]
enable = true
icmp_strict = false
| Parameter | enable |
| Meaning | true or false |
| By default | false |
| Description | Enables IPv6 support. If IPv6 is disabled, all IPv6-related settings will be ignored. true - includes false - turns it off |
| Examples |
|
| *** | |
|---|---|
| Parameter | icmp_strict |
| Meaning | true or false |
| By default | false |
| Description | IPv6 actively uses ICMPV6 packets, so ICMPV6 strict mode is disabled by default. However, this may increase the risk of attacks on ICMPV6. You can enable strict mode, but this may cause problems with some types of connections. true - includes false - turns it off |
| Examples |
|
General settings
To specify the parameters for this section, you must first specify [options], and then specify the remaining parameters of this section. Example:
[options]
saves_rules = false
saves_rules_path = "/etc/nftables.conf"
dns_strict = false
| Parameter | saves_rules |
| Meaning | true or false |
| By default | false |
| Description | Will the daemon save the rules to the nftables system file? Don't forget to check that the path to nftables matches your OS. If you do not save the rules to the nftables system file, then after restarting the nftables program (for example, after updating) all the rules will be erased. Nevertheless, by default, we decided to disable automatic saving of rules to the nftables system file, because we first need to make sure that the saves_rules_path parameter points to the correct file. true - includes false - turns it off |
| Examples |
|
| *** | |
|---|---|
| Parameter | saves_rules_path |
| Meaning | Specify the path to the file |
| By default | /etc/nftables.conf |
| Description | The path where the rules for nftables will be saved. Specify the path that corresponds to your OS. The path must be absolute. The relative path will cause an error! It is mandatory to specify .conf at the end. |
| Examples |
|
| *** | |
| Parameter | dns_strict |
| Meaning | true or false |
| By default | false |
| Description | Enables strict nftables rules for DNS traffic. If you enable this mode, some DNS-related rules will not be added to nftables. This will improve security and prevent abuse of the local DNS server. But it can cause problems related to DNS. true - includes false - turns it off |
| Examples |
|
| *** | |
| Parameter | dns_strict_ns |
| Meaning | true or false |
| By default | false |
| Description | Enables strict nftables rules for DNS traffic. If you enable this mode, the rules allowing port 53 IP addresses (incoming and outgoing), which are specified in /etc/resolv.conf, will not be added. This may cause a DNS problem. true - includes false - turns it off |
| Examples |
|
| *** | |
| Parameter | packet_filter |
| Meaning | true or false |
| By default | true |
| Description | Adds packet filtering to nftables that breaks the order. It is not recommended to disable it! true - includes false - turns it off |
| Examples |
|
Default Action Policy
To specify the parameters for this section, you must first specify [policy], and then specify the remaining parameters of this section. Example:
[policy]
default_allow_input = false
default_allow_output = false
default_allow_forward = false
| Parameter | default_allow_input |
| Meaning | true or false |
| By default | false |
| Description | Allow incoming traffic by default. true - includes false - turns it off |
| Examples |
|
| *** | |
|---|---|
| Parameter | default_allow_output |
| Meaning | true or false |
| By default | false |
| Description | Allow outgoing traffic by default. true - includes false - turns it off |
| Examples |
|
| *** | |
| Parameter | default_allow_forward |
| Meaning | true or false |
| By default | false |
| Description | Allow forward traffic by default. true - includes false - turns it off |
| Examples |
|
| *** | |
| Parameter | input_drop |
| Meaning | drop or reject |
| By default | drop |
| Description | How to block incoming traffic. drop - block silently reject - blocking with feedback |
| Examples |
|
| *** | |
| Parameter | output_drop |
| Meaning | drop or reject |
| By default | reject |
| Description | How to block outgoing traffic. drop - block silently reject - blocking with feedback |
| Examples |
|
| *** | |
| Parameter | forward_drop |
| Meaning | drop or reject |
| By default | drop |
| Description | How to block forward traffic. drop - block silently reject - blocking with feedback |
| Examples |
|
Naming metadata
To specify the parameters for this section, you must first specify [metadataNaming], and then specify the remaining parameters of this section. Example:
[metadataNaming]
table_name = "shield"
chain_input_name = "input"
chain_output_name = "output"
chain_forward_name = "forward"
| Parameter | table_name |
| Meaning | From 1 character to 32 characters Characters allowed: a-zA-Z0-9_- |
| By default | shield |
| Description | The name of the table in nftables. |
| Examples |
|
| *** | |
|---|---|
| Parameter | chain_input_name |
| Meaning | From 1 character to 32 characters Characters allowed: a-zA-Z0-9_- |
| By default | input |
| Description | The name of the chain for incoming traffic. |
| Examples |
|
| *** | |
| Parameter | chain_output_name |
| Meaning | From 1 character to 32 characters Characters allowed: a-zA-Z0-9_- |
| By default | output |
| Description | The name of the chain for outgoing traffic. |
| Examples |
|
| *** | |
| Parameter | chain_forward_name |
| Meaning | From 1 character to 32 characters Characters allowed: a-zA-Z0-9_- |
| By default | forward |
| Description | The name of the chain for forward traffic. |
| Examples |
|