9226 Commits

Author SHA1 Message Date
KevinLiang10
97f629c1b5 cmd/tailscale/cli: change parameter of IsTCPForwardingOnPort
This commit changes the dnsName string parameter for IsTCPForwardingOnPort to
svcName tailcfg.ServiceName. This change is made to reduce ambiguity when
a single service might have different dnsNames

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-27 17:58:44 -04:00
KevinLiang10
a6634ce2c4 cmd/tailscale/cli: flip bool condition
This commit fixes a previous bug added that throws error when serve funnel without service.
It should've been the opposite, which throws error when serve funnel with service.

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:25:03 -04:00
KevinLiang10
71fe9a9860 cmd/tailscale/cli: adjust parameter order and update output message
This commit updates the parameter order for IsTCPForwardingOnPort and SetWebHandler.
Also updated the message msgServiceIPNotAssigned to msgServiceWaitingApproval to adapt to
latest terminologies around services.

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
d40755be85 replace all assemble of host name for service with strings.Join
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
8d861680d2 replace IsServiceName with tailcfg.AsServiceName
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
ec35e6c1d8 some code simplification and add asServiceName
This commit cotains code simplification for IsServingHTTPS, SetWebHandler, SetTCPForwarding

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
59c86c90cd replace FindServiceConfig with map lookup
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
32cc03db20 change the cli input flag variable type
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
95d9777d4e add dnsName in error message
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
746ee23203 cmd/tailscale/cli: fix comment
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:41 -04:00
KevinLiang10
37fbba047b cmd/tailscale/cli: Add a test for addServiceToPrefs
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:40 -04:00
KevinLiang10
1ec61b9992 cmd/tailscale/cli: fix ai comments and fix a test
Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:40 -04:00
KevinLiang10
b8f2e27675 cmd/tailscale/cli: Add service flag to serve command
This commit adds the service flag to serve command which allows serving a service and add the service
to the advertisedServices field in prefs (What advertise command does that will be removed later).

When adding proxies, TCP proxies and WEB proxies work the same way as normal serve, just under a
different DNSname. There is a services specific L3 serving mode called Tun, can be set via --tun flag.
Serving a service is always in --bg mode. If --bg is explicitly set t o false, an error message will
be sent out. The restriction on proxy target being localhost or 127.0.0.1 also applies to services.

When removing proxies, TCP proxies can be removed with type and port flag and off argument. Web proxies
can be removed with type, port, setPath flag and off argument. To align with normal serve, when setPath
is not set, all handler under the hostport will be removed. When flags are not set but off argument was
passed by user, it will be a noop. Removing all config for a service will be available later with a new
subcommand clear.

Updates tailscale/corp#22954

Signed-off-by: KevinLiang10 <37811973+KevinLiang10@users.noreply.github.com>
2025-06-26 17:13:40 -04: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
Jordan Whited
31eebdb0f8
wgengine/magicsock: send CallMeMaybeVia for relay endpoints (#16360)
If we acted as the allocator we are responsible for signaling it to the
remote peer in a CallMeMaybeVia message over DERP.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-23 16:13:58 -07:00
Jordan Whited
a589863d61
feature/relayserver,net/udprelay,wgengine/magicsock: implement retry (#16347)
udprelay.Server is lazily initialized when the first request is received
over peerAPI. These early requests have a high chance of failure until
the first address discovery cycle has completed.

Return an ErrServerNotReady error until the first address discovery
cycle has completed, and plumb retry handling for this error all the
way back to the client in relayManager.

relayManager can now retry after a few seconds instead of waiting for
the next path discovery cycle, which could take another minute or
longer.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-23 15:50:43 -07:00
Jordan Whited
9288efe592
wgengine/magicsock: remove premature return in handshakeServerEndpoint (#16351)
Any return underneath this select case must belong to a type switch case.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-23 08:53:29 -07: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
b3e74367d8 tool: rename go.ps1 to go-win.ps1 for cmd.exe+Powershell compat
This tweaks the just-added ./tool/go.{cmd,ps1} port of ./tool/go for
Windows.

Otherwise in Windows Terminal in Powershell, running just ".\tool\go"
picks up go.ps1 before go.cmd, which means execution gets denied
without the cmd script's -ExecutionPolicy Bypass part letting it work.

This makes it work in both cmd.exe and in Powershell.

Updates tailscale/corp#28679

Change-Id: Iaf628a9fd6cb95670633b2dbdb635dfb8afaa006
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-22 22:05:01 -07:00
Jordan Whited
0905936c45
wgengine/magicsock: set Geneve header protocol for WireGuard (#16350)
Otherwise receives interpret as naked WireGuard.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-21 21:14:42 -07:00
Jordan Whited
61958f531c
wgengine/magicsock: set conn field in relayHandshakeDiscoMsgEvent (#16348)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-21 19:09:36 -07:00
Jordan Whited
e935a28a19
wgengine/magicsock: set rxDiscoMsgCh field in relayHandshakeWork (#16349)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-21 19:09:19 -07:00
Jordan Whited
cd9b9a8cad
wgengine/magicsock: fix relay endpoint allocation URL (#16344)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-20 19:23:52 -07:00
Jordan Whited
d3bb34c628
wgengine/magicsock: generate relay server set from tailnet policy (#16331)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-20 15:00:28 -07:00
Brad Fitzpatrick
12e92b1b08 tsconsensus: skipping slow non-applicable tests on Windows for now
Updates #16340

Change-Id: I61b0186295c095f99c5be81dc4dced5853025d35
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-20 10:42:15 -07:00
Brad Fitzpatrick
bb085cfa3e tool: add go toolchain wrapper for Windows
go.cmd lets you run just "./tool/go" on Windows the same as Linux/Darwin.

The batch script (go.md) then just invokes PowerShell which is more
powerful than batch.

I wanted this while debugging Windows CI performance by reproducing slow
tests on my local Windows laptop.

Updates tailscale/corp#28679

Change-Id: I6e520968da3cef3032091c1c4f4237f663cefcab
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-20 09:48:43 -07:00
Brad Fitzpatrick
ca06d944c5 .github/workflows: try running Windows jobs on bigger VMs
Updates tailscale/corp#28679

Change-Id: Iee3f3820d2d8308fff3494e300ad3939e3ed2598
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-20 06:11:55 -07: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
okunamayanad
5a52f80c4c docs: fix typo in commit-messages.md
Updates: #cleanup

Signed-off-by: okunamayanad <baran@okunamayanad.com>
2025-06-20 06:05:30 -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
a64ca7a5b4 tstest/tlstest: simplify, don't even bake in any keys
I earlier thought this saved a second of CPU even on a fast machine,
but I think when I was previously measuring, I still had a 4096 bit
RSA key being generated in the code I was measuring.

Measuring again for this, it's plenty fast.

Prep for using this package more, for derp, etc.

Updates #16315

Change-Id: I4c9008efa9aa88a3d65409d6ffd7b3807f4d75e9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-19 16:12:32 -07:00
Jordan Whited
583f740c0b
Revert "types/netmap,wgengine/magicsock: propagate CapVer to magicsock.endpoint (#16244)" (#16322)
This reverts commit 6a93b17c8cafc1d8e1c52e133511e52ed9086355.

The reverted commit added more complexity than it was worth at the
current stage. Handling delta CapVer changes requires extensive changes
to relayManager datastructures in order to also support delta updates of
relay servers.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-19 09:47:06 -07: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
Brad Fitzpatrick
ad0dfcb185 net/*: remove Windows exceptions for when Resolver.PreferGo didn't work
Resolver.PreferGo didn't used to work on Windows.

It was fixed in 2022, though. (https://github.com/golang/go/issues/33097)

Updates #5161

Change-Id: I4e1aeff220ebd6adc8a14f781664fa6a2068b48c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-18 10:45:20 -07:00
Jordan Whited
fcab50b276
ipn/ipnlocal,wgengine{/magicsock}: replace SetNetworkMap with eventbus (#16299)
Same with UpdateNetmapDelta.

Updates tailscale/corp#27502
Updates #15160

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-06-18 10:31:00 -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
Anton Tolchanov
a91fcc8813 ipn/ipnlocal: make pricing restriction message for Tailnet Lock clearer
Fixes tailscale/corp#24417

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-06-18 15:01:37 +01:00