summaryrefslogtreecommitdiffhomepage
path: root/tka
AgeCommit message (Collapse)AuthorFilesLines
2025-08-14tka: block key addition when the max number of keys is reachedAnton Tolchanov2-0/+49
Updates #16607 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-06-16tka: reject removal of the last signing keyAnton Tolchanov2-0/+22
Fixes tailscale/corp#19447 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-09-04tka: truncate long rotation signature chainsAnton Tolchanov2-1/+185
When a rotation signature chain reaches a certain size, remove the oldest rotation signature from the chain before wrapping it in a new rotation signature. Since all previous rotation signatures are signed by the same wrapping pubkey (node's own tailnet lock key), the node can re-construct the chain, re-signing previous rotation signatures. This will satisfy the existing certificate validation logic. Updates #13185 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-08-21cmd/tl-longchain: tool to re-sign nodes with long rotation signaturesAnton Tolchanov2-0/+34
In Tailnet Lock, there is an implicit limit on the number of rotation signatures that can be chained before the signature becomes too long. This program helps tailnet admins to identify nodes that have signatures with long chains and prints commands to re-sign those node keys with a fresh direct signature. It's a temporary mitigation measure, and we will remove this tool as we design and implement a long-term approach for rotation signatures. Example output: ``` 2024/08/20 18:25:03 Self: does not need re-signing 2024/08/20 18:25:03 Visible peers with valid signatures: 2024/08/20 18:25:03 Peer xxx2.yy.ts.net. (100.77.192.34) nodeid=nyDmhiZiGA11KTM59, current signature kind=direct: does not need re-signing 2024/08/20 18:25:03 Peer xxx3.yy.ts.net. (100.84.248.22) nodeid=ndQ64mDnaB11KTM59, current signature kind=direct: does not need re-signing 2024/08/20 18:25:03 Peer xxx4.yy.ts.net. (100.85.253.53) nodeid=nmZfVygzkB21KTM59, current signature kind=rotation: chain length 4, printing command to re-sign tailscale lock sign nodekey:530bddbfbe69e91fe15758a1d6ead5337aa6307e55ac92dafad3794f8b3fc661 tlpub:4bf07597336703395f2149dce88e7c50dd8694ab5bbde3d7c2a1c7b3e231a3c2 ``` To support this, the NetworkLockStatus localapi response now includes information about signatures of all peers rather than just the invalid ones. This is not displayed by default in `tailscale lock status`, but will be surfaced in `tailscale lock status --json`. Updates #13185 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-06-27ipn/ipnlocal: allow multiple signature chains from the same SigCredentialAnton Tolchanov2-8/+27
Detection of duplicate Network Lock signature chains added in 01847e0123dee3b7a6f9645155da69270f01155e failed to account for chains originating with a SigCredential signature, which is used for wrapped auth keys. This results in erroneous removal of signatures that originate from the same re-usable auth key. This change ensures that multiple nodes created by the same re-usable auth key are not getting filtered out by the network lock. Updates tailscale/corp#19764 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-06-27tka: test SigCredential signatures and netmap filteringAnton Tolchanov2-0/+102
This change moves handling of wrapped auth keys to the `tka` package and adds a test covering auth key originating signatures (SigCredential) in netmap. Updates tailscale/corp#19764 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-06-03ipn/ipnlocal: discard node keys that have been rotated outAnton Tolchanov3-5/+232
A non-signing node can be allowed to re-sign its new node keys following key renewal/rotation (e.g. via `tailscale up --force-reauth`). To be able to do this, node's TLK is written into WrappingPubkey field of the initial SigDirect signature, signed by a signing node. The intended use of this field implies that, for each WrappingPubkey, we typically expect to have at most one active node with a signature tracing back to that key. Multiple valid signatures referring to the same WrappingPubkey can occur if a client's state has been cloned, but it's something we explicitly discourage and don't support: https://tailscale.com/s/clone This change propagates rotation details (wrapping public key, a list of previous node keys that have been rotated out) to netmap processing, and adds tracking of obsolete node keys that, when found, will get filtered out. Updates tailscale/corp#19764 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-05-31cmd/tailscale/cli: print node signature in `tailscale lock status`Anton Tolchanov1-0/+36
- Add current node signature to `ipnstate.NetworkLockStatus`; - Print current node signature in a human-friendly format as part of `tailscale lock status`. Examples: ``` $ tailscale lock status Tailnet lock is ENABLED. This node is accessible under tailnet lock. Node signature: SigKind: direct Pubkey: [OTB3a] KeyID: tlpub:44a0e23cd53a4b8acc02f6732813d8f5ba8b35d02d48bf94c9f1724ebe31c943 WrappingPubkey: tlpub:44a0e23cd53a4b8acc02f6732813d8f5ba8b35d02d48bf94c9f1724ebe31c943 This node's tailnet-lock key: tlpub:44a0e23cd53a4b8acc02f6732813d8f5ba8b35d02d48bf94c9f1724ebe31c943 Trusted signing keys: tlpub:44a0e23cd53a4b8acc02f6732813d8f5ba8b35d02d48bf94c9f1724ebe31c943 1 (self) tlpub:6fa21d242a202b290de85926ba3893a6861888679a73bc3a43f49539d67c9764 1 (pre-auth key kq3NzejWoS11KTM59) ``` For a node created via a signed auth key: ``` This node is accessible under tailnet lock. Node signature: SigKind: rotation Pubkey: [e3nAO] Nested: SigKind: credential KeyID: tlpub:6fa21d242a202b290de85926ba3893a6861888679a73bc3a43f49539d67c9764 WrappingPubkey: tlpub:3623b0412cab0029cb1918806435709b5947ae03554050f20caf66629f21220a ``` For a node that rotated its key a few times: ``` This node is accessible under tailnet lock. Node signature: SigKind: rotation Pubkey: [DOzL4] Nested: SigKind: rotation Pubkey: [S/9yU] Nested: SigKind: rotation Pubkey: [9E9v4] Nested: SigKind: direct Pubkey: [3QHTJ] KeyID: tlpub:44a0e23cd53a4b8acc02f6732813d8f5ba8b35d02d48bf94c9f1724ebe31c943 WrappingPubkey: tlpub:2faa280025d3aba0884615f710d8c50590b052c01a004c2b4c2c9434702ae9d0 ``` Updates tailscale/corp#19764 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-04-16all: use Go 1.22 range-over-intBrad Fitzpatrick5-5/+5
Updates #11058 Change-Id: I35e7ef9b90e83cac04ca93fd964ad00ed5b48430 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-02-08all: use new AppendEncode methods available in Go 1.22 (#11079)Joe Tsai1-10/+1
Updates #cleanup Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2023-12-20all: cleanup unused code, part 1 (#10661)Andrew Lytvynov1-18/+0
Run `staticcheck` with `U1000` to find unused code. This cleans up about a half of it. I'll do the other half separately to keep PRs manageable. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-11-27tka: clarify field commentJenny Zhang1-1/+4
Updates #cleanup Signed-off-by: Jenny Zhang <jz@tailscale.com>
2023-09-09all: use set.Set consistently instead of map[T]struct{}Brad Fitzpatrick2-6/+8
I didn't clean up the more idiomatic map[T]bool with true values, at least yet. I just converted the relatively awkward struct{}-valued maps. Updates #cleanup Change-Id: I758abebd2bb1f64bc7a9d0f25c32298f4679c14f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01all: implement AppendText alongside MarshalText (#9207)Joe Tsai1-3/+15
This eventually allows encoding packages that may respect the proposed encoding.TextAppender interface. The performance gains from this is between 10-30%. Updates tailscale/corp#14379 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2023-08-01all: implement lock revoke-keys commandTom DNetto2-3/+246
The revoke-keys command allows nodes with tailnet lock keys to collaborate to erase the use of a compromised key, and remove trust in it. Signed-off-by: Tom DNetto <tom@tailscale.com> Updates ENG-1848
2023-07-19tka: guard against key-length panics when verifying signaturesTom DNetto2-0/+9
In late 2022 a subtle but crucial part of documentation was added to ed25519.Verify: It will panic if len(publicKey) is not [PublicKeySize]. https://cs.opensource.google/go/go/+/02ed0e5e67530e6b041989d55048ce373dc60327 This change catches that error so it won't lead to a panic. Signed-off-by: Tom DNetto <tom@tailscale.com> Updates https://github.com/tailscale/corp/issues/8568
2023-07-19tka: allow checkpoint AUMs to change TKA stateTom DNetto1-14/+1
Updates https://github.com/tailscale/corp/issues/8568 Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-06-20tka: add function for generating signing deeplinks (#8385)Ross Zurowski2-15/+121
This commit continues the work from #8303, providing a method for a tka.Authority to generate valid deeplinks for signing devices. We'll use this to provide the necessary deeplinks for users to sign from their mobile devices. Updates #8302 Signed-off-by: Ross Zurowski <ross@rosszurowski.com>
2023-06-13tka: provide verify-deeplink local API endpoint (#8303)Andrea Gottardo1-0/+167
* tka: provide verify-deeplink local API endpoint Fixes https://github.com/tailscale/tailscale/issues/8302 Signed-off-by: Andrea Gottardo <andrea@tailscale.com> Address code review comments Signed-off-by: Andrea Gottardo <andrea@tailscale.com> Address code review comments by Ross Signed-off-by: Andrea Gottardo <andrea@tailscale.com> * Improve error encoding, fix logic error Signed-off-by: Andrea Gottardo <andrea@tailscale.com> --------- Signed-off-by: Andrea Gottardo <andrea@tailscale.com>
2023-05-25tka: fix go vet complaint on copy of lock value in tailchonk_test.go (#8208)valscale1-1/+11
go vet complains when we copy a lock value. Create clone function that copies everything but the lock value. Fixes #8207 Signed-off-by: Val <valerie@tailscale.com>
2023-04-17various: add golangci-lint, fix issues (#7905)Andrew Dunham6-15/+15
This adds an initial and intentionally minimal configuration for golang-ci, fixes the issues reported, and adds a GitHub Action to check new pull requests against this linter configuration. Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I8f38fbc315836a19a094d0d3e986758b9313f163
2023-03-03tka: compact TKA storage on startupTom DNetto4-5/+242
Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-03-01tka: implement compaction logicTom DNetto2-0/+750
Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-02-23tka: add public API on NodeKeySignature key informationTom DNetto1-0/+21
This is needed in the coordination server. Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris18-54/+36
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2023-01-04cmd/tailscale,tka: make KeyID return an error instead of panickingTom DNetto11-51/+104
Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-01-04cmd/tailscale,tka: implement compat for TKA messages, minor UX tweaksTom DNetto2-9/+17
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-29cmd/tailscale,ipn: store disallowed TKA's in prefs, lock local-disableTom DNetto1-0/+7
Take 2 of https://github.com/tailscale/tailscale/pull/6546 Builds on https://github.com/tailscale/tailscale/pull/6560 Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-29Revert "ipn,types/persist: store disallowed TKA's in prefs, lock local-disable"Brad Fitzpatrick1-5/+0
This reverts commit f1130421f063d391d4a94ca7eb819facffdbe7c3. It was submitted with failing tests (go generate checks) Requires a lot of API changes to fix so rolling back instead of forward. Change-Id: I024e8885c0ed44675d3028a662f386dda811f2ad Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-29ipn,types/persist: store disallowed TKA's in prefs, lock local-disableTom DNetto1-0/+5
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-22ipn/ipnlocal,tka: generate a nonce for each TKATom DNetto2-1/+31
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-11cmd/tailscale,ipn: minor fixes to tailscale lock commandsTom DNetto2-0/+20
* Fix broken add/remove key commands * Make lock status display whether the node is signed Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-10-26tka, types/key: add NLPublic.KeyIDAdrian Dewhurst1-0/+38
This allows direct use of NLPublic with tka.Authority.KeyTrusted() and similar without using tricks like converting the return value of Verifier. Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
2022-10-17tka: make rotation signatures use nested keyIDTom DNetto3-5/+38
Duplicating this at each layer doesnt make any sense, and is another invariant where things could go wrong. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-10-05ipn/ipnlocal,tka: Fix bugs found by integration testingTom DNetto1-0/+4
* tka.State.staticValidateCheckpoint could call methods on a contained key prior to calling StaticValidate on that key * Remove broken backoff / RPC retry logic from tka methods in ipn/ipnlocal, to be fixed at a later time * Fix NetworkLockModify() which would attempt to take b.mu twice and deadlock, remove now-unused dependence on netmap * Add methods on ipnlocal.LocalBackend to be used in integration tests * Use TAILSCALE_USE_WIP_CODE as the feature flag so it can be manipulated in tests Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-09-29all: fix spelling mistakesJosh Soref3-9/+9
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-09-29ipn/ipnlocal, tka: Implement TKA synchronization with the control planeTom DNetto2-0/+15
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-09-26tka: Checkpoint every 50 updatesTom DNetto4-11/+131
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-09-21control/controlclient,ipn/ipnlocal: wire tka enable/disableTom DNetto7-14/+26
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-09-15refactor: move from io/ioutil to io and os packagesEng Zer Jun1-2/+1
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Reference: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-31tka: implement credential signatures (key material delegation)Tom DNetto3-27/+153
This will be needed to support preauth-keys with network lock in the future, so getting the core mechanics out of the way now. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-30tka: validate key after UpdateKey before applying stateTom DNetto2-2/+10
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-26tka: make storage a parameter rather than an Authority struct memberTom DNetto6-107/+143
Updates #5435 Based on the discussion in #5435, we can better support transactional data models by making the underlying storage layer a parameter (which can be specialized for the request) rather than a long-lived member of Authority. Now that Authority is just an instantaneous snapshot of state, we can do things like provide idempotent methods and make it cloneable, too. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-25tka: move disablement logic out-of-band from AUMsTom DNetto7-74/+54
It doesn't make a ton of sense for disablement to be communicated as an AUM, because any failure in the AUM or chain mechanism will mean disablement wont function. Instead, tracking of the disablement secrets remains inside the state machine, but actual disablement and communication of the disablement secret is done by the caller. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-24tka: optimize common case of processing updates built from headTom DNetto2-13/+85
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-24tka: support rotating node-keys in node-key signaturesTom DNetto4-23/+280
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-22client,cmd/tailscale,ipn,tka,types: implement tka initialization flowTom DNetto6-9/+13
This PR implements the client-side of initializing network-lock with the Coordination server. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-15tka: Use strict decoding settings, implement Unserialize()Tom DNetto7-10/+89
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-08tka: stable text representation of AUMHashDavid Crawshaw3-28/+53
This makes debugging easier, you can pass an AUMHash to a printf and get a string that is easy to debug. Also rearrange how directories/files work in the FS store: use the first two characters of the string representation as the prefix directory, and use the entire AUMHash string as the file name. This is again to aid debugging: you can `ls` a directory and line up what prints out easily with what you get from a printf in debug code. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2022-08-04tka,types/key: remove dependency for tailcfg & types/ packages on tkaTom DNetto12-50/+56
Following the pattern elsewhere, we create a new tka-specific types package for the types that need to couple between the serialized structure types, and tka. Signed-off-by: Tom DNetto <tom@tailscale.com>