Skip to main content

Module lan_firewall_rules

Module lan_firewall_rules 

Source
Expand description

The Windows Firewall rules that let LAN peers reach AgentMux, and what to change to get from the rules a machine has to those rules (docs/specs/SPEC_LAN_FIREWALL_SETUP_2026_10_01.md 4.1). Pure: it reads and writes nothing. The elevated helper in the launcher reads the machine’s rules into Existing, asks plan what to do and applies the answer; running it twice changes nothing the second time.

Structs§

Existing
A rule the machine already has, as far as the plan needs to know it.
Spec
One rule to create.

Enums§

Mode
What the helper is asked to do.
Op
One change, in the order to make it.
Settled
How a run ended, once it has looked at the machine again.

Constants§

CONFIGURE_FLAG
The flag that starts the helper (agentmux.exe --configure-lan-firewall): the launcher answers it, and the server runs it when the person asks for the setup.
EXIT_CANCELLED
The administrator answered no to Windows’ prompt (ERROR_CANCELLED).
EXIT_FAILED
Anything else; the reason is on stderr.
EXIT_MANAGED
A policy decides the firewall’s rules: local rules are ignored, so nothing the helper does can help.
EXIT_OK
The helper’s exit codes, which is how it says how it went. The rules are as asked, or were already.
EXIT_UNVERIFIED
The rules are as asked, but some of the firewall’s rules could not be read, so it cannot be said that none of them blocks AgentMux (or, when removing, is one of ours). Not a success: the count is on stderr.
PROFILES_PRIVATE_DOMAIN
NET_FW_PROFILE2_DOMAIN | NET_FW_PROFILE2_PRIVATE. Public is never in these rules: a Public network is the person’s decision, one network at a time (spec 4.4).
PROTO_TCP
IANA protocol numbers, which is how the firewall stores them.
PROTO_UDP
REMOTE_LOCAL_SUBNET
What the firewall calls “my own subnet”.
SPECS
The two port rules, in the order they are created.
TCP_PORTS
lan::ports::LAN_PORT_RANGE as the firewall spells a range.
TCP_RULE_NAME
The inbound TCP rule: the fixed block LAN listeners and the viewer take their ports from.
UDP_PORTS
mDNS (5353), the desktop discovery port (29700) and the mobile responder (47891).
UDP_RULE_NAME
The inbound UDP rule: mDNS, the desktop peer discovery and the mobile broadcast responder.

Functions§

is_agentmux_program
Whether a rule path is one of our own binaries: agentmux.exe, agentmux-srv-<version>-....exe, and so on.
plan
What to change so that existing is what mode asks for. Empty when nothing needs changing, which is how the helper knows to ask for no elevation.
settled
What a run came to: left is the plan made from the machine as it is now, unreadable the rules that could not be read.