Commit Graph
4927 Commits
Author SHA1 Message Date
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
Kristoffer Dalby 7343a7d0fc state: drop auto-approved routes when they are withdrawn
Only routes auto-approval alone granted go; approvals from before the
upgrade stay, as do routes an admin set.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 664d3477f0 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-10-28 07:15:54 +00:00
Kristoffer Dalby e8d45606a0 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-10-28 07:15:54 +00:00
Kristoffer Dalby 6e3de18b5c auth: store a client's earlier expiry and expire a tagged node at logout
A client may bring its expiry forward, which turns expiry on for a node
without one, but still cannot push it back. Logout expires tagged nodes
too.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby 588a2f934c auth, state: answer an expired node's same-key login with NodeKeyExpired
The client then rotates its node key and logs in again, so no key is
judged under the expired one. The machine stays authorised.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby b70ba23086 state: forget a node's SSH check approvals when it is expired 2026-10-28 07:15:54 +00:00
Kristoffer Dalby a02a4e6c2e state: honour SSH check approvals only while the source keeps its owner 2026-10-28 07:15:54 +00:00
Kristoffer Dalby ed0dd703f9 .github: regenerate integration test workflow 2026-10-28 07:15:54 +00:00
Kristoffer Dalby 1c17be4dd8 state: give another user's key on a tagged machine a new device
Only a key that speaks for a tagged node re-authenticates it: a tagged
key, or one of the user it was tagged from, which takes it back with a
new node key. Another user's key or login adds that user's own device.
2026-10-28 07:15:54 +00:00
Kristoffer Dalby c48767eed6 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-10-28 00:52:20 +00:00
Kristoffer Dalby 6c42055047 state: need a valid pre-auth key to re-register an expired tagged node 2026-10-28 00:52:20 +00:00
Kristoffer Dalby fd8b0e0a5c state: serialise registrations presenting an unused single-use key 2026-10-28 00:52:20 +00:00
Kristoffer Dalby 54e2474146 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-10-28 00:52:20 +00:00
Kristoffer Dalby 2205b30d9c state: undo a failed re-registration without reverting newer writes 2026-10-28 00:52:20 +00:00
Kristoffer Dalby 88b340afe7 state: write node rows from the NodeStore under persistMu 2026-10-28 00:51:40 +00:00