macOS: run the launchd daemon as root so it can reach the LAN

On macOS 15, Local Network privacy blocks LAN connections from a launchd
daemon running as a user (EHOSTUNREACH; curl works), and a daemon can't show
the permission prompt. Tested on 15.3.1 with the probe's own Python: a root
daemon connects to the hub, the same daemon with UserName gets "No route to
host". The plist no longer sets UserName. The checkout, venv and
<name>-update stay owned by the installing user.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 20:15:43 -08:00
parent 30ce39d5f0
commit 380243545c
4 changed files with 17 additions and 4 deletions

View file

@ -150,3 +150,11 @@ def test_explicit_port_wins_over_lan_default(tmp_path):
pick = 'CALLER_MODE=; choose_mode; if [ "$ROLE" = hub ] && [ -z "$CALLER_PORT" ] && uses_lan_name; then HOST_PORT=80; fi; echo "$MODE $HOST_PORT"'
assert bash(base + 'CALLER_PORT=; HOST_PORT=8000; ' + pick, INSTALLER="install.sh").stdout.strip() == "native 80"
assert bash(base + 'CALLER_PORT=9000; HOST_PORT=9000; ' + pick, INSTALLER="install.sh").stdout.strip() == "native 9000"
def test_macos_daemon_runs_as_root():
"""macOS 15 Local Network privacy blocks LAN connections from a launchd daemon that runs
as a user; root daemons are exempt. The plist must not set UserName."""
setup = (ROOT / "native" / "setup.sh").read_text()
plist = setup[setup.index("<plist"):setup.index("</plist>")]
assert "<key>UserName</key>" not in plist