I have nftables setup to reject packets that don't match my allow block (nft list ruleset
added below), but the packets are being dropped instead.
For context, I have a service that listens on port 8080 that only localhost should have access to (for now). My setup allows that but clients are timing out with their requests instead of getting a reject.
This is the ruleset I'm using (slightly truncated for brevity), including the traces I've used for debugging:
# nft list ruleset
table inet firewall {
set allowed_protocols {
type inet_proto
elements = { icmp, ipv6-icmp }
}
set allowed_interfaces {
type ifname
elements = { "lo" }
}
set allowed_tcp_dports {
type inet_service
elements = { 22, 80, 443 }
}
chain allow {
ct state established,related accept
meta l4proto @allowed_protocols accept
iifname @allowed_interfaces accept
meta nftrace set 1
tcp dport @allowed_tcp_dports accept
}
chain input {
type filter hook input priority 20; policy accept;
jump allow
meta nftrace set 1
reject
}
chain forward {
type filter hook forward priority 20; policy accept;
jump allow
meta nftrace set 1
reject
}
}
From my trace, I can see packets being dropped instead:
trace id 36f72c1b inet firewall allow rule meta nftrace set 1 (verdict continue)
trace id 36f72c1b inet firewall allow verdict continue
trace id 36f72c1b inet firewall input rule meta nftrace set 1 (verdict continue)
trace id 36f72c1b inet firewall input rule reject (verdict drop)
It explicitly reads reject but then decided to drop anyway. Any idea what the cause for this is?