[PR #2408] Add permissive legacy routing rules if the management server is outdated #19474

Open
opened 2026-08-05 05:06:04 -04:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/2408

State: closed
Merged: Yes


Describe your changes

  • Add legacy routing rules if the mgmt server is outdated and clear them up if the client reconnects to the updated mgmt server. This restores pre-route-ACL behavior

  • Replace permissive outbound forward rules with established ones. This allows us to respect a configured policy drop on the forward chain while maintaining permitting return traffic for the permissive inbound rule.
    The route ACLs on routing peers enforce the inbound rule and are empty on pure routing clients (which results in a drop).

  • Add an established rule to INPUT (and OUTPUT for consistency) to allow return traffic of routing client outbound traffic towards network routes on routing peers

  • Remove obsolete iif/oof interface in inner input/output rules

  • Remove NAT early exit on lo and instead restrict with iif/oif

Example nftables output

table ip filter {
        chain FORWARD {
                type filter hook forward priority filter; policy accept;
                oifname "wt0" ct state established,related counter packets 0 bytes 0 accept
                iifname "wt0" counter packets 0 bytes 0 accept
        }
}
table ip netbird {
        chain netbird-rt-fwd {
                ct state established,related accept
                ip saddr 100.64.209.41 ip daddr 20.0.0.0/24 meta l4proto icmp counter packets 1 bytes 84 accept
        }

        chain netbird-rt-nat {
                type nat hook postrouting priority srcnat - 1; policy accept;
                iifname "wt0" ip daddr 20.0.0.0/24 counter packets 1 bytes 84 masquerade
                oifname "wt0" ip saddr 20.0.0.0/24 counter packets 2 bytes 168 masquerade
        }

        chain netbird-acl-input-rules {
                ct state established,related accept
                iifname "wt0" tcp dport 80 accept
        }

        chain netbird-acl-output-rules {
                ct state established,related accept
                oifname "wt0" tcp sport 80 accept
        }

        chain netbird-acl-input-filter {
                type filter hook input priority filter; policy accept;
                iifname "wt0" jump netbird-acl-input-rules
                iifname "wt0" drop
        }

        chain netbird-acl-output-filter {
                type filter hook output priority filter; policy accept;
                oifname "wt0" ip daddr != 100.64.0.0/16 accept
                oifname "wt0" jump netbird-acl-output-rules
                oifname "wt0" drop
        }

        chain netbird-acl-forward-filter {
                type filter hook forward priority filter; policy accept;
                iifname "wt0" jump netbird-rt-fwd
                iifname "wt0" drop
        }
}

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/2408 **State:** closed **Merged:** Yes --- ## Describe your changes - Add legacy routing rules if the mgmt server is outdated and clear them up if the client reconnects to the updated mgmt server. This restores pre-route-ACL behavior - Replace permissive outbound forward rules with `established` ones. This allows us to respect a configured policy `drop` on the forward chain while maintaining permitting return traffic for the permissive inbound rule. The route ACLs on routing peers enforce the inbound rule and are empty on pure routing clients (which results in a drop). - Add an `established` rule to `INPUT` (and `OUTPUT` for consistency) to allow return traffic of routing client outbound traffic towards network routes on routing peers - Remove obsolete iif/oof interface in inner input/output rules - Remove NAT early exit on `lo` and instead restrict with iif/oif Example nftables output ``` table ip filter { chain FORWARD { type filter hook forward priority filter; policy accept; oifname "wt0" ct state established,related counter packets 0 bytes 0 accept iifname "wt0" counter packets 0 bytes 0 accept } } table ip netbird { chain netbird-rt-fwd { ct state established,related accept ip saddr 100.64.209.41 ip daddr 20.0.0.0/24 meta l4proto icmp counter packets 1 bytes 84 accept } chain netbird-rt-nat { type nat hook postrouting priority srcnat - 1; policy accept; iifname "wt0" ip daddr 20.0.0.0/24 counter packets 1 bytes 84 masquerade oifname "wt0" ip saddr 20.0.0.0/24 counter packets 2 bytes 168 masquerade } chain netbird-acl-input-rules { ct state established,related accept iifname "wt0" tcp dport 80 accept } chain netbird-acl-output-rules { ct state established,related accept oifname "wt0" tcp sport 80 accept } chain netbird-acl-input-filter { type filter hook input priority filter; policy accept; iifname "wt0" jump netbird-acl-input-rules iifname "wt0" drop } chain netbird-acl-output-filter { type filter hook output priority filter; policy accept; oifname "wt0" ip daddr != 100.64.0.0/16 accept oifname "wt0" jump netbird-acl-output-rules oifname "wt0" drop } chain netbird-acl-forward-filter { type filter hook forward priority filter; policy accept; iifname "wt0" jump netbird-rt-fwd iifname "wt0" drop } } ``` ## Issue ticket number and link ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary
saavagebueno added the pull-request label 2026-08-05 05:06:04 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#19474