summaryrefslogtreecommitdiffhomepage
path: root/types/key
AgeCommit message (Collapse)AuthorFilesLines
2025-08-15types/key: init HardwareAttestionKey implementation (#16867)Patrick O'Doherty1-0/+68
Define the HardwareAttestionKey interface describing a platform-specific hardware backed node identity attestation key. Clients will register the key type implementations for their platform. Updates tailscale/corp#31269 Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-07-21wgengine/magicsock,all: allocate peer relay over disco instead of PeerAPI ↵Jordan Whited2-0/+56
(#16603) Updates tailscale/corp#30583 Updates tailscale/corp#30534 Updates tailscale/corp#30557 Signed-off-by: Dylan Bargatze <dylan@tailscale.com> Signed-off-by: Jordan Whited <jordan@tailscale.com> Co-authored-by: Dylan Bargatze <dylan@tailscale.com>
2025-06-10cmd/{derp,derpprobe},prober,derp: add mesh support to derpprobe (#15414)Mike O'Driscoll1-0/+22
Add mesh key support to derpprobe for probing derpers with verify set to true. Move MeshKey checking to central point for code reuse. Fix a bad error fmt msg. Fixes tailscale/corp#27294 Fixes tailscale/corp#25756 Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-05-22cmd/derper: fix mesh auth for DERP servers (#16061)Simon Law2-0/+201
To authenticate mesh keys, the DERP servers used a simple == comparison, which is susceptible to a side channel timing attack. By extracting the mesh key for a DERP server, an attacker could DoS it by forcing disconnects using derp.Client.ClosePeer. They could also enumerate the public Wireguard keys, IP addresses and ports for nodes connected to that DERP server. DERP servers configured without mesh keys deny all such requests. This patch also extracts the mesh key logic into key.DERPMesh, to prevent this from happening again. Security bulletin: https://tailscale.com/security-bulletins#ts-2025-003 Fixes tailscale/corp#28720 Signed-off-by: Simon Law <sfllaw@tailscale.com>
2024-10-07types/key: use tlpub: in error message (#13707)Erisa A1-3/+3
Fixes tailscale/corp#19442 Signed-off-by: Erisa A <erisa@tailscale.com>
2024-07-10all: add test for package comments, fix, add comments as neededBrad Fitzpatrick1-0/+6
Updates #cleanup Change-Id: Ic4304e909d2131a95a38b26911f49e7b1729aaef Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-04-16all: use Go 1.22 range-over-intBrad Fitzpatrick2-2/+2
Updates #11058 Change-Id: I35e7ef9b90e83cac04ca93fd964ad00ed5b48430 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-02-26types/key: remove copy returning array by valueBrad Fitzpatrick1-4/+3
It's unnecessary. Returning an array value is already a copy. Updates #cleanup Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: If7f350b61003ea08f16a531b7b4e8ae483617939
2024-02-08all: use new AppendEncode methods available in Go 1.22 (#11079)Joe Tsai1-9/+1
Updates #cleanup Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2024-01-23wgengine/magicsock: implement probing of UDP path lifetime (#10844)Jordan Whited1-0/+9
This commit implements probing of UDP path lifetime on the tail end of an active direct connection. Probing configuration has two parts - Cliffs, which are various timeout cliffs of interest, and CycleCanStartEvery, which limits how often a probing cycle can start, per-endpoint. Initially a statically defined default configuration will be used. The default configuration has cliffs of 10s, 30s, and 60s, with a CycleCanStartEvery of 24h. Probing results are communicated via clientmetric counters. Probing is off by default, and can be enabled via control knob. Probing is purely informational and does not yet drive any magicsock behaviors. Updates #540 Signed-off-by: Jordan Whited <jordan@tailscale.com>
2023-09-27types/key: update some doc strings for public key serializationJames Tucker1-4/+7
Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
2023-09-09ipn/ipnstate: address TODO about garbage during peer sortingBrad Fitzpatrick1-0/+6
Updates #cleanup Change-Id: I34938bca70a95571cc62ce1f76eaab5db8c2c3ef Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01all: implement AppendText alongside MarshalText (#9207)Joe Tsai6-14/+63
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-06-27types/key: add test for NodePublic.ShardBrad Fitzpatrick1-0/+23
Updates #cleanup Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-02-01all: use Go 1.20's bytes.CloneBrad Fitzpatrick1-2/+3
Updates #7123 Updates #6257 (more to do in other repos) Change-Id: I073e2a6d81a5d7fbecc29caddb7e057ff65239d0 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris13-39/+26
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-11control/controlclient, tailcfg: add Node.Expired field, set for expired nodesAndrew Dunham1-0/+17
Nodes that are expired, taking into account the time delta calculated from MapResponse.ControlTime have the newly-added Expired boolean set. For additional defense-in-depth, also replicate what control does and clear the Endpoints and DERP fields, and additionally set the node key to a bogus value. Updates #6932 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Ia2bd6b56064416feee28aef5699ca7090940662a
2022-11-30types/key,cmd/tailscale/cli: support tlpub prefix for tailnet-lock keysTom DNetto2-4/+34
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-15all: store NL keys per profileMaisem Ali1-0/+5
This moves the NetworkLock key from a dedicated StateKey to be part of the persist.Persist struct. This struct is stored as part for ipn.Prefs and is also the place where we store the NodeKey. It also moves the ChonkDir from "/tka" to "/tka-profile/<profile-id>". The rename was intentional to be able to delete the "/tka" dir if it exists. This means that we will have a unique key per profile, and a unique directory per profile. Note: `tailscale logout` will delete the entire profile, including any keys. It currently does not delete the ChonkDir. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-11-11cmd/tailscale,ipn: minor fixes to tailscale lock commandsTom DNetto1-0/+11
* Fix broken add/remove key commands * Make lock status display whether the node is signed Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-11-02client/tailscale, tsnet, ipn/ipnlocal: prove nodekey ownership over noiseBrad Fitzpatrick1-0/+3
Fixes #5972 Change-Id: Ic33a93d3613ac5dbf172d6a8a459ca06a7f9e547 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-10-27types/key: add missing ChallengePublic.UnmarshalTextBrad Fitzpatrick2-0/+22
Forgot it when adding the Challenge types earlier. Change-Id: Ie0872c4e6dc25e5d832aa58c7b3f66d450bf6b71 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-10-26tka, types/key: add NLPublic.KeyIDAdrian Dewhurst1-0/+5
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-19types/key: add ChallengePublic, ChallengePrivate, NewChallengeBrad Fitzpatrick1-0/+78
Updates #5972 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-09-29all: fix spelling mistakesJosh Soref1-1/+1
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-08-24tka: support rotating node-keys in node-key signaturesTom DNetto1-29/+0
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-22client,cmd/tailscale,ipn,tka,types: implement tka initialization flowTom DNetto1-1/+6
This PR implements the client-side of initializing network-lock with the Coordination server. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-04tka,types/key: remove dependency for tailcfg & types/ packages on tkaTom DNetto2-16/+27
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>
2022-08-04all: use syncs.AtomicValueMaisem Ali1-0/+10
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-08-03tka,types/key: implement direct node-key signaturesTom DNetto2-0/+41
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-03assorted: plumb tka initialization & network-lock key into tailscaledTom DNetto1-0/+7
- A network-lock key is generated if it doesn't already exist, and stored in the StateStore. The public component is communicated to control during registration. - If TKA state exists on the filesystem, a tailnet key authority is initialized (but nothing is done with it for now). Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-03types/key: make NLPublic complement to NLPrivateTom DNetto2-4/+46
Forgot that I would need that in control. Oops. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-07-29tka,types/key: implement NLPrivate glue for tailnet key authority keysTom DNetto3-3/+124
Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-07-25net/netaddr: start migrating to net/netip via new netaddr adapter packageBrad Fitzpatrick1-1/+1
Updates #5162 Change-Id: Id7bdec303b25471f69d542f8ce43805328d56c12 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-22types/key: add MachinePrecomputedSharedKey.OpenBrad Fitzpatrick2-1/+24
Follow-up to cfdb8626738d Updates tailscale/corp#1709 Change-Id: I7af931a2cb55f9006e1029381663ac21d1794242 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-19types/key: add ControlPrivate.Shared wrapper tooBrad Fitzpatrick1-0/+5
Follow-up to cfdb8626738da. Change-Id: Iab610d761f1e6d88e8bcb584d9c02cafe48fc377 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-19types/key: add naclbox shared key wrapper type + Seal methodBrad Fitzpatrick2-0/+47
So the control plane can stop doing precomputations on each naclbox message. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-05-17types/key: make NodePublic implement Shardable (#4698)Tom1-0/+12
Needed for an experiment in Control. Signed-off-by: Tom DNetto <tom@tailscale.com>
2021-11-10control/noise: use key.Machine{Public,Private} as appropriate.David Anderson1-0/+39
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-02types/key: delete legacy NodeKey type.David Anderson3-110/+0
Fixes #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: export constants for key size, not a method.David Anderson2-12/+8
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29tailcfg: move NodeKey type to types/key.danderson/nodekey-moveDavid Anderson3-0/+110
This leaves behind a type alias and associated constructor, to allow for gradual switchover. Updates #3206. Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: delete legacy undifferentiated key types.danderson/nodekey-delete-oldDavid Anderson2-193/+0
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: remove node key AsPublic/AsPrivate compat shims.danderson/nodekey-cleanupDavid Anderson1-18/+0
Updates #3206. Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29wgengine/magicsock: remove uses of tailcfg.DiscoKey.David Anderson1-0/+8
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: correct ShortString representation of DiscoPublic.David Anderson1-3/+6
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: fix license header on disco files.David Anderson1-0/+4
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29types/key: new types for disco keys.David Anderson2-0/+250
Needed for #3206 to remove final uses of key.{Public,Private}. Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28types/wgkey: delete, no longer used.David Anderson1-19/+0
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28wgengine/wgcfg: convert to use new node key type.David Anderson1-0/+13
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>