Skip to main content

Module lan_firewall

Module lan_firewall 

Source
Expand description

agentmux.exe --configure-lan-firewall and --remove-lan-firewall: the one elevated step that lets other computers reach AgentMux on Windows (docs/specs/SPEC_LAN_FIREWALL_SETUP_2026_10_01.md 4.1).

Started by a person’s first LAN enable, the installer’s “Allow LAN access” task and the uninstaller. It reads the firewall without elevation, and asks Windows for administrator permission only when something has to change, so a machine that is already set up sees no prompt. What the rules are, and what to change to reach them, is agentmux_common::lan_firewall_rules; this module reads the machine, applies the plan and says how it went in its exit code.

Constants§

CONFIGURE_FLAG
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. 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.
ELEVATED_FLAG
Given to the copy this one starts with administrator permission, so that copy never asks again.
EXIT_CANCELLED
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. The administrator answered no to Windows’ prompt (ERROR_CANCELLED).
EXIT_FAILED
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. Anything else; the reason is on stderr.
EXIT_MANAGED
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. A policy decides the firewall’s rules: local rules are ignored, so nothing the helper does can help.
EXIT_OK
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. The helper’s exit codes, which is how it says how it went. The rules are as asked, or were already.
EXIT_UNVERIFIED
The flag, and the exit codes the helper says how it went with, are shared with the server, which runs the helper when the person asks for the setup. 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.
REMOVE_FLAG
Remove the two port rules (the uninstaller).

Functions§

requested_mode 🔒
The mode the arguments ask for, if either flag is there. Configure wins when both are.
run 🔒
run_if_requested
Run the helper when args ask for it, and give its exit code. None when they do not.