headscale: an allow-all ACL policy with tag:server and route auto-approval #2

Merged
thodkatz merged 3 commits from change/headscale-acl into main 2026-11-04 21:14:13 +00:00
Owner

Plan (change mode)

Why. headscale runs with no ACL policy, so every (re)installed host's microVM-bridge route has to be approved
by hand (headscale nodes approve-routes, nixed's docs/guides/host-operations.md, ThinkCentre install step 4).
An ACL policy with autoApprovers removes that step.

What changes.

  • headscale/config/acl.hujson (new): one allow-all acls rule (any policy denies by default, so this keeps the
    tailnet exactly as open as it is now), tag:server owned by thodkatz@, and autoApprovers.routes for
    192.168.122.0/24 (nixos) and 192.168.123.0/24 (thinkcentre), from tag:server only.
  • headscale/config/config.yaml: policy.path: /etc/headscale/acl.hujson (the compose file mounts
    /srv/selfhosted/headscale/config there).
  • docs/guides/network-and-caddy.md: The ACL policy: what it does, how a host gets tagged, how to check an edit.
  • docs/knowledge/headscale-autoapprove-tag-later.md (+ index line): tagging a node after registration doesn't
    auto-approve its route.

Check. Run here against headscale/headscale:0.27.1 (the compose pin) and tailscale/tailscale containers on a
throwaway docker network:

  • headscale policy check --file acl.hujson passes; it rejects an undefined tag and an owner without @;
  • a node registered with a --tags tag:server pre-auth key gets 192.168.122.0/24 approved on advertise; an
    untagged node's route stays under Available;
  • routes approved before the policy existed survive a restart with it and stay in peers' netmaps;
  • the repo's Setup check (Caddyfiles) still passes.

Deploy (the user, on the VPS)

Nothing changes until then. Existing routes stay approved, so nothing is cut off.

cd /srv/selfhosted && git pull            # or copy headscale/config/{acl.hujson,config.yaml} into place
docker exec headscale headscale policy check --file /etc/headscale/acl.hujson   # BEFORE restarting: headscale won't start with an invalid policy
docker compose -f headscale/docker-compose.yaml up -d --force-recreate headscale
docker exec headscale headscale nodes list-routes   # both bridges still Approved

After that, a new host registers with headscale preauthkeys create --user <ID> --tags tag:server (the hosts'
user thodkatz is ID 2); nixed's host-operations.md gets that rewrite as a follow-up direct change once this is
deployed.

🤖 Generated with Claude Code

## Plan (change mode) **Why.** headscale runs with no ACL policy, so every (re)installed host's microVM-bridge route has to be approved by hand (`headscale nodes approve-routes`, nixed's `docs/guides/host-operations.md`, ThinkCentre install step 4). An ACL policy with `autoApprovers` removes that step. **What changes.** - `headscale/config/acl.hujson` (new): one allow-all `acls` rule (any policy denies by default, so this keeps the tailnet exactly as open as it is now), `tag:server` owned by `thodkatz@`, and `autoApprovers.routes` for `192.168.122.0/24` (nixos) and `192.168.123.0/24` (thinkcentre), from `tag:server` only. - `headscale/config/config.yaml`: `policy.path: /etc/headscale/acl.hujson` (the compose file mounts `/srv/selfhosted/headscale/config` there). - `docs/guides/network-and-caddy.md`: *The ACL policy*: what it does, how a host gets tagged, how to check an edit. - `docs/knowledge/headscale-autoapprove-tag-later.md` (+ index line): tagging a node after registration doesn't auto-approve its route. **Check.** Run here against `headscale/headscale:0.27.1` (the compose pin) and `tailscale/tailscale` containers on a throwaway docker network: - `headscale policy check --file acl.hujson` passes; it rejects an undefined tag and an owner without `@`; - a node registered with a `--tags tag:server` pre-auth key gets `192.168.122.0/24` approved on advertise; an untagged node's route stays under *Available*; - routes approved before the policy existed survive a restart with it and stay in peers' netmaps; - the repo's *Setup* check (Caddyfiles) still passes. ## Deploy (the user, on the VPS) Nothing changes until then. Existing routes stay approved, so nothing is cut off. ```bash cd /srv/selfhosted && git pull # or copy headscale/config/{acl.hujson,config.yaml} into place docker exec headscale headscale policy check --file /etc/headscale/acl.hujson # BEFORE restarting: headscale won't start with an invalid policy docker compose -f headscale/docker-compose.yaml up -d --force-recreate headscale docker exec headscale headscale nodes list-routes # both bridges still Approved ``` After that, a new host registers with `headscale preauthkeys create --user <ID> --tags tag:server` (the hosts' user `thodkatz` is ID 2); nixed's `host-operations.md` gets that rewrite as a follow-up direct change once this is deployed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Signed-off-by: theo <thodkatz@pm.me>
Until now headscale ran with no policy, so every new host's subnet route was
approved by hand (nixed's host-operations.md, ThinkCentre install step 4).
The policy keeps the tailnet exactly as open (any policy denies by default,
so its one rule is allow-all), owns tag:server by thodkatz@, and auto-
approves the two microVM bridges only from a tag:server node.

Tested against headscale 0.27.1 here, on a throwaway docker network with
tailscale clients: policy check passes (and rejects an undefined tag and an
owner without @); a node registered with a --tags tag:server key gets its
route approved on advertise; an untagged one doesn't; routes approved before
the policy survive a restart with it and stay in peers' netmaps. Tagging an
already-registered node does not auto-approve: knowledge note.

Needs the user on the VPS: deploy headscale/ and restart headscale.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: theo <thodkatz@pm.me>
thodkatz changed title from WIP: headscale: an allow-all ACL policy with tag:server and route auto-approval to headscale: an allow-all ACL policy with tag:server and route auto-approval 2026-11-04 21:12:38 +00:00
The redeploy trap named only config.yaml; acl.hujson needs the same redeploy.
policy check accepts an owner that isn't a headscale user, which would silently
stop auto-approval, so the guide says so and how to confirm. The knowledge
note's second gotcha (empty Serving column after a restart) is now in its
title and index line, so a grep finds it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: theo <thodkatz@pm.me>
Author
Owner

Local review (correctness + methodology subagents)

  1. (low, methodology) AGENTS.md trap and the guide named only config.yaml as needing a VPS redeploy; acl.hujson does too.
  2. (low, methodology) The knowledge note's Also seen (empty Serving (Primary) after a restart) wasn't in its title or index line, so a grep wouldn't find it.
  3. (low, correctness) headscale policy check doesn't verify that owner users exist: nosuchuser@ passes, which would silently stop auto-approval.
  4. (low, correctness) The knowledge note's claims couldn't be cheaply reproduced by the reviewer; flag only if the test isn't recorded.

Also checked, no issue: the policy validates on 0.27.1; policy.path matches the directory mount; the old container sees the pulled file (directory bind mount), so the pre-restart check works; -f headscale/docker-compose.yaml resolves .env and the project name as a deploy from inside headscale/; the CLI flags exist; no stale docs elsewhere; sign-off check clean.

Replies

  1. Fixed in 54021ea: both texts now say headscale/config/ (config.yaml, acl.hujson).
  2. Fixed in 54021ea: title and index line widened.
  3. Fixed in 54021ea: the guide says the check doesn't cover user names and to confirm with headscale users list.
  4. No change: c8a2b42's commit message records the container test that found both claims.

Checks: Caddyfile validate loop (AGENTS.md Setup): exit 0; headscale policy check --file acl.hujson: exit 0; python3 .methodology/shared/sync-agents.py --check: exit 0

## Local review (correctness + methodology subagents) 1. (low, methodology) `AGENTS.md` trap and the guide named only `config.yaml` as needing a VPS redeploy; `acl.hujson` does too. 2. (low, methodology) The knowledge note's *Also seen* (empty *Serving (Primary)* after a restart) wasn't in its title or index line, so a grep wouldn't find it. 3. (low, correctness) `headscale policy check` doesn't verify that owner users exist: `nosuchuser@` passes, which would silently stop auto-approval. 4. (low, correctness) The knowledge note's claims couldn't be cheaply reproduced by the reviewer; flag only if the test isn't recorded. Also checked, no issue: the policy validates on 0.27.1; `policy.path` matches the directory mount; the old container sees the pulled file (directory bind mount), so the pre-restart check works; `-f headscale/docker-compose.yaml` resolves `.env` and the project name as a deploy from inside `headscale/`; the CLI flags exist; no stale docs elsewhere; sign-off check clean. ## Replies 1. Fixed in 54021ea: both texts now say `headscale/config/` (`config.yaml`, `acl.hujson`). 2. Fixed in 54021ea: title and index line widened. 3. Fixed in 54021ea: the guide says the check doesn't cover user names and to confirm with `headscale users list`. 4. No change: c8a2b42's commit message records the container test that found both claims. Checks: Caddyfile validate loop (AGENTS.md *Setup*): exit 0; `headscale policy check --file acl.hujson`: exit 0; `python3 .methodology/shared/sync-agents.py --check`: exit 0
thodkatz deleted branch change/headscale-acl 2026-11-04 21:14:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thodkatz/selfhosted!2
No description provided.