Commit Graph
4942 Commits
Author SHA1 Message Date
Kristoffer Dalby b86f0042bb types: drop a stored OIDC email the login no longer vouches for 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 2075fc8838 state: write every user column in UpdateUser 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 372d3ba6d9 oidc: refuse logins whose subject the provider identifier would alter 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 04a15d59e1 oidc: keep email_verified with the address it came with 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 1dbcf982c8 state: announce a node online only after it was offline
A stream back within the reconnect grace sent peers an online patch,
a router's sent every node a policy response, and a relogin on
unchanged keys sent a key patch; nothing had changed.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby b394cc16b8 change: do not echo a node's own report back to it
An endpoint or DERP report came back to the node as a self update;
SaaS sends it to the node's peers only.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby 491951533f mapper: add device_id to the NextDNS query
SaaS sends the node's stable ID with the other device metadata.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby 2b45a32248 policy/v2: warn once at load about malformed nextdns attrs
SaaS loads them and its resolver skips them, as headscale does, but the
mapper also logged a warning per node on every DNS build.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby 39ab36a2f8 mapper: test that a hidden peer's policy change still sends filters 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 3f30945056 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-10-28 07:15:55 +00:00
Kristoffer Dalby e5055eb34b 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-10-28 07:15:55 +00:00
Kristoffer Dalby 77017327fa 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-10-28 07:15:55 +00:00
Kristoffer Dalby feeece29ae mapper: send nothing while any stream awaits its initial map
Sent to the ready streams alone, a change counted as delivered and
never reached the new stream; the worker retries it once the map is out.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby b12f7dfdf4 mapper: cap concurrent map sessions per node
A node chose how many map streams it held, each pinning a session.
The fifth replaces the oldest; same shape as #3468's mapper commit.
2026-10-28 07:15:55 +00:00
Kristoffer Dalby ccf2250331 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-10-28 07:15:55 +00:00
Kristoffer Dalby 6a06960ece state: say a taken name is already taken 2026-10-28 07:15:55 +00:00
Kristoffer Dalby 1b810dea31 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-10-28 07:15:54 +00:00
Kristoffer Dalby 0a64d7a7bd auth: answer a logout that deletes an ephemeral node as authorised 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 8bae4d00c2 cli: show a node's own ephemeral flag instead of its key's 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 13a4de4d95 gen/client/v1: regenerate for the node ephemeral flag 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 5ddc442ec3 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.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby e747f01b49 db, types: add a nodes column for the ephemeral flag
The migration fills it from the key each node references.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 3b842dc8a9 db: remove unused RenameNode 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 3d85f5838f state: bump duplicate node names loaded from the database 2026-10-28 07:15:54 +00:00
Kristoffer Dalby fda89650da state: cut a label so its -N suffix fits in 63 bytes 2026-10-28 07:15:54 +00:00
Kristoffer Dalby df58b6d134 state: treat extra DNS record names as taken node names 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 784b8b1618 state: save the name NodeStore picks for a new node
The row is committed before the name UPDATE, so a failed UPDATE still
returns the node and registration arms ephemeral cleanup.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 01322ea9e0 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-10-28 07:15:54 +00:00
Kristoffer Dalby 1f462b53f6 hscontrol: arm the ephemeral GC at pre-auth key registration 2026-10-28 07:15:54 +00:00
Kristoffer Dalby f1d50a1968 hscontrol: skip garbage collecting a node that is no longer ephemeral 2026-10-28 07:15:54 +00:00
Kristoffer Dalby c4b1dc0134 db: wrap the sequential IP allocator so freed addresses are reused 2026-10-28 07:15:54 +00:00
Kristoffer Dalby a318083a84 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-10-28 07:15:54 +00:00
Kristoffer Dalby ca05853e43 db, state: let only the delete that removed a node free its addresses 2026-10-28 07:15:54 +00:00
Kristoffer Dalby e588cf8304 state: drop registration locks once unused
The lock is taken before any credential check, so client-chosen machine
keys grew the map forever. Ref-count entries; delete at zero.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 5219939170 types, auth, noise: let one request wait on each auth session
One verdict per session, so one waiter: the newest. A displaced one
returns at once (register error, SSH re-delegate), not at session end.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby eff6ad27be auth: check the follow-up's machine key before it waits
A session has one verdict; another machine holding the URL could take
it.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 5cfa805bbc noise: stop serving metrics inside the tunnel
Any machine key reached it, bypassing metrics_listen_addr. No client
asks for it.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby b08a5ce4d7 noise: time out stalled bodies and idle tunnels
The hijack drops the outer server's deadlines; any machine key gets a
tunnel.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 51385dd713 hscontrol: bound client-chosen text in request logs
Clip at the sinks: handler errors, the request line, SSH local_user.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 5aaa4e1d2b auth, state: keep announced routes out of pending registrations
Routes are the one long list; the first MapRequest reports them.
A relogin keeps the node's own routes until then.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby e4e2ea820b state: bound client reports of nodes loaded at startup
Rows stored before the bounds would still fan out unbounded endpoints.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby ebdb5c94fa types, noise: bound the Hostinfo and endpoints a client reports
Cut lists and hostname at decode, refuse >64 KiB of non-route Hostinfo.
The body limit counted wire bytes, not what the cache, NodeStore and
peers keep.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 89647cac2f 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-10-28 07:15:54 +00:00
Kristoffer Dalby 464dba33e1 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-10-28 07:15:54 +00:00
Kristoffer Dalby 833ff6b053 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-10-28 07:15:54 +00:00
Kristoffer Dalby cfd065c680 hscontrol: refuse a key expiry that cannot be encoded
handleRegister, the OIDC auth path and SetNodeExpiry refuse it. Expiries
are stored in UTC, which SQLite can read back, and loaded in UTC, as
PostgreSQL returns the server's zone. The v1 API answers 400.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby f192bf05b2 mapper: skip peers whose key expiry cannot be encoded
json.Marshal refuses a year outside [0,9999], so one stored expiry
failed every map with that node. TailNode and key patches send UTC, the
builder drops what fails and the boot scan names the node.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby ce5189dc55 .github: regenerate integration test workflow 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 9482a1c6c3 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-10-28 07:15:54 +00:00
Kristoffer Dalby 7e995b1ff9 state: auto-approve routes after an admin tag change
The new tags may approve announced routes. Approval runs once the policy
manager knows the new owner, as after a registration.
2026-10-28 07:15:54 +00:00