All of lore.kernel.org
 help / color / mirror / Atom feed
* nftables >= 0.9.8: atomic update (nft -f ...) of a set not possible any more
@ 2022-01-04 16:31 etkaar
  2022-01-04 19:57 ` Florian Westphal
  0 siblings, 1 reply; 5+ messages in thread
From: etkaar @ 2022-01-04 16:31 UTC (permalink / raw)
  To: netfilter

Dear colleagues,

given is following perfectly working ruleset (nft list ruleset), which drops almost all of the IPv4 traffic, but grants access to port 22 (SSH) for two IPv4 addresses provided by the set named 'whitelist_ipv4_tcp':

+++
table inet filter {
	set whitelist_ipv4_tcp {
		type inet_service . ipv4_addr
		flags interval
		elements = { 22 . 111.222.333.444,
			     22 . 555.666.777.888 }
	}

	set whitelist_ipv4_udp {
		type inet_service . ipv4_addr
		flags interval
	}

	set blacklist_ipv4 {
		type ipv4_addr
		flags interval
	}

	chain default_input {
		type filter hook input priority filter + 1; policy drop;
		ip saddr @blacklist_ipv4 drop
		ct state established,related accept
		ct state invalid drop
		iifname "lo" accept
		ip protocol icmp icmp type { echo-reply, destination-unreachable, echo-request, router-advertisement, router-solicitation, time-exceeded, parameter-problem } accept
		meta nfproto ipv4 tcp dport . ip saddr @whitelist_ipv4_tcp accept
		meta nfproto ipv4 udp dport . ip saddr @whitelist_ipv4_udp accept
	}

	chain default_forward {
		type filter hook forward priority filter; policy drop;
	}

	chain default_output {
		type filter hook output priority filter; policy accept;
		oifname "lo" accept
	}
}

+++

Now comes the strange thing: In case the ruleset is atomically updated using following file (nft -f ...) the output of 'nft list ruleset' does not change at all (which is expected!), but now the IPv4 addresses do not any more have access:

+++
#!/usr/sbin/nft -f
flush set inet filter whitelist_ipv4_tcp
flush set inet filter whitelist_ipv4_udp
table inet filter {
	set whitelist_ipv4_tcp {
		type inet_service . ipv4_addr; flags interval;
		elements = {
			22 . 111.222.333.444/32,
			22 . 555.666.777.888/32,
		}
	}
	set whitelist_ipv4_udp {
		type inet_service . ipv4_addr; flags interval;
	}
}

+++

I have double-checked that in the logs:

+++
nft dropped: [...] SRC=111.222.333.444 DST=194.48.XXX.XX [...] DPT=22 [...]
+++

This problem is not present in Debian 10 (Buster) which uses nftables 0.9.0. But it is present in Debian 11 (Bullseye) which uses nftables 0.9.8. Because I even got a segmentation fault here I cannot reproduce yet, I tried it with nftables 1.0.1 - but still no success.

I don't understand how the 'nft list ruleset' output can be identical after using 'nft -f ...'. In any case, the IPv4 addresses are part of the whitelist set and are unexpectedly blocked.

Kind Regards,
etkaar


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: nftables >= 0.9.8: atomic update (nft -f ...) of a set not possible any more
@ 2022-01-07 14:54 etkaar
  0 siblings, 0 replies; 5+ messages in thread
From: etkaar @ 2022-01-07 14:54 UTC (permalink / raw)
  To: netfilter

Dear Florian and Stefano,

thanks so much for your fast response!

Unfortunately I am not really able yet to apply a kernel patch, because that would be the first time at all I modify the kernel and I am afraid of being locked-out again in case Debian afterwards updates the kernel with a newer version which still is affected of the bug. I am not so familiar with that, because for stability and security reasons I usually always leave my Debian installation as they are.

However, I am able to compile nftables itself and replace Debian 11 Bullseyes version 0.9.8 with 1.0.1, but this version still contains the bug. Once there is an update to 1.0.2 and this bug is fixed, compiling and replacing the 0.9.8 version with it should be enough, or is still a kernel patch required in that case?

Kind Regards,
etkaar


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: nftables >= 0.9.8: atomic update (nft -f ...) of a set not possible any more
@ 2022-04-22 12:08 etkaar
  0 siblings, 0 replies; 5+ messages in thread
From: etkaar @ 2022-04-22 12:08 UTC (permalink / raw)
  To: netfilter

Dear colleagues,

am I right if I assume that this has been patched into the Kernel of 5.10.106-1 (2022-03-17)?

I am not able anymore to reproduce the issue, but I just want to double-check that.

Kind Regards,
etkaar


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-22 12:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-04 16:31 nftables >= 0.9.8: atomic update (nft -f ...) of a set not possible any more etkaar
2022-01-04 19:57 ` Florian Westphal
2022-01-04 23:22   ` Stefano Brivio
  -- strict thread matches above, loose matches on Subject: below --
2022-01-07 14:54 etkaar
2022-04-22 12:08 etkaar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.