Kristoffer Dalby
220e9eec6a
state, change: notify clients only of effective node changes
...
Send endpoint and DERP reports only to peers. Suppress redundant online,
policy, and key updates on reconnect or unchanged-key login.
2026-11-02 17:46:54 +00:00
Kristoffer Dalby
f5fb3ca196
policy/v2, mapper: align NextDNS warnings and device metadata
...
Warn about malformed attributes once at policy load, not on each map.
Include the node's stable ID as device_id in resolver queries.
2026-11-02 17:46:54 +00:00
Kristoffer Dalby
0fa4b93b09
mapper: test that a hidden peer's policy change still sends filters
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
077dd5b11d
state, change: send a deleted node's removal only to its peers
...
The removal went to every node, also those the policy hid the node from.
The delete now returns the node's peers from the snapshot it replaces.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
5ecc365050
mapper: stop an older initial map removing peers newer streams hold
...
AddNode diffed its map against tracking after sending it, when a newer
stream may have recorded its own; it now sends the node a full instead.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
78b807ac44
mapper: bound how long one node can block a batcher worker
...
A node that drained slower than it was sent to held the worker for its
whole bundle; once its sends have waited 50ms, the rest waits a tick.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
ca5fc62312
mapper: bound concurrent streams and wait for their initial maps
...
The fifth stream replaces the oldest. Retry changes while any stream
awaits its initial map so ready streams cannot consume another's update.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
3ede93947a
change: coalesce policy recomputes that carry an origin node
...
The recompute render ignores the origin and always carries the node's
own entry, so a burst of tag writes cost every node one per write.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
3bd17903e0
state: say a taken name is already taken
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
c23a6efa73
db: succeed on a repeated revoke of an auth key
...
A repeated v2 DELETE of an auth key now answers 200, as Tailscale does.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
61107c0c4f
auth: answer a logout that deletes an ephemeral node as authorised
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
6b07f3c17a
cli: show a node's own ephemeral flag instead of its key's
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
84b0d0966c
gen/client/v1: regenerate for the node ephemeral flag
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
bccfb46ab1
db, state: keep the ephemeral flag a node was created with
...
The flag moves from the key to the node, so a login with another key no
longer changes it. A user claiming a tagged node still clears it. v1
nodes carry the flag.
Fixes #3640
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
5827e4b73c
db, types: add a nodes column for the ephemeral flag
...
The migration fills it from the key each node references.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
95efb8cef1
state: assign and persist unique node names in the NodeStore
...
Reserve extra DNS names, fit collision suffixes within 63 bytes, and repair
duplicate startup names in memory. Persist registration names without
losing a created node on rename failure; remove unused DB renaming.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
77874782ca
db, api/v1: revoke rather than delete an ephemeral pre-auth key in use
...
The v1 list now hides revoked keys, so keys revoked through v2 also drop
out of `headscale preauthkeys list`.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
c7b9b15c90
hscontrol: track ephemeral cleanup from registration to ownership changes
...
Arm cleanup at pre-auth registration, even if later work fails or the node
never connects. Skip deletion when the node is no longer ephemeral.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
8d3f800725
db: wrap the sequential IP allocator so freed addresses are reused
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
598b4c53c3
state: test that a persist racing a delete cannot resurrect the node
...
DeleteNode's early persistMu unlock is safe only while node persists
stay UPDATE-only; say so where the lock is declared.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
ab11fcbf32
hscontrol: bound client-chosen text in request logs
...
Clip at the sinks: handler errors, the request line, SSH local_user.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
9531124eea
mapper: show an expired peer online, without endpoints or DERP
...
A connected expired node shows online to its peers. Neither its map
entry nor endpoint, DERP or disco patches carry the paths to reach it.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
b65d4ac185
mapper: trim the Hostinfo sent to peers and to the node itself
...
As on Tailscale SaaS, the node's own entry keeps Hostname, RequestTags,
RoutableIPs and Services; peers get Hostname, OS, Services without
peerapi-dns-proxy, SSH host keys and AppConnector, and resend on those.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
360b8acfd2
mapper: keep an expired node authorised in its own entry
...
Tailscale SaaS sends an expired node MachineAuthorized and no Expired
flag; its past KeyExpiry already moves the client to NeedsLogin.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
433e96af96
.github: regenerate integration test workflow
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
bec665726c
state: apply requested tags on a key login that owns them
...
A requested tag the key's user owns directly, or the key's tags own one
hop away, replaces the key's tags instead of refusing the login.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
e878b081c6
state: maintain auto-approvals across route and tag changes
...
Withdrawal removes approvals granted only by policy; manual and migrated
approvals remain. Recheck routes after policy learns an administrator's
new tags.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
644c88b1e6
db, types: add a column for auto-approved routes
...
It starts empty: the current policy cannot tell which earlier approvals
were automatic, so all of them stay as an admin's.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
725aa0aeeb
state: auto-approve on registration only when the node key rotates
...
Registration runs the approval itself, once the policy manager knows the
node's owner, for a new node key or a change to the announced routes.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
3480d6fa0f
auth, state: preserve client expiry and require expired node key rotation
...
Return NodeKeyExpired for same-key login so the client rotates its key;
the machine stays authorized. Store earlier client expiry and expire
tagged nodes at logout.
2026-11-02 17:46:53 +00:00
Kristoffer Dalby
ab4596f40a
state: invalidate SSH check approvals on owner changes and expiry
...
Honor approval only while its source keeps the same owner and is live.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
343680c092
state: let a pre-auth key that is no longer valid only wake its node
...
A login that keeps its node key leaves a live node's expiry alone, even
with a valid key, and a wake-up is not refused for the tags it requests.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
4f7c8ec32a
state: serialise registrations presenting an unused single-use key
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
1449fa9f84
state: auto-approve routes in the NodeStore writer, not on reload
...
Registration approval runs on the node the writer replaces. A policy
reload approves nothing, and a map request only when its announced
routes change, so neither re-grants a route an admin revoked.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
67bdb685d8
state: persist current NodeStore rows and roll back only failed writes
...
Read current NodeStore rows under persistMu. Roll back only fields still
matching the failed registration, preserving concurrent node changes.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
cee821f349
state: apply map requests only under the node key that authorised them
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
0e1140c710
policy: offer exit routes only to viewers whose rules reach the internet
...
Every destination overlaps /0, so any rule offered a peer's exit routes.
They now need a rule to the internet, the test exit-node visibility
uses; via steering defers them to a regular grant only on that test.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
e0c9ff425e
mapper: send a router all of its own routes
...
Its AllowedIPs held only the primaries the policy let it reach. It now
holds every approved route, and PrimaryRoutes the ones it serves.
Fixes #3626
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
a49f9122f7
policy: reduce merged destination prefixes to the node's own addresses
...
Adjacent node addresses merge into one prefix, and each node's filter
kept all of it. A prefix made only of node addresses now shrinks to the
node's own; a prefix the policy wrote, or one the node routes, stays.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
8c3b615bda
api, policy/v2: refuse route prefixes with host bits
...
Routes are matched as written, so such a prefix never equals the one a
client announces. The approval APIs answer 400 and autoApprovers refuses
it at load and write, with Tailscale's text.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
fc8a12c950
policy, state: log only the routes auto-approval adds
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
048fcefbdb
poll: hold the map session's node as a view
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
691d9d6b1e
policy/matcher: compare cached policy and node route ranges
...
Binary-search immutable policy ranges and normalize node routes once.
Large misses and self/via scans improve; small or early matches can slow,
and global policies pay extra normalization and allocation costs.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
e72476f0ae
policy: look up approved routes in a set when auto-approving
...
Avoid scanning the growing approval list for every announcement.
Use the sorted current routes when identifying additions.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
1ea702cdbe
types, state: derive and reduce approved routes once
...
Derive subnet and exit routes together, once each in announcement order.
Reuse matcher membership while preserving HA co-router visibility.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
5fd173178f
state, policy/v2: classify only effective route changes
...
Compare announced-and-approved routes only when immutable route inputs
change. Publish Hostinfo without unnecessary peer adjacency rebuilds.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
edbb1fe9b6
policy/v2, state: elect primaries by oldest control session
...
A router that reconnects joins as a standby; one that kept its session
takes its routes back once available again, as on Tailscale. Both the
global and the via election use it, in place of anti-flap stickiness.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
7e5aa85601
types: add when a node's run of control sessions began
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
de8a0cc7eb
state, policy/v2: elect available routers and retain unavailable routes
...
Recompute via elections on health changes and check online state and expiry.
With no available router, retain the previous primary or lowest-ID approver;
exclude routers the prober marked unreachable.
2026-11-02 17:46:52 +00:00
Kristoffer Dalby
1c94588bf9
state: keep HA health probes active without delaying unrelated routers
...
Probe lone unhealthy advertisers. Defer results only for routers whose
routes tie them to a router still awaiting its probe.
2026-11-02 17:46:51 +00:00