Blame SOURCES/main.nft

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