2307 Commits

Author SHA1 Message Date
Jordan Whited
3c6d17e6f1
cmd/tailscale/cli,ipn/ipnlocal,wgengine/magicsock: implement tailscale debug peer-relay-servers (#16577)
Updates tailscale/corp#30036

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-16 10:03:05 -07:00
Tom Meadows
fe46f33885
cmd/{k8s-operator,k8s-proxy},kube/k8s-proxy: add static endpoints for kube-apiserver type ProxyGroups (#16523)
Updates #13358

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-07-14 15:39:39 +01:00
Simon Law
f23e4279c4
types/lazy: add lazy.GMap: a map of lazily computed GValues (#16532)
Fixes tailscale/corp#30360

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-07-13 05:47:56 -07:00
Andrew Lytvynov
39bf84d1c7
cmd/tsidp: set hostinfo.App in tsnet mode (#16544)
This makes it easier to track how widely tsidp is used in practice.

Updates #cleanup

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-07-11 16:01:15 -07:00
Brad Fitzpatrick
30da2e1c32 cmd/tailscale/cli: add "configure jetkvm" subcommand
To write the init script.

And fix the JetKVM detection to work during early boot while the filesystem
and modules are still being loaded; it wasn't being detected on early boot
and then tailscaled was failing to start because it didn't know it was on JetKVM
and didn't modprobe tun.

Updates #16524

Change-Id: I0524ca3abd7ace68a69af96aab4175d32c07e116
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-07-11 14:35:24 -07:00
Dylan Bargatze
fed72e2aa9
cmd/tailscale, ipn/ipnstate, wgengine/magicsock: update ping output for peer relay (#16515)
Updates the output for "tailscale ping" to indicate if a peer relay was traversed, just like the output for DERP or direct connections.

Fixes tailscale/corp#30034

Signed-off-by: Dylan Bargatze <dylan@tailscale.com>
2025-07-10 18:22:25 -04:00
Brad Fitzpatrick
fbc6a9ec5a all: detect JetKVM and specialize a handful of things for it
Updates #16524

Change-Id: I183428de8c65d7155d82979d2d33f031c22e3331
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-07-10 15:07:19 -07:00
David Bond
d0cafc0a67
cmd/{k8s-operator,k8s-proxy}: apply accept-routes configuration to k8s-proxy (#16522)
This commit modifies the k8s-operator and k8s-proxy to support passing down
the accept-routes configuration from the proxy class as a configuration value
read and used by the k8s-proxy when ran as a distinct container managed by
the operator.

Updates #13358

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-10 15:53:01 +01:00
David Bond
2b665c370c
cmd/{k8s-operator,k8s-proxy}: allow setting login server url (#16504)
This commit modifies the k8s proxy application configuration to include a
new field named `ServerURL` which, when set, modifies
the tailscale coordination server used by the proxy. This works in the same
way as the operator and the proxies it deploys.

If unset, the default coordination server is used.

Updates https://github.com/tailscale/tailscale/issues/13358

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-10 14:33:30 +01:00
David Bond
cf0460b9da
cmd/k8s-operator: allow letsencrypt staging on k8s proxies (#16521)
This commit modifies the operator to detect the usage of k8s-apiserver
type proxy groups that wish to use the letsencrypt staging directory and
apply the appropriate environment variable to the statefulset it
produces.

Updates #13358

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-07-10 14:33:13 +01:00
Jordan Whited
ae8641735d
cmd/tailscale/cli,ipn/ipnstate,wgengine/magicsock: label peer-relay (#16510)
Updates tailscale/corp#30033

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-07-09 15:17:51 -07:00
Nick Khyl
c5fdf9e1db cmd/tailscale/cli: add support for tailscale {up,set} --exit-node=auto:any
If the specified exit node string starts with "auto:" (i.e., can be parsed as an ipn.ExitNodeExpression),
we update ipn.Prefs.AutoExitNode instead of ipn.Prefs.ExitNodeID.

Fixes #16459

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-09 12:48:12 -05:00
Tom Proctor
27fa2ad868
cmd/k8s-operator: don't require generation for Available condition (#16497)
The observed generation was set to always 0 in #16429, but this had the
knock-on effect of other controllers considering ProxyGroups never ready
because the observed generation is never up to date in
proxyGroupCondition. Make sure the ProxyGroupAvailable function does not
requires the observed generation to be up to date, and add testing
coverage to catch regressions.

Updates #16327

Change-Id: I42f50ad47dd81cc2d3c3ce2cd7b252160bb58e40

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-07-09 09:37:45 +01:00
Tom Proctor
4dfed6b146
cmd/{k8s-operator,k8s-proxy}: add kube-apiserver ProxyGroup type (#16266)
Adds a new k8s-proxy command to convert operator's in-process proxy to
a separately deployable type of ProxyGroup: kube-apiserver. k8s-proxy
reads in a new config file written by the operator, modelled on tailscaled's
conffile but with some modifications to ensure multiple versions of the
config can co-exist within a file. This should make it much easier to
support reading that config file from a Kube Secret with a stable file name.

To avoid needing to give the operator ClusterRole{,Binding} permissions,
the helm chart now optionally deploys a new static ServiceAccount for
the API Server proxy to use if in auth mode.

Proxies deployed by kube-apiserver ProxyGroups currently work the same as
the operator's in-process proxy. They do not yet leverage Tailscale Services
for presenting a single HA DNS name.

Updates #13358

Change-Id: Ib6ead69b2173c5e1929f3c13fb48a9a5362195d8
Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-07-09 09:21:56 +01:00
Tom Proctor
90bf0a97b3
cmd/k8s-operator/deploy: clarify helm install notes (#16449)
Based on feedback that it wasn't clear what the user is meant to do with
the output of the last command, clarify that it's an optional command to
explore what got created.

Updates #13427

Change-Id: Iff64ec6d02dc04bf4bbebf415d7ed1a44e7dd658

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-07-09 09:13:11 +01:00
Simon Law
bad17a1bfa
cmd/tailscale: format empty cities and countries as hyphens (#16495)
When running `tailscale exit-node list`, an empty city or country name
should be displayed as a hyphen "-". However, this only happened when
there was no location at all. If a node provides a Hostinfo.Location,
then the list would display exactly what was provided.

This patch changes the listing so that empty cities and countries will
either render the provided name or "-".

Fixes #16500

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-07-08 22:14:18 -07:00
Nick Khyl
1fe82d6ef5 cmd/tailscale/cli,ipn/ipnlocal: restrict logout when AlwaysOn mode is enabled
In this PR, we start passing a LocalAPI actor to (*LocalBackend).Logout to make it subject
to the same access check as disconnects made via tailscale down or the GUI.

We then update the CLI to allow `tailscale logout` to accept a reason, similar to `tailscale down`.

Updates tailscale/corp#26249

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-07-08 15:02:51 -05: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
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
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
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
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
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
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
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
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
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
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
Kristoffer Dalby
0198255266 cmd/tailscale: warn user about nllock key removal without resigning
Fixes #19445

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-06-23 16:46:06 +02:00
Kristoffer Dalby
9309760263 util/prompt: make yes/no prompt reusable
Updates #19445

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-06-23 16:46:06 +02:00
Brad Fitzpatrick
9af42f425c .github/workflows: shard the Windows builder
It's one of the slower ones, so split it up into chunks.

Updates tailscale/corp#28679

Change-Id: I16a5ba667678bf238c84417a51dda61baefbecf7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-20 06:11:11 -07:00
Irbe Krumina
253d0b026d
cmd/k8s-operator: remove conffile hashing mechanism (#16335)
Proxies know how to reload configfile on changes since 1.80, which
is going to be the earliest supported proxy version with 1.84 operator,
so remove the mechanism that was updating configfile hash to force
proxy Pod restarts on config changes.

Updates #13032

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-06-20 10:34:47 +01:00
Brad Fitzpatrick
e92eb6b17b net/tlsdial: fix TLS cert validation of HTTPS proxies
If you had HTTPS_PROXY=https://some-valid-cert.example.com running a
CONNECT proxy, we should've been able to do a TLS CONNECT request to
e.g. controlplane.tailscale.com:443 through that, and I'm pretty sure
it used to work, but refactorings and lack of integration tests made
it regress.

It probably regressed when we added the baked-in LetsEncrypt root cert
validation fallback code, which was testing against the wrong hostname
(the ultimate one, not the one which we were being asked to validate)

Fixes #16222

Change-Id: If014e395f830e2f87f056f588edacad5c15e91bc
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-18 14:20:39 -07:00
Andrew Lytvynov
4979ce7a94
feature/tpm: implement ipn.StateStore using TPM sealing (#16030)
Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-06-18 14:17:12 -07:00
Raj Singh
45a4b69ce0
cmd/tsidp: fix OIDC client persistence across restarts
Fixes #16088
Signed-off-by: Raj Singh <raj@tailscale.com>
2025-06-18 10:43:19 -05:00
Simon Law
49ae66c10c
cmd/tailscale: clean up dns --help messages (#16306)
This patch contains the following cleanups:

1. Simplify `ffcli.Command` definitions;
2. Word-wrap help text, consistent with other commands;
3. `tailscale dns --help` usage makes subcommand usage more obvious;
4. `tailscale dns query --help` describes DNS record types.

Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-06-17 20:39:59 -07:00
Mike O'Driscoll
e7f5c9a015
derp/derphttp: add error notify for RunWatchConnectionLoop (#16261)
The caller of client.RunWatchConnectionLoop may need to be
aware of errors that occur within loop. Add a channel
that notifies of errors to the caller to allow for
decisions to be make as to the state of the client.

Updates tailscale/corp#25756

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-06-17 13:05:05 -04:00
Brad Fitzpatrick
259bab9bff scripts/check_license_headers.sh: delete, rewrite as a Go test
Updates tailscale/corp#29650

Change-Id: Iad4e4ccd9d68ebb1d1a12f335cc5295d0bd05b60
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-16 13:35:38 -07:00
James Tucker
86985228bc cmd/natc: add a flag to use specific DNS servers
If natc is running on a host with tailscale using `--accept-dns=true`
then a DNS loop can occur. Provide a flag for some specific DNS
upstreams for natc to use instead, to overcome such situations.

Updates #14667

Signed-off-by: James Tucker <james@tailscale.com>
2025-06-16 13:05:49 -07:00
Anton Tolchanov
42da161b19 tka: reject removal of the last signing key
Fixes tailscale/corp#19447

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-06-16 15:38:37 +01:00
Irbe Krumina
e29e3c150f
cmd/k8s-operator: ensure that TLS resources are updated for HA Ingress (#16262)
Ensure that if the ProxyGroup for HA Ingress changes, the TLS Secret
and Role and RoleBinding that allow proxies to read/write to it are
updated.

Fixes #16259

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-06-16 12:21:59 +01:00
M. J. Fromberger
fe391d5694
client/local: use an iterator to stream bus events (#16269)
This means the caller does not have to remember to close the reader, and avoids
having to duplicate the logic to decode JSON into events.

Updates #15160

Change-Id: I20186fabb02f72522f61d5908c4cc80b86b8936b
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-06-13 15:47:35 -07:00
James Tucker
b0f7b23efe net/netcheck: preserve live home DERP through packet loss
During a short period of packet loss, a TCP connection to the home DERP
may be maintained. If no other regions emerge as winners, such as when
all regions but one are avoided/disallowed as candidates, ensure that
the current home region, if still active, is not dropped as the
preferred region until it has failed two keepalives.

Relatedly apply avoid and no measure no home to ICMP and HTTP checks as
intended.

Updates tailscale/corp#12894
Updates tailscale/corp#29491

Signed-off-by: James Tucker <james@tailscale.com>
2025-06-13 11:05:20 -07:00
Irbe Krumina
3219de4cb8
cmd/k8s-operator: ensure status update errors are displayed to users (#16251)
Updates#cleanup

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-06-12 13:47:34 +01:00
Claus Lensbøl
6010812f0c
ipn/localapi,client/local: add debug watcher for bus events (#16239)
Updates: #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-06-11 14:22:30 -04:00
Fran Bull
3b25e94352 cmd/natc: allow specifying the tsnet state dir
Which can make operating the service more convenient.
It makes sense to put the cluster state with this if specified, so
rearrange the logic to handle that.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-06-11 10:05:18 -07:00