mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-25 19:21:18 -08:00
ensurePFAnchorRef reconstructs the main ruleset from "pfctl -sn" and "pfctl -sr" output and reloads it with "pfctl -f -". That output names any table a rule references but never prints its contents, so the reconstructed ruleset re-declares every table as empty. Reloading it silently drops the addresses of any table the operator populates out-of-band -- a "persist file" table, "pfctl -T add", pfctl's own automatic tables for interface groups -- and every rule referencing that table then matches nothing. That is a quiet, security-relevant failure: a ruleset whose "pass ... from <trusted>" rules still exist but match no addresses looks fine in "pfctl -sr". There is no way to insert an anchor reference into a running ruleset without a reload, so detect the case and refuse, pointing the operator at the durable fix (putting the anchor references in /etc/pf.conf, where they survive reboots and pf reloads anyway). Boxes that already have the anchor references configured are unaffected: ensurePFAnchorRef returns early before reaching this check. Updates #5573 Change-Id: I6efa9a63e1322af2ec8fd986a774ed76c5d5766e Signed-off-by: Martin Minkus <[email protected]>