Bug 2023436

Summary: [RFE] Add nftables support to netavark
Product: Red Hat Enterprise Linux 8 Reporter: Sameer <snangare>
Component: netavarkAssignee: Brent Baude <bbaude>
Status: CLOSED MIGRATED QA Contact: David Darrah/Red Hat QE <ddarrah>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.5CC: bbaude, cpippin, dornelas, dwalsh, jligon, jnovy, jsturges, lsm5, mheon, mrussell, pthomas, stefan.zwijsen, tsweeney, umohnani
Target Milestone: rcKeywords: FutureFeature, MigratedToJIRA
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-11 18:35:59 UTC Type: Story
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.

Comment 42 RHEL Program Management 2023-09-11 18:32:30 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 43 RHEL Program Management 2023-09-11 18:35:59 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.

Comment 44 Red Hat Bugzilla 2024-01-27 04:25:10 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days