9114 Commits

Author SHA1 Message Date
Brad Fitzpatrick
ef49e75b10 util/set: add SmallSet.SoleElement, fix bug, add more tests
This adds SmallSet.SoleElement, which I need in another repo for
efficiency. I added tests, but those tests failed because Add(1) +
Add(1) was promoting the first Add's sole element to a map of one
item. So fix that, and add more tests.

Updates tailscale/corp#29093

Change-Id: Iadd5ad08afe39721ee5449343095e389214d8389
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-29 13:06:29 -07:00
Brad Fitzpatrick
401d6c0cfa go.mod: bump golang.org/x deps
Updates #8043

Change-Id: I8702a17130559353ccdecbe8b64eeee461ff09c3
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-29 12:55:32 -07:00
Nick Khyl
191afd3390 net/tshttpproxy: fix WDAP/PAC proxy detection on Win10 1607 and earlier
Using WINHTTP_AUTOPROXY_ALLOW_AUTOCONFIG on Windows versions older than Windows 10 1703 (build 15063)
is not supported and causes WinHttpGetProxyForUrl to fail with ERROR_INVALID_PARAMETER. This results in failures
reaching the control on environments where a proxy is required.

We use wingoes version detection to conditionally set the WINHTTP_AUTOPROXY_ALLOW_AUTOCONFIG flag
on Windows builds greater than 15063.

While there, we also update proxy detection to use WINHTTP_AUTO_DETECT_TYPE_DNS_A, as DNS-based proxy discovery
might be required with Active Directory and in certain other environments.

Updates tailscale/corp#29168
Fixes #879

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-29 14:28:37 -05:00
Nick Khyl
4cccd15eeb ipn/ipnlocal: fix data race when accessing b.appConnector
The field must only be accessed while holding LocalBackend's mutex,
but there are two places where it's accessed without the mutex:
 - (LocalBackend).MaybeClearAppConnector()
 - handleC2NAppConnectorDomainRoutesGet()

Fixes #16123

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-29 14:07:03 -05:00
Brad Fitzpatrick
dca4036a20 util/set: add SmallSet
Updates tailscale/corp#29093

Change-Id: I0e07e83dee51b4915597a913b0583c99756d90e2
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-29 11:59:35 -07:00
Andrew Lytvynov
b0d35975c0
go.toolchain.rev: bump to 1.24.3 (#16060)
Updates https://github.com/tailscale/corp/issues/28916

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-05-28 17:54:04 -07:00
M. J. Fromberger
36df320e6a
tsnet: remove an expired configuration-path migration step (#16120)
As note in the comment, it now being more than six months since this was
deprecated and there being no (further) uses of the old pattern in our internal
services, let's drop the migrator.

Updates #cleanup

Change-Id: Ie4fb9518b2ca04a9b361e09c51cbbacf1e2633a8
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-05-28 14:12:24 -07:00
Jonathan Nobels
5e54819cee
net/dns: cache dns.Config for reuse when compileConfig fails (#16059)
fixes tailscale/corp#25612

We now keep track of any dns configurations which we could not
compile. This gives RecompileDNSConfig a configuration to
attempt to recompile and apply when the OS pokes us to indicate
that the interface dns servers have changed/updated.   The manager config
will remain unset until we have the required information to compile
it correctly which should eliminate the problematic SERVFAIL
responses (especially on macOS 15).

This also removes the missingUpstreamRecovery func in the forwarder
which is no longer required now that we have proper error handling
and recovery manager and the client.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-05-28 15:43:12 -04:00
Jordan Whited
ffc8ec289b
wgengine/magicsock: implement relayManager endpoint probing (#16029)
relayManager is responsible for disco ping/pong probing of relay
endpoints once a handshake is complete.

Future work will enable relayManager to set a relay endpoint as the best
UDP path on an endpoint if appropriate.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-28 10:45:59 -07:00
Jonathan Nobels
842df37803
ipn: set RouteAll=true by default for new accounts on iOS and Android (#16110)
fixes tailscale/tailscale#16082

RouteAll should be true by default on iOS and Android.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-05-28 10:08:06 -04:00
Irbe Krumina
4b59f1dfe6
.github/workflows: use Ubuntu 24.04 images (#16097)
Bumps Ubuntu version for test container images 22.04 -> 24.04.

Updates#cleanup

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-27 16:03:45 +01:00
Mike O'Driscoll
cd49faa123
feature/capture: fix wireshark decoding and add new disco frame types (#16089)
Fix the wireshark lua dissector to support 0 bit position
and not throw modulo div by 0 errors.

Add new disco frame types to the decoder.

Updates tailscale/corp#29036

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-05-26 10:23:30 -04:00
Raj Singh
09582bdc00
cmd/tsidp: add web UI for managing OIDC clients (#16068)
Add comprehensive web interface at ui for managing OIDC clients, similar to tsrecorder's design. Features include list view, create/edit forms with validation, client secret management, delete functionality with confirmation dialogs, responsive design, and restricted tailnet access only.

Fixes #16067

Signed-off-by: Raj Singh <raj@tailscale.com>
2025-05-24 18:16:29 -04:00
Tim Klocke
4980869977 cmd/tsidp: Fix sending string for refresh_token
In accordance with the OIDC/OAuth 2.0 protocol, do not send an empty
refresh_token and instead omit the field when empty.

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

Signed-off-by: Tim Klocke <taaem@mailbox.org>
2025-05-24 11:30:00 -07:00
Zach Buchheit
4a11514db5
ipn/ipnlocal: improve dohQuery error to suggest ?dns= and ?q= (#16056)
Previously, a missing or invalid `dns` parameter on GET `/dns-query`
returned only “missing ‘dns’ parameter”. Now the error message guides
users to use `?dns=` or `?q=`.

Updates: #16055

Signed-off-by: Zach Buchheit <zachb@tailscale.com>
2025-05-23 14:17:28 -07:00
Irbe Krumina
00a7dd180a
cmd/k8s-operator: validate Service tags, catch duplicate Tailscale Services (#16058)
Validate that any tags that users have specified via tailscale.com/tags
annotation are valid Tailscale ACL tags.
Validate that no more than one HA Tailscale Kubernetes Services in a single cluster refer
to the same Tailscale Service.

Updates tailscale/tailscale#16054
Updates tailscale/tailscale#16035

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-23 12:23:58 +01:00
Brad Fitzpatrick
7a5af6e6e7 ssh/tailssh: exclude Android from Linux build tags
As noted in #16048, the ./ssh/tailssh package failed to build on
Android, because GOOS=android also matches the "linux" build
tag. Exclude Android like iOS is excluded from macOS (darwin).

This now works:

    $ GOOS=android go install ./ipn/ipnlocal ./ssh/tailssh

The original PR at #16048 is also fine, but this stops the problem
earlier.

Updates #16048

Change-Id: Ie4a6f6966a012e510c9cb11dd0d1fa88c48fac37
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-22 20:02:59 -07:00
Patrick O'Doherty
a05924a9e5
client/web: add Sec-Fetch-Site CSRF protection (#16046)
RELNOTE=Fix CSRF errors in the client Web UI

Replace gorilla/csrf with a Sec-Fetch-Site based CSRF protection
middleware that falls back to comparing the Host & Origin headers if no
SFS value is passed by the client.

Add an -origin override to the web CLI that allows callers to specify
the origin at which the web UI will be available if it is hosted behind
a reverse proxy or within another application via CGI.

Updates #14872
Updates #15065

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-05-22 12:26:02 -07:00
Simon Law
3ee4c60ff0
cmd/derper: fix mesh auth for DERP servers (#16061)
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>
2025-05-22 12:14:16 -07:00
James 'zofrex' Sanderson
aa8bc23c49
control/controlclient,health,tailcfg: refactor control health messages (#15839)
* control/controlclient,health,tailcfg: refactor control health messages

Updates tailscale/corp#27759

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
Signed-off-by: Paul Scott <408401+icio@users.noreply.github.com>
Co-authored-by: Paul Scott <408401+icio@users.noreply.github.com>
2025-05-22 13:40:32 +01:00
Jonathan Nobels
980ab4244d
VERSION.txt: this is v1.85.0 (#16042)
Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
v1.85.0-pre
2025-05-21 15:27:32 -04:00
Andrew Lytvynov
0bab16448e
ipn/store: remove a layer of indirection for registering stores (#15986)
Registering a new store is cheap, it just adds a map entry. No need to
lazy-init it with sync.Once and an intermediate slice holding init
functions.

Updates #cleanup

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-05-21 08:47:23 -07:00
kari-ts
5a8b99e977
ipn,ipnlocal,taildrop: use SAF for Android files (#15976)
Create FileOps for calling platform-specific file operations such as SAF APIs in Taildrop
Update taildrop.PutFile to support both traditional and SAF modes

Updates tailscale/tailscale#15263

Signed-off-by: kari-ts <kari@tailscale.com>
2025-05-20 15:30:19 -07:00
Jordan Whited
70b6e8ca98
wgengine/magicsock: fix outdated heartbeat comment (#16023)
heartbeatInterval is currently 3s.

Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-20 08:46:37 -07:00
Mike O'Driscoll
118206ab79
prober: update header check test (#15993)
Use of the httptest client doesn't render header ordering
as expected.

Use http.DefaultClient for the test to ensure that
the header ordering test is valid.

Updates tailscale/corp#27370

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-05-20 09:45:12 -04:00
Irbe Krumina
c4fb380f3c
cmd/k8s-operator: fix Tailscale Service API errors check (#16020)
Updates tailscale/tailscale#15895

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-20 11:30:45 +01:00
Jordan Whited
3cc80cce6a
wgengine/magicsock: introduce virtualNetworkID type (#16021)
This type improves code clarity and reduces the chance of heap alloc as
we pass it as a non-pointer. VNI being a 3-byte value enables us to
track set vs unset via the reserved/unused byte.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-19 19:14:08 -07:00
Brad Fitzpatrick
30a89ad378 ipn/ipnlocal: make GetExt work earlier, before extension init
Taildrop wasn't working on iOS since #15971 because GetExt didn't work
until after init, but that PR moved Init until after Start.

This makes GetExt work before LocalBackend.Start (ExtensionHost.Init).

Updates #15812

Change-Id: I6e87257cd97a20f86083a746d39df223e5b6791b
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-19 15:36:25 -07:00
Brad Fitzpatrick
54970054a6 cmd/tailscale/cli: suggest using "tailscale set", not "up", to set operator
The same message was used for "up" and "down" permission failures, but
"set" works better for both. Suggesting "up --operator" for a "down"
permission failure was confusing.

It's not like the latter command works in one shot anyway.

Fixes #16008

Change-Id: I6e4225ef06ce2d8e19c40bece8104e254c2aa525
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-19 12:21:10 -07:00
Jordan Whited
87a4f17883
wgengine/magicsock: fix pong handling 'EndpointChange' reporting (#16018)
Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-19 11:42:13 -07:00
Brad Fitzpatrick
8009ad74a3 cmd/derper, net/tlsdial: fix client's self-signed cert validation
This fixes the implementation and test from #15208 which apparently
never worked.

Ignore the metacert when counting the number of expected certs
presented.

And fix the test, pulling out the TLSConfig setup code into something
shared between the real cmd/derper and the test.

Fixes #15579

Change-Id: I90526e38e59f89b480629b415f00587b107de10a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-19 10:57:28 -07:00
Tom Meadows
b5770c81c9
cmd/k8s-operator: rename VIPService -> Tailscale Service in L3 HA Service Reconciler (#16014)
Also changes wording tests for L7 HA Reconciler

Updates #15895

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-05-19 16:33:34 +01:00
Tom Meadows
7fe27496c8
cmd/k8s-operator: warn if HA Service is applied, but VIPService feature flag is not enabled (#16013)
Updates #15895

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-05-19 14:34:44 +01:00
Tom Meadows
df8d51023e
cmd/k8s-operator,kube/kubetypes,k8s-operator/apis: reconcile L3 HA Services (#15961)
This reconciler allows users to make applications highly available at L3 by
leveraging Tailscale Virtual Services. Many Kubernetes Service's
(irrespective of the cluster they reside in) can be mapped to a
Tailscale Virtual Service, allowing access to these Services at L3.

Updates #15895

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-05-19 12:58:32 +01:00
Tom Proctor
d89aa29081
{cmd,}/k8s-operator: support IRSA for Recorder resources (#15913)
Adds Recorder fields to configure the name and annotations of the ServiceAccount
created for and used by its associated StatefulSet. This allows the created Pod
to authenticate with AWS without requiring a Secret with static credentials,
using AWS' IAM Roles for Service Accounts feature, documented here:
https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html

Fixes #15875

Change-Id: Ib0e15c0dbc357efa4be260e9ae5077bacdcb264f
Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-05-19 11:35:05 +01:00
Irbe Krumina
6b97e615d6
cmd/containerboot,kube/ingressservices: proxy VIPService TCP/UDP traffic to cluster Services (#15897)
cmd/containerboot,kube/ingressservices: proxy VIPService TCP/UDP traffic to cluster Services

This PR is part of the work to implement HA for Kubernetes Operator's
network layer proxy.
Adds logic to containerboot to monitor mounted ingress firewall configuration rules
and update iptables/nftables rules as the config changes.
Also adds new shared types for the ingress configuration.
The implementation is intentionally similar to that for HA for egress proxy.

Updates tailscale/tailscale#15895

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-19 10:42:03 +01:00
Jordan Whited
469fabd8de
wgengine/magicsock: add missing logf arg (#15995)
Also, add the short version of the node key in parens to match existing
patterns.

Updates #cleanup

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-16 16:12:59 -07:00
Jordan Whited
6de4a021bb
wgengine/magicsock: implement relayManager handshaking (#15977)
CallMeMaybeVia reception and endpoint allocation have been collapsed to
a single event channel. discoInfo caching for active relay handshakes
is now implemented.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-16 13:51:40 -07:00
Mike O'Driscoll
9c52856af6
prober: correct content-type response (#15989)
Content-type was responding as test/plain for probes
accepting application/json. Set content type header
before setting the response code to correct this.

Updates tailscale/corp#27370

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-05-16 12:51:07 -04:00
Patrick O'Doherty
336b3b7df0
cmd/proxy-to-grafana: strip X-Webauth* headers from all requests (#15985)
Update proxy-to-grafana to strip any X-Webauth prefixed headers passed
by the client in *every* request, not just those to /login.

/api/ routes will also accept these headers to authenticate users,
necessitating their removal to prevent forgery.

Updates tailscale/corp#28687

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-05-15 14:26:19 -07:00
Nick Khyl
824985afe1 feature/taildrop,ipn/ipn{ext,local}: initialize taildrop for initial profile
Currently, LocalBackend/ExtensionHost doesn't invoke the profile change callback for the initial profile.
Since the initial profile may vary depending on loaded extensions and applied policy settings,
it can't be reliably determined until all extensions are initialized. Additionally, some extensions
may asynchronously trigger a switch to the "best" profile (based on system state and policy settings) during
initialization.

We intended to address these issues as part of the ongoing profileManager/LocalBackend refactoring,
but the changes didn't land in time for the v1.84 release and the Taildrop refactoring.

In this PR, we update the Taildrop extension to retrieve the current profile at initialization time
and handle it as a profile change.

We also defer extension initialization until LocalBackend has started, since the Taildrop extension
already relies on this behavior (e.g., it requires clients to call SetDirectFileRoot before Init).

Fixes #15970
Updates #15812
Updates tailscale/corp#28449

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-14 17:58:16 -05:00
Brad Fitzpatrick
49a7685af9 feature/taildrop: add integration test variant with profiles that exist
Updates #15970
Updates #15812
Updates tailscale/corp#28449

Change-Id: I52cf25f98636b0beac16275f46e58d0816963895
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-14 13:37:06 -05:00
Irbe Krumina
abe04bfa78
cmd/k8s-operator: warn if Tailscale Services use attempted for tailnet without the feature enabled (#15931)
Also renames VIPService -> Tailscale Service (including user facing messages)

Updates tailscale/corp#24795

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-14 18:25:08 +01:00
Mike O'Driscoll
fccba5a2f1
prober: fix test logic (#15952)
Catch failing tests that have no expected error string.

Updates #15912

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-05-13 09:19:18 -04:00
Anton Tolchanov
65e005ccaa ipn/ipnlocal: attach Tailnet Lock status to bugreports
Fixes tailscale/corp#28524

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-05-13 11:34:43 +01:00
Nick Khyl
ffb1dda245 ipn/ipnlocal,wgengine: move (*tsdial.Dialer).SetRoutes() calls from LocalBackend to userspaceEngine
This avoids reconfiguring the dialer unless the router config has changed.

Updates #12027

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-12 20:51:08 -05:00
Simon Law
d303570ab7
docs/commit-messages.md: explain #cleanup commits (#15933)
Adapted from http://go/cleanup.

Fixes: #15932

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-05-12 16:23:36 -07:00
Simon Law
7f4aaed1d5
cmd/derpprobe: exit with non-zero status if --once fails (#15926)
`cmd/derpprobe --once` didn’t respect the convention of non-zero exit
status for a failed run. It would always exit zero (i.e. success),
even. This patch fixes that, but only for `--once` mode.

Fixes: #15925

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-05-12 12:53:55 -07:00
Aaron Klotz
13e91f4a2f docs/windows/policy: add OnboardingFlow policy to ADMX file
Fixes #15907

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-05-12 12:39:44 -06:00
Nick Khyl
fb188c5b53 net/dns,docs/windows/policy,util/syspolicy: register Tailscale IP addresses in AD DNS if required by policy
In this PR, we make DNS registration behavior configurable via the EnableDNSRegistration policy setting.
We keep the default behavior unchanged, but allow admins to either enforce DNS registration and dynamic
DNS updates for the Tailscale interface, or prevent Tailscale from modifying the settings configured in
the network adapter's properties or by other means.

Updates #14917

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-12 11:31:12 -05:00