911625
# Sample configuration for nftables service.
911625
# Load this by calling 'nft -f /etc/nftables/main.nft'.
911625
911625
# Note about base chain priorities:
911625
# The priority values used in these sample configs are
911625
# offset by 20 in order to avoid ambiguity when firewalld
911625
# is also running which uses an offset of 10. This means
911625
# that packets will traverse firewalld first and if not
911625
# dropped/rejected there will hit the chains defined here.
911625
# Chains created by iptables, ebtables and arptables tools
911625
# do not use an offset, so those chains are traversed first
911625
# in any case.
911625
911625
# drop any existing nftables ruleset
911625
flush ruleset
911625
911625
# a common table for both IPv4 and IPv6
911625
table inet nftables_svc {
911625
911625
	# protocols to allow
911625
	set allowed_protocols {
911625
		type inet_proto
911625
		elements = { icmp, icmpv6 }
911625
	}
911625
911625
	# interfaces to accept any traffic on
911625
	set allowed_interfaces {
911625
		type ifname
911625
		elements = { "lo" }
911625
	}
911625
911625
	# services to allow
911625
	set allowed_tcp_dports {
911625
		type inet_service
911625
		elements = { ssh, 9090 }
911625
	}
911625
911625
	# this chain gathers all accept conditions
911625
	chain allow {
911625
		ct state established,related accept
911625
911625
		meta l4proto @allowed_protocols accept
911625
		iifname @allowed_interfaces accept
911625
		tcp dport @allowed_tcp_dports accept
911625
	}
911625
911625
	# base-chain for traffic to this host
911625
	chain INPUT {
911625
		type filter hook input priority filter + 20
911625
		policy accept
911625
911625
		jump allow
911625
		reject with icmpx type port-unreachable
911625
	}
911625
}
911625
911625
# By default, any forwarding traffic is allowed.
911625
# Uncomment the following line to filter it based
911625
# on the same criteria as input traffic.
911625
#include "/etc/nftables/router.nft"
911625
911625
# Uncomment the following line to enable masquerading of
911625
# forwarded traffic. May be used with or without router.nft.
911625
#include "/etc/nftables/nat.nft"