Kristoffer Dalby
59ebffd64a
api: serve the running configuration
...
Updates #1926
2026-11-11 15:02:16 +01:00
Kristoffer Dalby
865c001068
types: give config values their own types
...
Updates #1926
2026-11-11 15:02:16 +01:00
Kristoffer Dalby
77491a5bd8
types: compute derived config values where they are used
...
Updates #1926
2026-11-11 15:02:16 +01:00
Kristoffer Dalby
cb4ccd97c2
types: reject unknown and removed config keys
...
Fixes #1926
2026-11-11 15:02:16 +01:00
Kristoffer Dalby
ac25916b5f
api/v2: register device update operations apart
...
registerDevices passed gocyclo's limit.
Updates #3629
2026-11-05 15:51:04 +01:00
Kristoffer Dalby
7af29e8c45
api/v2: add device update-status
...
updating from a started update until the node runs another version,
or for at most 10 minutes; else not-updating. Kept in memory.
Updates #3629
2026-11-05 15:51:04 +01:00
Kristoffer Dalby
8230c58a0c
api/v2: answer update-client as Tailscale does
...
No body, 200 {} once started, 404 "not found" for a device that
disallows updates, has no map stream, or refuses. c2n wait 10s.
Updates #3629
2026-11-05 15:51:04 +01:00
Kristoffer Dalby
e0c6839c11
api/v2: bound update-client request body
...
TestEveryRequestBodyIsBounded landed on main after the PR branched.
Updates #3629
2026-11-05 15:51:04 +01:00
Martín Gómez
c8e5aa6682
api/v2: add the device update-client endpoint
...
POST /api/v2/device/{id}/update-client asks a connected node to update
its Tailscale client through c2n POST /update, as the Tailscale admin
console does. The path is the console's undocumented one; the request
and response shapes are headscale's own.
2026-11-05 15:51:04 +01:00
Kristoffer Dalby
f32fc9f14a
api/v2: refuse expirySeconds outside 0 to 90 days
...
Matches SaaS status and text.
2026-11-05 12:41:50 +01:00
Kristoffer Dalby
f1382e4322
api/v2: accept an auth key create without tags
...
SaaS takes it; huma marked the field required (422).
2026-11-05 12:41:50 +01:00
Kristoffer Dalby
1a32d031bf
api/v1: report a pre-auth key without expiration as null
...
Zero time read as expired; API keys and 0.29 already emit null.
2026-11-05 12:41:50 +01:00
Seena Fallah
92bc0b6226
api/v1: persist omitted key expiration as NULL, not zero time
...
CreateAPIKey and CreatePreAuthKey declared a zero-valued time.Time and
passed its address to the state layer, so a request that omitted the
expiration persisted 0001-01-01 instead of NULL. Both key types were
then rejected as already-expired on first use. Pass the request body's
*time.Time straight through (nil when omitted).
Signed-off-by: Seena Fallah <seenafallah@gmail.com >
2026-11-05 12:41:50 +01:00
Kristoffer Dalby
5c28965515
api/v2: leave out empty posture expiries, as SaaS does
...
Drop test checks for otherKnownIPs, a field main never had.
Updates #2272
2026-11-05 12:38:53 +01:00
Greg Rodden
bae1d6fd84
api/v2: expose last control address as device attribute
2026-11-05 12:38:53 +01:00
Kristoffer Dalby
50a6823ffb
api/v2: serve policies and errors with SaaS's content types
...
A JSON read of a commented policy held comments, so JSON clients failed on
it. Errors say application/json, and a policy write answers as HuJSON.
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
73a2ca9377
api/v2: add POST /device/{id}/expire
...
SaaS has it, and the replays went round its absence. Same effect as the v1 route.
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
88f90d040d
api/v2: report routeSelection in tailnet settings
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
7063c04581
api/v2: add device shields-up, SSH, distro and connectivity fields
...
Same read shapes as SaaS. Latency stays empty: headscale drops it on arrival.
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
f1788c1ce4
api/v2: send connectedToControl and lastSeen on connected devices
...
SaaS sends both on every device. The SDK reported live devices as
disconnected, and tscli delete devices panicked on the missing lastSeen.
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
9841280d11
api/v2: use SaaS's text for an unknown device
2026-11-03 17:05:00 +01:00
Kristoffer Dalby
e99d8f3f88
api/v2: list devices sorted by name
...
SaaS sorts by name. NodeStore order moved on every write, so
order-sensitive Terraform configs showed changes.
2026-11-03 17:05:00 +01:00
Michael Lopez
42a97be25f
state: validate the new name and refuse OIDC users in RenameUser ( #3642 )
...
State.RenameUser went through UpdateUser and skipped the checks
db.RenameUser applies, so the API could rename an OIDC user, whose
name the identity provider owns, or rename any user to an invalid
name. Apply both checks in the update function and map the username
validation errors to 400.
2026-11-02 20:22:23 +01:00
Kristoffer Dalby
f453502ef1
hscontrol: name policy, registration and map delivery decisions
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
4e946edb08
api/v2: enforce and document OAuth tag permissions
...
Retagging requires all current and requested tags; disallowed tags return
400. Token responses list tags only when the token may assign them.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
7d94d189fa
api/v2: send empty route lists under fields=all
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
66db32dde0
api/v2: report tagged device creators and join keys
...
Use the join-key creator as the device's user without changing ownership.
Omit oauthClientId when an OAuth token's source client is not recorded.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
a08daa91fe
api/v2: list token-made auth keys to a token without all=true
...
Keys an OAuth token makes are marked so. No listing holds an invalid
key.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
fe260f5adf
api/v2: show userId on admin-made tagged keys
...
An admin key's user is recorded as the creator of the tagged keys it
makes. A tagged key re-registers a machine by its tags, whoever made it.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
6474ac6dd3
api/v2: return a device name as its FQDN
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
17cbea0f6a
api/v2: ignore unknown fields and reject unknown key types
...
Match SaaS request decoding while refusing unsupported keyType values.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
9979be140e
db: keep at most 1000 access tokens per OAuth client
...
Minting needs only the client secret, whatever its scopes, and
added one row per mint. Each mint now ends tokens past the newest 1000.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
408b9b7797
api/v2: check the createKey scope before reading the body
...
createKey has no static scope, so any token got its body parsed
and validated before the handler's scope check.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
0bf5b0f0af
api/v2: limit request bodies and redact schema-validation details
...
Bound schema, raw, and token-form bodies before parsing. Omit submitted
values from schema errors while preserving policy reasons and test labels.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
77005fac35
api/v2: keep a tagged all-scope client's tokens inside its tags
...
Only an untagged all-scope client may mint tokens for any tag, so a
tagged token may not create one.
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
d8c482e4b3
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 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
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
f2df44295a
state, db: validate and store the current policy before installing it
...
Reject empty input. Validate without changing live state, then store and
install under one lock; prune old rows only with a successful write.
2026-11-02 19:15:40 +01:00
Kristoffer Dalby
c0925962c2
hscontrol: bound pending authentication without evicting sessions
2026-10-29 20:51:50 +01:00
Kristoffer Dalby
5a4d366ce1
auth, state: keep only hostname, OS and tags in pending registrations
...
The rest arrives with the first MapRequest. A relogin keeps the node's
current Hostinfo, endpoints and disco key; an oversized merge is a 400.
Fixes ANT-2026-RQS7JAPP
2026-10-29 14:00:02 +01:00
Kristoffer Dalby
15a8c7584e
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.
Fixes ANT-2026-QMCAFJ1Q
2026-10-29 14:00:02 +01:00
Kristoffer Dalby
a63ee3e032
api/v2: add the acl/validate endpoint
...
Checks a policy as a write would, without storing it. As on Tailscale,
a refused policy answers 200 with its reason; only an empty body is 400.
Terraform provider 0.29.3 calls it at plan time.
2026-10-29 11:04:05 +01:00
Kristoffer Dalby
3f6e54cbd5
mapper: send CertDomains and https cap when certificates are enabled
...
Both gate tailscale cert and serve HTTPS on the client; httpsEnabled
follows, as in Tailscale. No certificate when an operator extra record
sits at or below the name: a wildcard would cover it.
Updates #2137
Updates #1921
2026-10-18 20:53:18 +02:00
Kristoffer Dalby
60d42808b8
state: keep node removal apart from policy refresh in DeleteNode
...
Peers get the deletion as an explicit PeersRemoved change, independent of
their sent-peers tracking.
Updates tailscale/tailscale#15660
2026-09-30 19:03:13 +02:00
Kristoffer Dalby
21f6e46fb8
state: refresh policy nodes inside the peer map build
...
One peer build per tag/user/IP/route write; callers detect policy moves
via NodesGeneration. Per-node caches only store results for the node
pm holds, so a mapper reading mid-build cannot pin a stale filter.
2026-09-30 17:21:02 +02:00
Kristoffer Dalby
393dd3e2d9
db: store all credentials in one SHA-256-hashed table
...
API keys, pre-auth keys and OAuth clients/tokens share one table and verify
path. Secrets carry 256 bits of crypto/rand entropy, so a SHA-256 digest
needs no stretching; bcrypt/argon2id rows rehash on use until 0.32.
2026-09-26 00:33:12 +02:00
MsfPablo
d60bac5c79
db: reject unknown OAuth client scopes at creation ( #3424 )
...
Unknown scopes grant nothing, so clients were silently under-privileged.
Report every invalid scope at once.
Fixes #3406
2026-09-25 21:24:37 +02:00
Kristoffer Dalby
eebeab3c1e
docs: document joining nodes with an OAuth client
...
Prefix swap, baseURL, every attribute; examples for tailscale up,
container, tsnet, GitHub Action.
2026-09-25 17:09:19 +02:00