Commit Graph
5091 Commits
Author SHA1 Message Date
Kristoffer Dalby 9f88e7ddcf policy/v2: compile a rule-less policy as allow-all per node too
compileFilterRulesForNode missed the case d2a85b1d1 fixed.
2026-11-05 15:34:46 +01:00
Kristoffer Dalby 9332d2d022 docs: describe which rules offer exit nodes
Exit routes need a rule to the internet. via grants add up; plain internet rules bypass via.
2026-11-05 15:34:46 +01:00
Kristoffer Dalby 6f2c7fbe7d derp: check derp.paths and derp.urls regions like a policy derpMap
Clients count latency by RegionID, so a key mismatch picks a missing home.

Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 1a635e7d08 docs: document the policy derpMap
Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 69e01ca7f8 policy/v2: reject policy DERP nodes on tailscale.com like SaaS
SaaS also rejects its DERP servers' IPs; that needs its live server list.

Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby b54570d375 state: serve the configured DERP map with the policy derpMap applied
Applied as SaaS applies it; a derpMap-only policy write reaches clients.

Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 502a47c7d3 policy/v2: accept and validate a policy derpMap like SaaS
Same rules and wording as SaaS: custom regions 900-999 with a node,
IDs match their keys, null removes. 26 SaaS captures pin it.

Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 9dd164e04a servertest: pin DERP HomeParams a client keeps
Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby e358a539af derp: reject unknown keys in derp.paths files
SaaS rejects them in a policy derpMap; a misspelt key silently did nothing.

Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 00f9373246 docs: document DERP region scores
Updates #2918
2026-11-05 14:11:33 +01:00
Kristoffer Dalby 6f2f97ca17 derp: fix HomeParams merge panic, allow scores-only files
Maps without HomeParams (Tailscale default, embedded region) hit a nil
dereference. Keep HomeParams nil unless set; drop scores clients ignore
or JSON cannot encode.

Fixes #2918
2026-11-05 14:11:33 +01:00
Samy Djemaï 0f2e68fd1d feat: add DERPHomeParams settings 2026-11-05 14:11:33 +01:00
Kristoffer Dalby f2a9b71d50 policy/v2: add SaaS captures for SSH rule validation
Updates #3335
2026-11-05 13:43:48 +01:00
Kristoffer Dalby a48fe0f94d policy/v2: pin SSH rules refused unlike SaaS
SaaS accepts autogroup:tagged next to user dsts, then sends no rules.
The check fails when a re-capture shows SaaS changed.

Updates #3335
2026-11-05 13:43:48 +01:00
Kristoffer Dalby b20d37289e policy/v2: check SSH user destinations as Tailscale does
A user dst needs every source to be that user; groups count by their
members. Tags and autogroup:tagged reach neither user dsts nor self.

Updates #3335
2026-11-05 13:43:48 +01:00
Kristoffer Dalby 36ea8d9e81 policy/v2: refuse autogroup:member as SSH destination
Tailscale answers invalid dst "autogroup:member" for every source.

Updates #3335
2026-11-05 13:43:48 +01:00
Kristoffer Dalby e93046aa68 policy/v2: word SSH rule errors as Tailscale does
Check src and dst kinds in validate, not in JSON decoding, so they
get the label. Texts from SaaS acl/validate answers.

Updates #3335
2026-11-05 13:43:48 +01:00
Kristoffer Dalby 87b110b335 policy/v2: label SSH rule errors once with [ssh]
Wrap in the SSH loop, so shared tag and group checks get it too.
Tailscale's marker; replaces the per-message ssh: prefix.

Fixes #3335
2026-11-05 13:43:48 +01:00
Jemanuel f8d3703a80 policy: prefix all SSH validation errors with "ssh" 2026-11-05 13:43:48 +01:00
Kristoffer Dalby 2908eff547 hscontrol: replay SaaS key expiry captures
Each expirySeconds form, auth and API keys; tscap 4f88289.
2026-11-05 12:41:50 +01:00
Kristoffer Dalby 895094edb0 gen/client/v2: regenerate for the auth key tags and expiry changes 2026-11-05 12:41:50 +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 9ad6b73072 cli: show a pre-auth key without expiration as - 2026-11-05 12:41:50 +01:00
Kristoffer Dalby 8daa63cc9d gen/client/v1: regenerate for the nullable pre-auth key expiration 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 459b157c3b docs: note the posture attributes endpoint and its proxy setting
trusted_proxies now feeds a stored, API-visible address, not only logs.

Updates #2272
2026-11-05 12:38:53 +01:00
Kristoffer Dalby a8c135dc20 gen/client/v2: regenerate for optional posture expiries
Updates #2272
2026-11-05 12:38:53 +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
Kristoffer Dalby 5adc504fed db: add last_control_address with explicit DDL
Migration rules forbid struct-driven schema changes; re-date the ID to
sort after its neighbours.

Updates #2272
2026-11-05 12:38:53 +01:00
Kristoffer Dalby 3af065bb03 state: record the control address without holding persistMu
Write NodeStore unlocked, persist through persistNodeWith; drop the
dedicated db setter and rollback. Strip IPv6 zones.

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 9fa176b211 CHANGELOG: note the SaaS filter form 2026-11-05 12:32:04 +01:00
Kristoffer Dalby 3278461d6f policy/v2: move test-only helpers out of production code
mergeFilterRules and the peer-rule reference move to tests;
compileAutogroupSelf and newResolved go.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 91b920cc33 policy/matcher, policy/v2: parse a via grant's sources once
Every router reparsed them for its matchers. via-members, 5000 nodes:
590 -> 11.7 ms, 555 -> 7.2 MB per pass.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 800392ae89 policyutil: match single-address destinations by text
A node without routes is reached only at its own addresses; skip
parsing. member-member, 5000 nodes: 1471 -> 490 ms per pass.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 4b2d227f0e policy/v2: build autogroup:self rules once per user
Self rules depend only on the user; every node rebuilt them. 5000 nodes:
filters 1482 -> 232 ms, matchers 2681 -> 4.3 ms; compile pays ~2 ms.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby dea3af085e policy/v2: build filter merge keys once per compile
Per-node merging joined every rule's SrcIPs again for every node.
via-members, 5000 nodes: 26.9 -> 2.3 ms, 51 -> 1.2 MB per pass.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby d929eb6a40 policy/v2: benchmark member-to-member and via-from-members shapes
Both grow with the tailnet once node addresses are listed one by one.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 5bcbb73f68 policy/v2: write filter rules as Tailscale does
Each alias written on its own: node addresses one by one, internet as
ranges. Via rules merge only with via rules; exit nodes get every
user's self rules in user order. Drops 63 FILTER_ADDRESS_FORM,
SELF_DST_REPEAT and VIA_RULE_MERGED skips.

Updates #3562
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 137a66d59c policy/v2: build matchers once per compiled rule
Per-node matchers reuse the global ones and parse only self and via
rules, instead of every rule for every node.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 31b78b77ad policy/v2, servertest: record how SaaS groups filter rules
v105/v108: grant and ACL with one source; v106: rule order;
v107: two via grants through one router.
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 1b53713e05 CHANGELOG: name the via exit fix #3566 still makes
Updates #3562
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 06d2c0aa91 policy/v2, servertest: record via exit grants beside other rules
v93-v97: one member in two via exit grants. v98: a capability grant
to "*" beside one; main drops its exit routes, SaaS keeps them.

Updates #3562
2026-11-05 12:32:04 +01:00
Kristoffer Dalby 56b5d2286c servertest: require both exit routes and hide an unnamed exit node
Use the shared route helpers, so a failed announcement fails the test.

Updates #3562
2026-11-05 12:32:04 +01:00
Kristoffer Dalby fc10729278 policy/v2: pin exit routes out of UsePrimary
Exit routes have no HA election; UsePrimary could only drop them.

Updates #3562
2026-11-05 12:32:04 +01:00
mineiwik 6a1f8d1579 policy/v2: keep via exit routes when two via grants match a viewer 2026-11-05 12:32:04 +01:00
Kristoffer Dalby 5651bf4c5c hscontrol: leave reverse DNS for the Tailscale ranges to the client
SaaS sends no reverse routes for any ipPool; clients from v1.84 add
them for 100.64.0.0/10 and fd7a:115c:a1e0::/48 themselves.

Updates #3482
2026-11-04 16:25:09 +01:00
Kristoffer Dalby 8df88e8dc1 policy/v2: add SaaS captures of MagicDNS reverse routes per ipPool
Captured with tscap f055502.

Updates #3482
2026-11-04 16:25:09 +01:00