9351 Commits

Author SHA1 Message Date
Jordan Whited
540eb05638
wgengine/magicsock: make Conn.Send() lazyEndpoint aware (#16465)
A lazyEndpoint may end up on this TX codepath when wireguard-go is
deemed "under load" and ends up transmitting a cookie reply using the
received conn.Endpoint.

Updates tailscale/corp#20732
Updates tailscale/corp#30042

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-07 08:45:13 -07:00
David Bond
84eac7b8de
cmd/k8s-operator: Allow custom ingress class names (#16472)
This commit modifies the k8s operator to allow for customisation of the ingress class name
via a new `OPERATOR_INGRESS_CLASS_NAME` environment variable. For backwards compatibility,
this defaults to `tailscale`.

When using helm, a new `ingress.name` value is provided that will set this environment variable
and modify the name of the deployed `IngressClass` resource.

Fixes https://github.com/tailscale/tailscale/issues/16248

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-07 12:12:59 +01:00
dependabot[bot]
4f3355e499
.github: Bump github/codeql-action from 3.29.0 to 3.29.1 (#16423)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.0 to 3.29.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](ce28f5bb42...39edc492db)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-06 22:25:18 -06:00
Tom Proctor
079134d3c0
cmd/k8s-operator: always set ProxyGroup status conditions (#16429)
Refactors setting status into its own top-level function to make it
easier to ensure we _always_ set the status if it's changed on every
reconcile. Previously, it was possible to have stale status if some
earlier part of the provision logic failed.

Updates #16327

Change-Id: Idab0cfc15ae426cf6914a82f0d37a5cc7845236b
Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-07-07 00:40:56 +01:00
Dylan Bargatze
92a114c66d
tailcfg, feature/relayserver, wgengine/magicsock: invert UDP relay server nodeAttrs (#16444)
Inverts the nodeAttrs related to UDP relay client/server enablement to disablement, and fixes up the corresponding logic that uses them. Also updates the doc comments on both nodeAttrs.

Fixes tailscale/corp#30024

Signed-off-by: Dylan Bargatze <dylan@tailscale.com>
2025-07-04 12:48:38 -04:00
Irbe Krumina
639fed6856
Dockerfile,build_docker.sh: add a note on how to build local images (#16471)
Updates#cleanup

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-07-04 16:06:22 +01:00
David Bond
c46145b99e
cmd/k8s-operator: Move login server value to top-level (#16470)
This commit modifies the operator helm chart values to bring the newly
added `loginServer` field to the top level. We felt as though it was a bit
confusing to be at the `operatorConfig` level as this value modifies the
behaviour or the operator, api server & all resources that the operator
manages.

Updates https://github.com/tailscale/corp/issues/29847

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-04 12:19:23 +01:00
Nick Khyl
a8055b5f40 cmd/tailscale/cli,ipn,ipn/ipnlocal: add AutoExitNode preference for automatic exit node selection
With this change, policy enforcement and exit node resolution can happen in separate steps,
since enforcement no longer depends on resolving the suggested exit node. This keeps policy
enforcement synchronous (e.g., when switching profiles), while allowing exit node resolution
to be asynchronous on netmap updates, link changes, etc.

Additionally, the new preference will be used to let GUIs and CLIs switch back to "auto" mode
after a manual exit node override, which is necessary for tailscale/corp#29969.

Updates tailscale/corp#29969
Updates #16459

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-03 14:12:25 -05:00
Nick Khyl
0098822981 ipn/ipnlocal: update suggestExitNode to skip offline candidates and fix TestSetControlClientStatusAutoExitNode
TestSetControlClientStatusAutoExitNode is broken similarly to TestUpdateNetmapDeltaAutoExitNode
as suggestExitNode didn't previously check the online status of exit nodes, and similarly to the other test
it succeeded because the test itself is also broken.

However, it is easier to fix as it sends out a full netmap update rather than a delta peer update,
so it doesn't depend on the same refactoring as TestSetControlClientStatusAutoExitNode.

Updates #16455
Updates tailscale/corp#29969

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-03 13:54:33 -05:00
Nick Khyl
6ecc25b26a ipn/ipnlocal: skip TestUpdateNetmapDeltaAutoExitNode
suggestExitNode never checks whether an exit node candidate is online.
It also accepts a full netmap, which doesn't include changes from delta updates.
The test can't work correctly until both issues are fixed.

Previously, it passed only because the test itself is flawed.
It doesn't succeed because the currently selected node goes offline and a new one is chosen.
Instead, it succeeds because lastSuggestedExitNode is incorrect, and suggestExitNode picks
the correct node the first time it runs, based on the DERP map and the netcheck report.
The node in exitNodeIDWant just happens to be the optimal choice.

Fixing SuggestExitNode requires refactoring its callers first, which in turn reveals the flawed test,
as suggestExitNode ends up being called slightly earlier.

In this PR, we update the test to correctly fail due to existing bugs in SuggestExitNode,
and temporarily skip it until those issues are addressed in a future commit.

Updates #16455
Updates tailscale/corp#29969

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-03 13:54:33 -05:00
Nick Khyl
56d772bd63 ipn/ipnlocal: simplify pickNewAutoExitNode
(*profileManager).CurrentPrefs() is always valid. Additionally, there's no value in cloning
and passing the full ipn.Prefs when editing preferences. Instead, ipn.MaskedPrefs should
only have ExitNodeID set.

Updates tailscale/corp#29969

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-03 13:54:33 -05:00
Nick Khyl
1a2185b1ee ipn/ipnlocal: rename setAutoExitNodeIDLockedOnEntry to pickNewAutoExitNode; drop old function
Currently, (*LocalBackend).pickNewAutoExitNode() is just a wrapper around
setAutoExitNodeIDLockedOnEntry that sends a prefs-change notification at the end.
It doesn't need to do that, since setPrefsLockedOnEntry already sends the notification
(setAutoExitNodeIDLockedOnEntry calls it via editPrefsLockedOnEntry).

This PR removes the old pickNewAutoExitNode function and renames
setAutoExitNodeIDLockedOnEntry to pickNewAutoExitNode for clarity.

Updates tailscale/corp#29969

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-03 13:54:33 -05:00
David Bond
5dc11d50f7
cmd/k8s-operator: Set login server on tsrecorder nodes (#16443)
This commit modifies the recorder node reconciler to include the environment
variable added in https://github.com/tailscale/corp/pull/30058 which allows
for configuration of the coordination server.

Updates https://github.com/tailscale/corp/issues/29847

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-03 15:53:35 +01:00
Jordan Whited
3a4b439c62
feature/relayserver,net/udprelay: add IPv6 support (#16442)
Updates tailscale/corp#27502
Updates tailscale/corp#30043

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-02 20:38:39 -07:00
James Tucker
77d19604f4 derp/derphttp: fix DERP TLS client server name inclusion in URL form
When dialed with just an URL and no node, the recent proxy fixes caused
a regression where there was no TLS server name being included.

Updates #16222
Updates #16223

Signed-off-by: James Tucker <james@tailscale.com>
Co-Authored-by: Jordan Whited <jwhited@tailscale.com>
2025-07-02 14:56:48 -07:00
David Bond
eb03d42fe6
cmd/k8s-operator: Allow configuration of login server (#16432)
This commit modifies the kubernetes operator to allow for customisation of the tailscale
login url. This provides some data locality for people that want to configure it.

This value is set in the `loginServer` helm value and is propagated down to all resources
managed by the operator. The only exception to this is recorder nodes, where additional
changes are required to support modifying the url.

Updates https://github.com/tailscale/corp/issues/29847

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-02 21:42:31 +01:00
Jordan Whited
f9e7131772
wgengine/magicsock: make lazyEndpoint load bearing for UDP relay (#16435)
Cryptokey Routing identification is now required to set an [epAddr] into
the peerMap for Geneve-encapsulated [epAddr]s.

Updates tailscale/corp#27502
Updates tailscale/corp#29422
Updates tailscale/corp#30042

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-02 13:27:30 -07:00
Andrew Lytvynov
172e26b3e3
tailcfg: report StateEncrypted in Hostinfo (#16434)
Report whether the client is configured with state encryption (which
varies by platform and can be optional on some). Wire it up to
`--encrypt-state` in tailscaled, which is set for Linux/Windows, and set
defaults for other platforms. Macsys will also report this if full
Keychain migration is done.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-07-02 10:52:00 -07:00
Jordan Whited
d2edf7133a
wgengine/magicsock: remove references to rucPtr (#16441)
It used to be a **RebindingUDPConn, now it's just a *RebindingUDPConn.

Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-02 09:23:54 -07:00
kari-ts
d15b2312c4
tailcfg: add CapabilityOwner (#16426)
We would like to start sending whether a node is a Tailnet owner in netmap responses so that clients can determine what information to display to a user who wants to request account deletion.

Updates tailscale/corp#30016

Signed-off-by: kari-ts <kari@tailscale.com>
2025-07-01 09:28:48 -07:00
Percy Wegmann
454d856be8 drive,ipn/ipnlocal: calculate peer taildrive URLs on-demand
Instead of calculating the PeerAPI URL at the time that we add the peer,
we now calculate it on every access to the peer. This way, if we
initially did not have a shared address family with the peer, but
later do, this allows us to access the peer at that point. This
follows the pattern from other places where we access the peer API,
which also calculate the URL on an as-needed basis.

Additionally, we now show peers as not Available when we can't get
a peer API URL.

Lastly, this moves some of the more frequent verbose Taildrive logging
from [v1] to [v2] level.

Updates #29702

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-07-01 10:59:58 -05:00
Percy Wegmann
6a9bf9172b ipn/ipnlocal: add verbose Taildrive logging on client side
This allows logging the following Taildrive behavior from the client's perspective
when --verbose=1:

- Initialization of Taildrive remotes for every peer
- Peer availability checks
- All HTTP requests to peers (not just GET and PUT)

Updates tailscale/corp#29702

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-06-30 14:29:04 -05:00
Jordan Whited
47e77565c6
wgengine/magicsock: avoid handshaking relay endpoints that are trusted (#16412)
Changes to our src/address family can trigger blackholes.

This commit also adds a missing set of trustBestAddrUntil when setting
a UDP relay path as bestAddr.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-30 12:12:57 -07:00
Tom Meadows
2fc247573b
cmd/k8s-operator: ProxyClass annotation for Services and Ingresses (#16363)
* cmd/k8s-operator: ProxyClass annotation for Services and Ingresses

Previously, the ProxyClass could only be configured for Services and
Ingresses via a Label. This adds the ability to set it via an
Annotation, but prioritizes the Label if both a Label and Annotation are
set.

Updates #14323

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>

* Update cmd/k8s-operator/operator.go

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
Signed-off-by: Tom Meadows <tom@tmlabs.co.uk>

* Update cmd/k8s-operator/operator.go

Signed-off-by: Tom Meadows <tom@tmlabs.co.uk>

* cmd/k8s-operator: ProxyClass annotation for Services and Ingresses

Previously, the ProxyClass could only be configured for Services and
Ingresses via a Label. This adds the ability to set it via an
Annotation, but prioritizes the Label if both a Label and Annotation are
set.

Updates #14323

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>

---------

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
Signed-off-by: Tom Meadows <tom@tmlabs.co.uk>
Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-06-30 12:08:35 +01:00
Will Norris
f85e4bcb32 client/systray: replace counter metric with gauge
Replace the existing systray_start counter metrics with a
systray_running gauge metrics.

This also adds an IncrementGauge method to local client to parallel
IncrementCounter. The LocalAPI handler supports both, we've just never
added a client method for gauges.

Updates #1708

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
2025-06-28 21:39:58 -07:00
Brad Fitzpatrick
ee8c3560ef tailcfg: format integer IDs as decimal consistently
The server-side code already does e.g. "nodeid:%d" instead of "%x"
and as a result we have to second guess a lot of identifiers that could
be hex or decimal.

This stops the bleeding and means in a year and change we'll stop
seeing the hex forms.

Updates tailscale/corp#29827

Change-Id: Ie5785a07fc32631f7c949348d3453538ab170e6d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-28 09:19:34 -07:00
Jordan Whited
3dc694b4f1
wgengine/magicsock: clear UDP relay bestAddr's on disco ping timeout (#16410)
Otherwise we can end up mirroring packets to them forever. We may
eventually want to relax this to direct paths as well, but start with
UDP relay paths, which have a higher chance of becoming untrusted and
never working again, to be conservative.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-27 19:11:59 -07:00
Simon Law
544aee9d08
tsidp: update README to refer to community projects (#16411)
We dropped the idea of the Experimental release stage in
tailscale/tailscale-www#7697, in favour of Community Projects.

Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-06-27 17:30:43 -07:00
Andrew Lytvynov
76b9afb54d
ipn/store: make StateStore.All optional (#16409)
This method is only needed to migrate between store.FileStore and
tpm.tpmStore. We can make a runtime type assertion instead of
implementing an unused method for every platform.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-06-27 15:14:18 -07:00
Jordan Whited
0a64e86a0d
wgengine/magicsock: move UDP relay path discovery to heartbeat() (#16407)
This was previously hooked around direct UDP path discovery /
CallMeMaybe transmission, and related conditions. Now it is subject to
relay-specific considerations.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-27 13:56:55 -07:00
Tom Proctor
711698f5a9
cmd/{containerboot,k8s-operator}: use state Secret for checking device auth (#16328)
Previously, the operator checked the ProxyGroup status fields for
information on how many of the proxies had successfully authed. Use
their state Secrets instead as a more reliable source of truth.

containerboot has written device_fqdn and device_ips keys to the
state Secret since inception, and pod_uid since 1.78.0, so there's
no need to use the API for that data. Read it from the state Secret
for consistency. However, to ensure we don't read data from a
previous run of containerboot, make sure we reset containerboot's
state keys on startup.

One other knock-on effect of that is ProxyGroups can briefly be
marked not Ready while a Pod is restarting. Introduce a new
ProxyGroupAvailable condition to more accurately reflect
when downstream controllers can implement flows that rely on a
ProxyGroup having at least 1 proxy Pod running.

Fixes #16327

Change-Id: I026c18e9d23e87109a471a87b8e4fb6271716a66

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-06-27 18:10:04 +01:00
Tom Meadows
f81baa2d56
cmd/k8s-operator, k8s-operator: support Static Endpoints on ProxyGroups (#16115)
updates: #14674

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-06-27 17:12:14 +01:00
Claus Lensbøl
53f67c4396
util/eventbus: fix docstrings (#16401)
Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-06-27 10:03:56 -04:00
Kristoffer Dalby
df786be14d cmd/tailscale: use text format for TKA head
Updates tailscale/corp#23258

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-06-27 12:49:40 +02:00
Kristoffer Dalby
4a7b8afabf cmd/tailscale: add tlpub: prefix to lock log output
Updates tailscale/corp#23258

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-06-27 12:49:40 +02:00
Jordan Whited
b32a01b2dc
disco,net/udprelay,wgengine/magicsock: support relay re-binding (#16388)
Relay handshakes may now occur multiple times over the lifetime of a
relay server endpoint. Handshake messages now include a handshake
generation, which is client specified, as a means to trigger safe
challenge reset server-side.

Relay servers continue to enforce challenge values as single use. They
will only send a given value once, in reply to the first arriving bind
message for a handshake generation.

VNI has been added to the handshake messages, and we expect the outer
Geneve header value to match the sealed value upon reception.

Remote peer disco pub key is now also included in handshake messages,
and it must match the receiver's expectation for the remote,
participating party.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-26 19:30:14 -07:00
Jordan Whited
b2bf7e988e
wgengine/magicsock: add envknob to toggle UDP relay feature (#16396)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-26 18:39:47 -07:00
Andrew Lytvynov
6feb3c35cb
ipn/store: automatically migrate between plaintext and encrypted state (#16318)
Add a new `--encrypt-state` flag to `cmd/tailscaled`. Based on that
flag, migrate the existing state file to/from encrypted format if
needed.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-06-26 17:09:13 -07:00
Simon Law
d2c1ed22c3
.github/workflows: replace tibdex with official GitHub Action (#16385)
GitHub used to recommend the tibdex/github-app-token GitHub Action
until they wrote their own actions/create-github-app-token.

This patch replaces the use of the third-party action with the
official one.

Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-06-26 13:37:21 -07:00
JerryYan
99aaa6e92c
ipn/ipnlocal: update PeerByID to return SelfNode and rename it to NodeByID (#16096)
Like NodeByKey, add an if stmt for checking the NodeId is SelfNode.

Updates #16052

Signed-off-by: Jerry Yan <792602257@qq.com>
2025-06-26 11:43:48 -05:00
James Tucker
47dff33eac tool/gocross: remove GOROOT to ensure correct toolchain use
go(1) repsects GOROOT if set, but tool/go / gocross-wrapper.sh are explicitly intending to use our toolchain. We don't need to set GOROOT, just unset it, and then go(1) handles the rest.

Updates tailscale/corp#26717

Signed-off-by: James Tucker <james@tailscale.com>
2025-06-26 09:35:06 -07:00
Simon Law
aa106c92a4
.github/workflows: request @tailscale/dataplane review DERP changes (#16372)
For any changes that involve DERP, automatically add the
@tailscale/dataplane team as a reviewer.

Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-06-25 21:30:44 -07:00
Jordan Whited
51d00e135b
wgengine/magicsock: fix relayManager alloc work cleanup (#16387)
Premature cancellation was preventing the work from ever being cleaned
up in runLoop().

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-25 19:13:02 -07:00
Claus Lensbøl
37eca1785c
net/netmon: add tests for the events over the eventbus (#16382)
Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-06-25 14:44:01 -04:00
Laszlo Magyar
35b11e7be5
envknob/featureknob: restore SSH and exit-node capability for Home Assistant (#16263)
SSH was disabled in #10538
Exit node was disabled in #13726
This enables ssh and exit-node options in case of Home Assistant.

Fixes #15552

Signed-off-by: Laszlo Magyar <lmagyar1973@gmail.com>
2025-06-25 11:26:11 -06:00
David Bond
b75fe9eeca
cmd/k8s-operator: Add NOTES.txt to Helm chart (#16364)
This commit adds a NOTES.txt to the operator helm chart that will be written to the
terminal upon successful installation of the operator.

It includes a small list of knowledgebase articles with possible next steps for
the actor that installed the operator to the cluster. It also provides possible
commands to use for explaining the custom resources.

Fixes #13427

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-06-25 14:14:17 +01:00
Claus Lensbøl
f2f1236ad4
util/eventbus: add test helpers to simplify testing events (#16294)
Instead of every module having to come up with a set of test methods for
the event bus, this handful of test helpers hides a lot of the needed
setup for the testing of the event bus.

The tests in portmapper is also ported over to the new helpers.

Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-06-25 09:00:34 -04:00
Percy Wegmann
83cd446b5d release/dist/qnap: upgrade to Ubuntu 24.04 Docker image
20.04 is no longer supported.

This pulls in changes to the QDK package that were required to make build succeed on 24.04.

Updates https://github.com/tailscale/corp/issues/29849

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-06-24 20:49:11 -05:00
Nick Khyl
9e28bfc69c ipn/ipnlocal,wgengine/magicsock: wait for magicsock to process pending events on authReconfig
Updates #16369

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-06-24 16:39:08 -05:00
Percy Wegmann
4a1fc378d1 release/dist: switch back to Ubuntu 20.04 for building QNAP packages
After the switch to 24.04, unsigned packages did not build correctly (came out as only a few KBs).

Fixes tailscale/tailscale-qpkg#148

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-06-23 19:30:02 -05:00