Setup: Ubuntu 20.04, created a bridge "br0" with brctl, added three physical ports to it: enp10s0, enp7s0 and enp5s0.
The desire: enp5s0 and enp7s0 should be able to talk to each other on the bridge unimpeded (in the end, there will be more than these two, so I'm trying to keep the rules as simple as possible). enp10s0 is the "outside world" link and I want to whitelist what I let into the bridge, but only from that port. I have a blacklist working fine but whitelist is thwarting me.
flush ruleset
table bridge drawbridge {
chain input {
type filter hook input priority 0;
}
chain forward {
type filter hook forward priority 0;
iifname "enp10s0" tcp dport 3389 ct state new,established accept
iifname "enp10s0" drop
}
chain output {
type filter hook output priority 0;
}
}
This should (I thought) allow Windows remote desktop (tcp 3389) plugged in on enp10s0 to talk to any laptop on the bridge, but drop everything else. If I flush the ruleset, it's working, so the bridge works, the laptops are configured, but as soon as I apply the above rule, it stops working.
A blacklist of:
iifname "enp10s0" tcp dport 3389 drop
...worked fine. I can still ping it but I can't remote desktop. Doing icmp as a blacklist also works fine. I can remote desktop but I can't ping. So my nftables seems to be fine, just not as a whitelist.
(To eliminate "windows remote desktop" as an issue, I also tried the same thing with ping: whitelist iifname "enp10s0" icmp type echo-request accept and iifname "enp10s0" icmp type echo-reply accept with a iifname "enp10s0" drop , but that didn't work either. Works as a blacklist, though -- policy accept, and drop only those two icmp things. Works as expected there.)
How can I give "enp10s0" the whitelist treatment, but only "enp10s0"?