[pve-devel] [RFC container/firewall/manager/proxmox-firewall/qemu-server 00/37] proxmox firewall nftables implementation

Stefan Hanreich s.hanreich at proxmox.com
Wed Apr 3 09:33:00 CEST 2024


On 4/2/24 22:47, Laurent GUERBY wrote:

> REJECT is a L3 IP feature, to implement it properly in all cases your
> firewall rule needs to know both about IP adresses involved (and the
> corresponding MAC too in the ethernet case). 

Yes indeed, although we have L3 and L4 information available in the
bridge table, otherwise REJECT would also be impossible in the
prerouting / input hooks. REJECTing in the bridge table simply sends a
packet with source and destination IP of the initial packet flipped [1].

Nevertheless, we cannot tell whether the destination IP address in the
packet is actually the IP address of the guest (in the case of VMs) -
even if the MAC address is from the guest. So we might need to combine
this with the ipfilter ipsets if we want to make sure to only send
REJECTs with IP addresses that are actually configured in the guest.


> I don't currently use the proxmox VE firewalling capabilities (I was
> waiting for nftables to look at it :) but may be a compromise would be
> to warn during the transition from iptables to nftables (or from
> version N to N+1) that if a REJECT rule is found without explicit IP
> and MAC that it will just be transformed to DROP, and if the user wants
> a REJECT the user needs to add explicit IP and MAC pairs. 

See my point above regarding ipfilters.


> Then the Promox VE firewalling can be done in "ip" tables which know
> how to match ether MAC ("type ipv4_addr . ether_addr" to match both IP
> and MAC at the same time) and no firewall bridge needed.

Host firewalling is already done in the inet tables (which is ip + ip6),
but for guest firewalling we will have to use the bridge table one way
or another, since it is the only viable hook for handling the guest
traffic (see [2]), which usually runs via bridges.


[1]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/net/ipv4/netfilter/nf_reject_ipv4.c?h=v6.8.2#n168
[2] https://wiki.nftables.org/wiki-nftables/index.php/Netfilter_hooks




More information about the pve-devel mailing list