mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-26 03:26:26 -08:00
Three pieces, intentionally landed together because the join->set lock
contract is what makes blueprint-bound nodes safe:
- ipn.Prefs grows a BlueprintID field plus a MaskedPrefs.BlueprintIDSet
mask bit. A node brought up via "tailscale join" carries BlueprintID
for the lifetime of the binding; "tailscale leave" clears it.
Prefs.IsBlueprintBound is a one-line read for callers that just
need the bit.
- cmd/tailscale/cli adds the "join" and "leave" subcommands. join
accepts --blueprint=bp:<id> and --auth-key=<oauth-secret>; under
the hood it reuses the existing HookResolveAuthKey exchange path
(OAuth client secret -> auth key) and then calls Start with a
Prefs whose BlueprintID is set. leave clears BlueprintID and
logs the node out, matching the spec's "ephemeral when bound"
semantics.
- cmd/tailscale/cli/blueprint_lock.go enforces the spec's
locked-field rejection on "tailscale set" for any blueprint-bound
node. The error message is the verbatim spec text, varying only
by which field was touched (Routes, Advertised tags, SSH, etc).
Inserted in runSet right after curPrefs is fetched so it fires
before any local validation work.
Client metrics (clientmetric) cover the v1 join/leave/set-rejected
counters and the blueprint_bound gauge so we can answer "is anyone
using this" without server-side correlation.
Updates #cleanup
Signed-off-by: Kabir Sikand <[email protected]>