Rules Related To 'nftables'

Component overview

Relevant packages:

Relevant groups:

Changelog:

No changes recorded.

Relevant rules:

Rule details

Verify Group Who Owns /etc/nftables Directory

directory_groupowner_etc_nftables

Description

To properly set the group owner of /etc/nftables, run the command:

$ sudo chgrp root /etc/nftables

Rationale

The ownership of the /etc/nftables directory by the root group is important because this directory hosts nftables configuration. Protection of this directory is critical for system security. Assigning the ownership to root ensures exclusive control of the nftables configuration.

Verify User Who Owns /etc/nftables Directory

directory_owner_etc_nftables

Description

To properly set the owner of /etc/nftables, run the command:

$ sudo chown root /etc/nftables 

Rationale

The ownership of the /etc/nftables directory by the root user is important because this directory hosts nftables configuration. Protection of this directory is critical for system security. Assigning the ownership to root ensures exclusive control of the nftables configuration.

Verify Permissions On /etc/nftables Directory

directory_permissions_etc_nftables

Description

To properly set the permissions of /etc/nftables, run the command:

$ sudo chmod 0700 /etc/nftables

Rationale

Setting correct permissions on the /etc/nftables directory is important because this directory hosts nftables configuration. Protection of this directory is critical for system security. Restricting the permissions ensures exclusive control of the nftables configuration.

Ensure nftables Default Deny Firewall Policy

nftables_ensure_default_deny_policy

Description

Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. There are two policies: accept (Default) and drop. If the policy is set to accept, the firewall will accept any packet that is not configured to be denied and the packet will continue traversing the network stack.

Rationale

It is easier to allow acceptable usage than to block unacceptable usage.

Ensure nftables Rules are Permanent

nftables_rules_permanent

Description

nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames. The nftables service reads the $var_nftables_master_config_file file for a nftables file or files to include in the nftables ruleset. A nftables ruleset containing the input, forward, and output base chains allow network traffic to be filtered.

Rationale

Changes made to nftables ruleset only affect the live system, you will also need to configure the nftables ruleset to apply on boot

Install nftables Package

package_nftables_installed

Description

nftables provides a new in-kernel packet classification framework that is based on a network-specific Virtual Machine (VM) and a new nft userspace command line tool. nftables reuses the existing Netfilter subsystems such as the existing hook infrastructure, the connection tracking system, NAT, userspace queuing and logging subsystem. The nftables package can be installed with the following command:

$ sudo dnf install nftables

Rationale

nftables is a subsystem of the Linux kernel that can protect against threats originating from within a corporate network to include malicious mobile code and poorly configured software on a host.

Uninstall nftables package

package_nftables_removed

Description

nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames and is the successor to iptables. The nftables package can be removed with the following command:

$ sudo dnf erase nftables

Rationale

Running both firewalld and nftables may lead to conflict.

Verify nftables Service is Disabled

service_nftables_disabled

Description

nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames and is the successor to iptables. The nftables service can be disabled with the following command:

systemctl disable nftables

Rationale

Running both firewalld and nftables may lead to conflict. nftables is actually one of the backends for firewalld management tools.

Verify nftables Service is Enabled

service_nftables_enabled

Description

The nftables service allows for the loading of nftables rulesets during boot, or starting on the nftables service The nftables service can be enabled with the following command:

$ sudo systemctl enable nftables.service

Rationale

The nftables service restores the nftables rules from the rules files referenced in the /etc/sysconfig/nftables.conf file during boot or the starting of the nftables service

Ensure Base Chains Exist for Nftables

set_nftables_base_chain

Description

Tables in nftables hold chains. Each table only has one address family and only applies to packets of this family. Tables can have one of six families. Chains are containers for rules. They exist in two kinds, base chains and regular chains. A base chain is an entry point for packets from the networking stack, a regular chain may be used as jump target and is used for better rule organization.

Rationale

If a base chain doesn't exist with a hook for input, forward, and delete, packets that would flow through those chains will not be touched by nftables.

Set nftables Configuration for Loopback Traffic

set_nftables_loopback_traffic

Description

Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network.

Rationale

Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure.

Ensure all outbound and established connections are configured for nftables

set_nftables_new_connections

Description

Configure the nftables firewall rules for new outbound and established connections

Rationale

If rules are not in place for new outbound and established connections, all packets will be dropped by the default policy preventing network usage.

Ensure a Table Exists for Nftables

set_nftables_table

Description

Tables in nftables hold chains. Each table only has one address family and only applies to packets of this family. Tables can have one of six families. Red Hat Enterprise Linux 10 uses firewalld for firewall management. When nftables is the firewall backend used by firewalld, an $var_nftables_family family table called $var_nftables_table is used. To verify that the nftables table used by firewalld exists, run the following command:

$ sudo nft list tables
table $var_nftables_family $var_nftables_table
This table is automatically created by firewalld when it is started.

Rationale

Nftables doesn't have any default tables. Without a table being built, nftables will not filter network traffic.