Bug 2023436 - [RFE] Add nftables support to netavark [NEEDINFO]
Summary: [RFE] Add nftables support to netavark
Keywords:
Status: ASSIGNED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: netavark
Version: 8.5
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Brent Baude
QA Contact: David Darrah/Red Hat QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-15 17:28 UTC by Sameer
Modified: 2023-08-14 14:46 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Story
Target Upstream Version:
Embargoed:
pthomas: needinfo? (cpippin)
tsweeney: needinfo? (bbaude)
tsweeney: needinfo? (mrussell)
tsweeney: needinfo? (bbaude)


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2188083 1 None None None 2023-06-22 00:13:24 UTC
Red Hat Issue Tracker RHELPLAN-102827 0 None None None 2021-11-15 17:54:39 UTC

Internal Links: 2188083

Description Sameer 2021-11-15 17:28:05 UTC
Description of problem:

   Podman CNI is unable to use full nftables (not any iptables compatibility) to work cleanly.

Version-Release number of selected component (if applicable):

   - latest podman on RHEL 8

How reproducible:

   - 100% Reproducible

Steps to Reproduce:

1. Remove the existing firewalld and iptables packages and freshly install podman, nftables

   # yum remove -y firewalld iptables 
   # yum install -y podman nftables 
   # rpm -q podman nftables

2. Migrate existing containers to a new podman version.

   # podman system migrate
 
3. Create rules and inject to nft.

   # cat rulesets.txt 
	add table ip filter
	add chain ip filter INPUT { type filter hook input priority 0; policy drop; }
	add chain ip filter FORWARD { type filter hook forward priority 0; policy drop; }
	add rule ip filter INPUT ct state invalid tcp sport 5010 counter reject with tcp reset
	add rule ip filter INPUT tcp flags & (fin|syn|rst|psh|ack|urg) == fin|syn|rst|psh|ack|urg counter drop
	add rule ip filter INPUT tcp flags & (fin|syn) == fin|syn counter drop
	add rule ip filter INPUT tcp flags & (fin|rst) == fin|rst counter drop
	add rule ip filter INPUT tcp flags & (fin|syn|rst|psh|ack|urg) == fin|psh|urg counter drop
	add rule ip filter INPUT tcp flags & (fin|syn|rst|psh|ack|urg) == 0x0 counter drop
	add rule ip filter INPUT ct state related, established counter accept
	add rule ip filter INPUT iifname "lo" counter accept
	add rule ip filter INPUT ct state invalid counter drop
	add rule ip filter INPUT ct state new tcp flags & (syn|rst|ack) != syn counter drop
	add rule ip filter INPUT meta l4proto icmp icmp type timestamp-request counter drop
	add rule ip filter INPUT meta l4proto icmp icmp type address-mask-request counter drop
	add rule ip filter INPUT ip saddr 127.1.1.0/24 counter accept
	add rule ip filter INPUT ip saddr 127.0.0.0/8 counter drop
	add rule ip filter INPUT ip saddr 169.254.0.0/16 counter drop
	add rule ip filter INPUT ip saddr 192.0.2.0/24 counter drop
	add rule ip filter INPUT ip saddr 224.0.0.0/4 counter drop
	add rule ip filter INPUT ip saddr 240.0.0.0/5 counter drop
	add rule ip filter INPUT ip saddr 248.0.0.0/5 counter drop
	add rule ip filter INPUT meta l4proto icmp ip daddr 255.255.255.255 counter drop
	add rule ip filter INPUT meta l4proto icmp icmp type echo-request limit rate 100/second burst 5 packets counter accept
	add rule ip filter INPUT meta l4proto icmp counter drop
	add rule ip filter INPUT meta l4proto ipv6-icmp limit rate 100/second burst 5 packets counter accept
	add rule ip filter INPUT meta l4proto ipv6-icmp counter drop
	add rule ip filter INPUT tcp dport 22 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 2222 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 5022 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 23 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 5023 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 80 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT tcp dport 443 tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT ip daddr 0.0.0.0 udp sport 161 ip frag-off & 0x1fff != 0 counter accept
	add rule ip filter INPUT tcp dport { 22,2222,5022,23,5023,80,443} tcp flags & (fin|syn|rst|ack) == syn counter drop
	add rule ip filter INPUT ip protocol udp udp sport { 161,162} counter drop
	add rule ip filter INPUT ip protocol udp udp dport { 161,162} counter drop
	add rule ip filter INPUT ct state {new, related, established} tcp flags & (fin|syn|rst|psh|ack|urg) == syn counter accept
	add rule ip filter INPUT ct state {new, related, established} meta l4proto udp counter accept
	add chain ip filter OUTPUT { type filter hook output priority 0; policy drop; }
	add rule ip filter OUTPUT oifname "lo" counter accept
	add rule ip filter OUTPUT counter accept
	add rule ip filter OUTPUT udp sport 161 ip frag-off & 0x1fff != 0 counter accept

   # nft -f rulesets.txt

4. Try to create a test container and observe the error.

   # podman run -d --name nginx -p 80:80 docker.io/nginx


Actual results:

   # podman run -d --name nginx-1 -p 80:80 docker.io/nginx
ERRO[0000] error loading cached network config: network "podman" not found in CNI cache 
WARN[0000] falling back to loading from existing plugins on disk 
Error: error configuring network namespace for container 4376cfc0a24ca5f51676dd66462180aaf0bcc58e4c9df9301e379a2b6a30b270: error adding pod nginx-1_nginx-1 to CNI network "podman": failed to list iptables chains: running [/usr/sbin/iptables -t filter -S --wait]: exit status 1: iptables v1.8.2 (nf_tables): table `filter' is incompatible, use 'nft' tool.

Expected results:

Container should run properly using nftables rules

Additional info:

- We are aware of the bug (1984040) which was closed as WONTFIX, but this needs to be address this as CNI is unable to recognize nft as a default one.

Comment 1 Matthew Heon 2021-11-15 18:35:53 UTC
We are in the process of rewriting the Podman network stack, which should include nftables support. The rewrite itself will land in RHEL 8.6.0, but I don't know if nftables support will be present in the initial version due to time and testing concerns.

Comment 5 Matthew Heon 2022-02-21 14:51:50 UTC
Unsure how I cleared the dependent products, resetting...

Comment 31 Stefan Zwijsen 2023-06-21 09:01:24 UTC
Hi,

What is the status of this? Any date by when we can expect something?
Also, are the plans to support nftables in podman still with CNI and/or with netavark?

Thanks,
Stefan

Comment 32 Matthew Heon 2023-06-21 13:07:27 UTC
CNI has been deprecated in Podman upstream. There are no plans to do any further development with Podman and CNI. As such, this will be fixed in Netavark only.

Comment 33 Derrick Ornelas 2023-06-21 19:18:56 UTC
As discussed, I'm updating the title/summary to clarify that this is adding new functionality to podman/netavark. I'm leaving the component as podman, but feel free to change it to netavark if you feel that's more correct. I assume podman might need to be updated in some way to take advantage of whatever changes are going to go into netavark itself.

Comment 35 Tom Sweeney 2023-06-22 20:48:02 UTC
As this has been determined to be an RFE for Netavark, I'm assigning it to that component, and will also assign it to @bbaude so he can work with @mrussell to prioritize this addition.


Note You need to log in before you can comment on or make changes to this bug.