2276 Commits

Author SHA1 Message Date
chaosinthecrd
3390013b09
cmd/k8s-operator: add event filter that checks for a ProxyGroup annotation on Ingresses and Services
Adds an event filter on the service-pg-reconciler and ingress-pg-reconciler to only reconcile when the resource
in question has a ProxyGroup annotation. This was added after errors were being thrown on the ingress-pg-reconciler
while testing an Ingress without a ProxyGroup annotation.

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-06-24 19:29:29 +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
Mike O'Driscoll
e72c528a5f
cmd/{derp,derpprobe},prober,derp: add mesh support to derpprobe (#15414)
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-06-10 15:29:42 -04:00
Anton Tolchanov
db34cdcfe7 cmd/tailscale/cli: add a risk message about rp_filter
We already present a health warning about this, but it is easy to miss
on a server when blackholing traffic makes it unreachable.

In addition to a health warning, present a risk message when exit node
is enabled.

Example:

```
$ tailscale up --exit-node=lizard
The following issues on your machine will likely make usage of exit nodes impossible:
- interface "ens4" has strict reverse-path filtering enabled
- interface "tailscale0" has strict reverse-path filtering enabled
Please set rp_filter=2 instead of rp_filter=1; see https://github.com/tailscale/tailscale/issues/3310
To skip this warning, use --accept-risk=linux-strict-rp-filter
$
```

Updates #3310

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-06-10 07:38:06 +01:00
Tom Meadows
4456f77af7
cmd/k8s-operator: explicitly set tcp on VIPService port configuration for Ingress with ProxyGroup (#16199)
Updates tailscale/corp#24795

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
2025-06-09 11:13:03 +01:00
Fran Bull
3e08eab21e cmd/natc: use new on disk state store for consensus
Fixes #16027

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-06-05 13:37:48 -07:00
Fran Bull
486a55f0a9 cmd/natc: add optional consensus backend
Enable nat connector to be run on a cluster of machines for high
availability.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-06-04 08:15:47 -07:00
Raj Singh
5f0e139012
cmd/tsidp: add Docker image building support (#16078)
- Add tsidp target to build_docker.sh for standard Tailscale image builds

- Add publishdevtsidp Makefile target for development image publishing

- Remove Dockerfile, using standard build process

- Include tsidp in depaware dependency tracking

- Update README with comprehensive Docker usage examples

This enables tsidp to be built and published like other Tailscale components

(tailscale/tailscale, tailscale/k8s-operator, tailscale/k8s-nameserver).

Fixes #16077

Signed-off-by: Raj Singh <raj@tailscale.com>
2025-06-03 12:52:00 -04:00
Irbe Krumina
5b670eb3a5
cmd/containerboot: allow setting --accept-dns via TS_EXTRA_ARGS again (#16129)
In 1.84 we made 'tailscale set'/'tailscale up' error out if duplicate
command line flags are passed.
This broke some container configurations as we have two env vars that
can be used to set --accept-dns flag:
- TS_ACCEPT_DNS- specifically for --accept-dns
- TS_EXTRA_ARGS- accepts any arbitrary 'tailscale up'/'tailscale set'
flag.

We default TS_ACCEPT_DNS to false (to make the container behaviour more
declarative), which with the new restrictive CLI behaviour resulted in
failure for users who had set --accept-dns via TS_EXTRA_ARGS as the flag would be
provided twice.

This PR re-instates the previous behaviour by checking if TS_EXTRA_ARGS
contains --accept-dns flag and if so using its value to override TS_ACCEPT_DNS.

Updates tailscale/tailscale#16108

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2025-05-30 11:30:03 +01: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
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
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
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
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
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
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
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
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
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
Jordan Whited
0f4f808e70
wgengine/magicsock: re-shape relayManager to use an event loop (#15935)
The event loop removes the need for growing locking complexities and
synchronization. Now we simply use channels. The event loop only runs
while there is active work to do.

relayManager remains no-op inside magicsock for the time being.
endpoints are never 'relayCapable' and therefore endpoint & Conn will
not feed CallMeMaybeVia or allocation events into it.

A number of relayManager events remain unimplemented, e.g.
CallMeMaybeVia reception and relay handshaking.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-09 14:50:01 -07:00
Nick Khyl
a9be049c19 ipn/ipnlocal,net/dns/resolver: use the user dialer and routes for DNS forwarding by default, except on iOS and Android
In this PR, we make the "user-dial-routes" behavior default on all platforms except for iOS and Android.
It can be disabled by setting the TS_DNS_FORWARD_USE_ROUTES envknob to 0 or false.

Updates #12027
Updates #13837

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-09 16:43:01 -05:00
Jordan Whited
0841477743
net/udprelay{/endpoint}, all: move ServerEndpoint to independent pkg (#15934)
ServerEndpoint will be used within magicsock and potentially elsewhere,
which should be possible without needing to import the server
implementation itself.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-09 11:29:36 -07:00
Brad Fitzpatrick
165b99278b feature/taildrop, ipn/ipnlocal: remove leftover dup calls to osshare
I'd moved the osshare calls to feature/taildrop hooks, but forgot to
remove them from ipnlocal, or lost them during a rebase.

But then I noticed cmd/tailscaled also had some, so turn those into a
hook.

Updates #12614

Change-Id: I024fb1d27fbcc49c013158882ee5982c2737037d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-08 10:08:27 -07:00
Brad Fitzpatrick
48dacf1bf7 cmd/tailscale/cli: omit "file" subcommand if taildrop is omitted from build
Updates #15812
Updates #12614

Change-Id: Ic945b26a127ba15399abdaab8fe43b1cfa64d874
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 07:25:23 -07:00
Brad Fitzpatrick
7cc2837594 tsnet: don't depend on condregister & its default tailscaled features
None of them are applicable to the common tsnet use cases.

If somebody wants one of them, they can empty import it.

Updates #12614

Change-Id: I3d7f74b555eed22e05a09ad667e4572a5bc452d8
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 07:23:10 -07:00