Login
You're viewing the code4lib.social public feed.
  • Sep 24, 2026, 7:50 PM

    Consider two OpenBSD PF configurations:

    pf1.conf, where SSH blocked by default, but internal LAN traffic is allowed:

    block in on em0 proto tcp to port 22
    pass in quick on em0 proto tcp from 192.168.0.0/16 to any

    and updated pf2.conf, where someone added quick to the blocking rule "for safety's sake":

    block in quick on em0 proto tcp to port 22
    pass in quick on em0 proto tcp from 192.168.0.0/16 to any

    quick was added to a broad block rule, silently shadowing the subsequent quick pass rule. Both are quick rules, both are present, and the change consists of just one word. A reviewer might reason: "The pass rule still has quick, so LAN traffic should still go through." However, among quick rules, the "first-match-wins" principle applies, not "last-match-wins": the block in quick rule now matches LAN traffic before the quick pass rule and shadows it. "Last-match-wins" only applies to non-quick rules. Visually, nothing appears broken, yet the behavior has changed.

    And proofwall detect this:

    $ ./proofwall diff -n 2 pf1.conf pf2.conf
    DIFFERENT: rulesets are NOT semantically equivalent. Regressions (2): pass in A, block in B:
    - 192.168.0.0:0 -> 0.0.0.0:22 proto=tcp flags=0x00 iface="em0" dir=in
    - 192.168.0.0:0 -> 0.0.0.0:22 proto=tcp flags=0xff iface="em0" dir=in

    Rule issues (1):
    [B] line 2: redundant rule (removing it changes nothing): pass in quick on em0 proto tcp from 192.168.0.0/16 to any

    This is interpreted as follows: a regression specifically for 192.168.0.0/16 -> tcp/22 (traffic that previously passed is now blocked), while the pass ... quick rule in the second config has become redundant - its effect is completely overridden by an earlier block quick rule.

    💬 0🔄 0⭐ 0