Kristoffer Dalby
14baf55421
state, oidc: persist user changes and refresh nodes and clients
...
Write cleared user columns, discard OIDC email the provider no longer
vouches for, refresh NodeStore users, and notify clients from the callback.
Fixes #3471
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
65a4f0d6fc
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 19:15:40 +01:00
Kristoffer Dalby
27bed8f612
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 19:15:40 +01:00
Kristoffer Dalby
f37c6a69bc
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 19:15:40 +01:00
Kristoffer Dalby
8073a2fbd0
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 19:15:40 +01:00
Kristoffer Dalby
e1f84dd214
auth: answer a logout that deletes an ephemeral node as authorised
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
e99ad44064
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 19:15:40 +01:00
Kristoffer Dalby
8b93e6a074
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 19:15:40 +01:00
Kristoffer Dalby
3038aa907a
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 19:15:40 +01:00
Kristoffer Dalby
99e8a9228a
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 19:15:40 +01:00
Kristoffer Dalby
162fa4ccc9
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 19:15:40 +01:00
Kristoffer Dalby
06a0dcd62d
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 19:15:40 +01:00
Kristoffer Dalby
6876bcfa7f
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 19:15:40 +01:00
Kristoffer Dalby
6fe62dec62
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 19:15:40 +01:00
Kristoffer Dalby
e84615049e
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 19:15:40 +01:00
Kristoffer Dalby
ba319ba8c4
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 19:15:40 +01:00
Kristoffer Dalby
b1ab98bde9
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 19:15:40 +01:00
Kristoffer Dalby
3e9195e4d6
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 19:15:40 +01:00
Kristoffer Dalby
256a67e86b
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 19:15:40 +01:00
Kristoffer Dalby
505eb1c1ed
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 19:15:40 +01:00
Kristoffer Dalby
1cd93ec432
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 19:15:40 +01:00
Kristoffer Dalby
6dd0656f17
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 19:15:40 +01:00
Kristoffer Dalby
0e7515eab9
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 19:15:40 +01:00
Kristoffer Dalby
4342883bd4
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 19:15:40 +01:00
Kristoffer Dalby
e0717bc116
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 19:15:40 +01:00
Kristoffer Dalby
25a01070e9
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 19:15:40 +01:00
Kristoffer Dalby
d4ce109806
policy/v2: refuse check SSH rules with tag sources
...
A check asks the source's user to log in again, and a tagged node has
none. Tailscale SaaS refuses the rule; headscale accepted it.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
79daa3142f
policy/v2: bound grant destination expansion
...
Require one port or range per grant IP entry. Reject more than 100,000
declared destination/port-range combinations on every parse.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
33b57fdeb2
policy/v2: need every dst node for a tests accept, no range sources
...
An accept passes only when each node behind the dst is reached, as on
Tailscale SaaS; a deny keeps its rule. A CIDR, "*" or autogroup:tagged
src names no user or host, so its test fails.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
cebe5fc903
policy/v2: validate SSH test sources and destinations like SaaS
...
Reject address-range sources and autogroup:member destinations.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
e6d04cd79a
policy/v2: map login 0 to no local user in SSH rules
...
Every rule that maps root now carries "0": "", as Tailscale SaaS writes
it, also when the policy lists "0".
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
361b5e6556
policy/v2: keep via steering bounded across route and user changes
...
Refresh clients when the last via grant disappears. Match each ACL once,
deduplicate routes, and elect once per route the peer actually serves.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
363ba7be44
hscontrol, servertest: add key list scope golden data
...
Read-only and key-making OAuth tokens of each tag set list auth keys
with and without all=true, over admin- and token-made keys of every tag
relation, one admin key made after the token-made ones.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
e8b44c653f
servertest: add user role dispatch golden data
...
An admin role change under autogroup:admin, mirrored as a user rename;
peers, filter and frames per node per step, and v2 device users.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
1318f2802f
servertest, state: add node name golden data
...
Labels under taken hostnames, case-only renames, hostname changes, long
hostnames and a Service's name; API, peer and self per step, and State
labels as a restart would load them.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
a34eb4f535
policy/v2, servertest: add policy generation golden data
...
One policy over joins, a via router swap, an admin tag, a delete and a
group edit; filter, SSH, peers and routes per step, and the manager
against a fresh one.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
349c4db600
servertest: add hidden peer and route announcement golden data
...
What a node hears of peers it cannot see, and what a router's peers hear
of routes it announces; presence, removals, peers and routes per step.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
20a1855147
servertest: count map frames per client
...
Counts ControlTime events, so frames that leave the netmap as it was,
or that a delta client applies in place, still show.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
b4217925c9
servertest: recapture map delivery golden data
...
The probe now bounds snapshot reads and keeps feature refusals as data.
SaaS now sends appc and sshd laptop's unchanged entry on the restore.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
d84c1927f9
servertest: wait for each replayed join before the next
...
Polls start in the background, so a later router could come online
first and keep the global primary SaaS gave the first.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
75040798e4
servertest: count deleted nodes in replayed peer views
...
Only nodes still in State resolved to an alias, so a client that kept
a deleted peer passed the peers and route owner checks.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
f4af5e0286
servertest: recapture via HA failover golden data
...
The probe now bounds its reads and stops when a step loses data.
Route owners and peers match the first capture at every step.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
c979d82c50
hscontrol, servertest: fail on any unread pending login or expiry entry
...
Each map serves one capture, so a misspelled capture name never went
stale.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
e4752f06c5
servertest: require a map on each stream an expiry replay opens
...
The cached netmap outlives a stream, so a refused re-poll passed.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
99af4aa8a5
servertest: compare filter and SSH rules in expiry replays
...
Changed-or-not alone let empty rules pass for SaaS's new ones.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
44c6810b10
servertest: recapture ephemeral, expiry and pending login golden data
...
The expiry file now holds the shared policy, DNS and observer setup.
Outcomes match the first capture; collection was seen one poll earlier.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
1d48f67534
servertest: judge ephemeral collection apart from the poll that saw it
...
Killed nodes are checked once at the last read, for devices left and
whether the observer lost them since the kill.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
bd5ae1e0fb
servertest: recapture v2 OAuth and policy API golden data
...
Tag writes are read back once the tags hold, and both files carry a
baseline snapshot. Statuses and read-backs match the first capture.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
a21d725853
servertest, policy/v2: replay tag owner chain joins through registration
...
A key login never asks the policy about requested tags, so the joins are
checked where headscale decides them. OAuth mints stay at
TagOwnedByTags.
2026-11-02 16:09:00 +01:00
Kristoffer Dalby
8e3270b180
servertest: recapture re-authentication golden data
...
The probe now stops a refused login's retries; the replay disconnects
there too. Outcomes match the first capture, and user IDs are labels.
2026-11-02 16:09:00 +01:00