The easiest, most secure way to use WireGuard and 2FA.
Go to file
Brad Fitzpatrick 66af25733c tstest/natlab/vmtest, client/web: add web client integration tests
Adds two Gokrazy-based vmtests covering the tailscaled web client at
port 5252:

* TestWebClientLocalAccess enables the web client on a single node
  and exercises the canonical owner session flow against the node's
  own Tailscale IP: an unauthenticated GET /api/auth that identifies
  the caller, a GET /api/auth/session/new that issues a
  TS-Web-Session cookie, and a final GET /api/auth that reports
  authorized=true with the cookie.

* TestWebClientRemoteAccess runs the same session flow from a peer
  node on the same tailnet against a second target node's web
  client, exercising netstack interception of incoming :5252
  traffic, cross-node WhoIs, and the same-user "owner" path. It
  then flips the test control server's AllNodesSameUser off,
  re-logs in the client under a fresh identity, and asserts that
  GET /api/auth/session/new returns 401 with body "not-owner" --
  exercising the cross-user rejection in client/web/auth.go.

To make the natlab test environment exercise the same code path
as production (check mode, where the web client posts to
/machine/webclient/init via Noise and waits on a control-issued
auth URL), this also:

* Allowlists the natlab fake control hostname "control.tailscale"
  in client/web/auth.go's controlSupportsCheckMode so the web
  client follows the check-mode branch rather than the
  no-check-mode shortcut that immediately marks new sessions
  authenticated.

* Adds /machine/webclient/{init,wait} handlers to testcontrol.
  init returns a placeholder auth ID and URL; wait returns
  Complete=true immediately, so the web client's awaitUserAuth
  resolves on its first call. Together these let the tests drive
  the full check-mode session lifecycle without a real
  browser-click loop.

To support the multi-request HTTP flows from the test harness,
this also adds:

* vmtest.Env.HTTPGetStatus, a sister of HTTPGet that returns the
  upstream status code, body, and Set-Cookie cookies (as a
  vmtest.HTTPResponse) and accepts cookies on the outgoing
  request, so tests can drive flows that depend on cookie
  continuity.

* Cookie pass-through in cmd/tta's /http-get handler: it forwards
  the Cookie request header upstream and surfaces upstream
  Set-Cookie response headers downstream. This is what lets
  HTTPGetStatus carry a session cookie across requests.

Previously the only tests of the web client were in-process
httptest-based handler tests in client/web/web_test.go; nothing
exercised the actual port 5252 listener wiring, the cross-node
auth path, cookie-driven session state transitions through the
check-mode control round-trip, or the not-owner rejection end
to end.

Updates #13038

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: Idb01486a89b53ac02c6ad3358bcfcceca90dbc36
2026-06-30 06:55:12 -07:00
.bencher bencher: add config to suppress failures on benchmark regressions. 2021-10-01 16:16:02 -07:00
.github .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
appc appc,feature/conn25: use custom scheme resolvers for conn25 2026-05-29 12:23:47 -07:00
atomicfile all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
chirp all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
client tstest/natlab/vmtest, client/web: add web client integration tests 2026-06-30 06:55:12 -07:00
clientupdate gokrazy, clientupdate: add start of Gokrazy auto-updates, tests 2026-06-04 11:20:14 -07:00
cmd tstest/natlab/vmtest, client/web: add web client integration tests 2026-06-30 06:55:12 -07:00
control Revert "control/controlclient: continue map poll during key expiry to receive extensions" (#20257) 2026-06-25 15:24:12 -07:00
derp derp/derphttp: drop dial-only proxy port test 2026-05-31 19:22:11 -07:00
disco disco: remove experimental label from BindUDPRelayHandshakeState 2026-03-24 11:04:11 -07:00
docs misc: rename install-git-hooks.go to add-git-hooks.go (#20144) 2026-06-15 12:08:19 -04:00
doctor all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
drive ipn/ipnlocal, drive: stop using netmap.NetworkMap in Taildrive too 2026-06-23 10:41:50 -07:00
envknob envknob/logknob: remove unused package (#19515) 2026-04-24 15:48:06 -07:00
feature ipn/ipnlocal, feature/conn25: add hook for accepting PeerAPI DNS 2026-06-29 16:33:33 -04:00
gokrazy gokrazy: add two arm64 variants for Pi & VMs 2026-06-04 14:05:23 -07:00
health all: don't repeat the the word "the" unnecessarily 2026-06-18 16:32:08 +01:00
hostinfo all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
internal .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
ipn ipn/ipnlocal: sort profiles by date created when possible (#20223) 2026-06-30 09:01:32 -04:00
jsondb all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
k8s-operator cmd/{containerboot,k8s-operator}: add 4via6 support in singleton egress (#19983) 2026-06-18 16:13:10 +01:00
kube kube/certs: widen runCertLoop per-call timeout to 30m (#20289) 2026-06-30 13:39:50 +01:00
licenses licenses: update license notices 2026-06-19 09:45:02 -07:00
log cmd/tailscale/cli: fix time in tailscale routecheck (#19956) 2026-06-01 16:12:08 -07:00
logpolicy logpolicy,tsnet: remove syspolicy dependency 2026-06-05 16:21:27 -05:00
logtail all: don't repeat the the word "the" unnecessarily 2026-06-18 16:32:08 +01:00
metrics cmd/vet/lowerell, drive/driveimpl: forbid variables named "l" or "I" 2026-05-04 14:03:28 -07:00
misc misc: rename install-git-hooks.go to add-git-hooks.go (#20144) 2026-06-15 12:08:19 -04:00
net tailcfg,net/routecheck: add NodeAttrClientSideReachabilityRouteCheck (#20169) 2026-06-25 18:22:15 -07:00
omit all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
packages/deb all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
paths all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
portlist portlist: also tb.Skip benchmarks (not just tests) on bad Linux kernels 2026-02-12 13:19:09 -08:00
posture posture: add HealthTracker for serial number retrieval (#19181) 2026-04-25 15:42:47 -03:00
prober prober: deflake TestHTTPBandwidth 2026-06-23 08:35:57 -07:00
proxymap all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
release release/dist/synology: add GOARM=7,softfloat mode for hi3535 2026-05-27 10:54:15 -07:00
safesocket safesocket, ipn/ipnserver: use PeerCreds on solaris and illumos 2026-03-23 07:45:35 -07:00
safeweb all: don't repeat the the word "the" unnecessarily 2026-06-18 16:32:08 +01:00
scripts scripts/installer.sh: update KDE Linux link (#19857) 2026-05-24 21:40:42 +01:00
sessionrecording sessionrecording: close idle connections after upload 2026-06-19 13:42:14 +01:00
ssh/tailssh ssh/tailssh: dissallow purely numeric usernames for SSH 2026-06-11 17:52:51 -06:00
syncs cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
tailcfg tailcfg,net/routecheck: add NodeAttrClientSideReachabilityRouteCheck (#20169) 2026-06-25 18:22:15 -07:00
tempfork misc/genreadme,tempfork/pkgdoc,tsnet: generate README.md files from godoc 2026-04-22 15:13:09 -07:00
tka tka: use a named constant to tidy up sig_test.go 2026-06-11 10:37:48 +01:00
tool tool/gocross: retry downloading Go three times 2026-06-26 11:12:54 +01:00
tsconsensus all: migrate code off Notify.NetMap to Notify.SelfChange 2026-05-01 06:51:40 -07:00
tsconst ipn/ipnlocal, cmd/tailscale/cli: auto-renew TLS certs and warn while pending 2026-06-01 16:31:54 -07:00
tsd ipn/ipnlocal,tsd: add NoiseRoundTripper to tsd.Sys 2026-05-13 14:56:28 -07:00
tsnet ipn/ipnlocal, feature/acme: move most remaining cert code into feature/acme 2026-06-29 12:57:22 -07:00
tstest tstest/natlab/vmtest, client/web: add web client integration tests 2026-06-30 06:55:12 -07:00
tstime cmd/tailscale/cli: fix time in tailscale routecheck (#19956) 2026-06-01 16:12:08 -07:00
tsweb cmd/tailscale/cli: fix time in tailscale routecheck (#19956) 2026-06-01 16:12:08 -07:00
types ipn: remove the last traces of Prefs.AllowSingleHosts 2026-06-26 15:31:38 +01:00
util util/cmpver: add a test for comparing three-digit versions 2026-06-25 10:02:50 +01:00
version cmd/tailscaled, version/distro: default to userspace-networking on Crostini 2026-06-01 17:40:07 -07:00
wf wf: allow limited broadcast to/from permitted interfaces when using an exit node on Windows 2026-01-23 18:30:38 -06:00
wgengine wgengine/magicsock: fix data race in TestNetworkSendErrors (#20261) 2026-06-29 09:38:07 -07:00
wif wif: add AWS ecs for autogenerated OIDC tokens 2026-03-25 14:41:41 -06:00
words words: add "cat" to scales.txt (#20106) 2026-06-12 12:48:53 +01:00
.gitattributes .gitattributes: explicitly mark text files as such with eol 2026-06-23 13:04:07 -07:00
.gitignore .gitignore: explicitly include tool/go.exe 2026-04-13 18:44:59 -07:00
.golangci.yml .golangci.yml: enforce gliderssh import alias via importas linter 2026-04-07 11:59:38 +01:00
.policy-tests.yml .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
.policy.yml .policy.yml: tweak policy after testing 2026-06-26 12:28:02 -07:00
.stignore Add .stignore for syncthing (#18540) 2026-01-27 16:15:17 -08:00
ALPINE.txt docker: bump alpine v3.19 -> 3.22 (#17155) 2025-09-17 20:22:24 +01:00
api.md {api.md,publicapi}: remove old API docs (#13468) 2024-09-13 14:10:33 -06:00
assert_ts_toolchain_match.go .: permit running binary built with TS_GO_NEXT=1 2026-02-23 09:37:04 -08:00
build_dist.sh Add --strip option to build_dist 2026-06-02 10:59:29 -07:00
build_docker.sh docker: add riscv64 to container image architectures 2026-03-29 07:47:39 -07:00
cache_key_test.go util/cibuild, cache_key_test: skip TestTsgoRevInCacheKey outside Tailscale CI 2026-05-14 15:55:05 -07:00
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md: update code of conduct 2025-10-28 08:58:00 -07:00
CODEOWNERS CODEOWNERS,.policy.yml: replace CODEOWNERS with a policy-bot policy 2026-06-26 10:30:59 -07:00
Dockerfile go.toolchain.branch: switch to Go 1.26 2026-03-04 21:57:05 -08:00
Dockerfile.base all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
flake.lock nix: update flakes to get a nixpkgs version with go 1.26 2026-03-06 04:06:57 -08:00
flake.nix .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
flakehashes.json .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
go.mod .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
go.sum .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
go.toolchain.branch go.toolchain.branch: switch to Go 1.26 2026-03-04 21:57:05 -08:00
go.toolchain.next.branch tool/gocross, pull-toolchain.sh: support a "next" Go toolchain 2026-01-27 14:07:35 -08:00
go.toolchain.next.rev go.toolchain.rev: bump to Go 1.26.4 2026-06-03 10:24:00 -06:00
go.toolchain.rev go.toolchain.rev: bump to Go 1.26.4 2026-06-03 10:24:00 -06:00
go.toolchain.version go.toolchain.rev: bump to Go 1.26.4 2026-06-03 10:24:00 -06:00
gomod_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
header.txt all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
LICENSE all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
license_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
Makefile tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
PATENTS Move Linux client & common packages into a public repo. 2020-02-09 09:32:57 -08:00
pkgdoc_test.go cmd/vet/lowerell, drive/driveimpl: forbid variables named "l" or "I" 2026-05-04 14:03:28 -07:00
pull-toolchain.sh tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
README.md README: update the version of Go in the README (#19168) 2026-03-28 22:21:41 -03:00
SECURITY.md Add a SECURITY.md for vulnerability reports. 2020-02-11 10:26:41 -08:00
shell.nix .github,.policy-tests.yml: test .policy.yml in CI 2026-06-26 15:55:15 -07:00
staticcheck.conf all: cleanup unused code, part 2 (#10670) 2023-12-21 17:40:03 -08:00
version_tailscale_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
version_test.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
version-embed.go cmd/printdep: add --next flag to use rc Go build hash instead 2026-01-27 14:49:56 -08:00
VERSION.txt VERSION.txt: this is v1.101.0 (#19992) 2026-06-03 15:40:23 -04:00

Tailscale

https://tailscale.com

Private WireGuard® networks made easy

Overview

This repository contains the majority of Tailscale's open source code. Notably, it includes the tailscaled daemon and the tailscale CLI tool. The tailscaled daemon runs on Linux, Windows, macOS, and to varying degrees on FreeBSD and OpenBSD. The Tailscale iOS and Android apps use this repo's code, but this repo doesn't contain the mobile GUI code.

Other Tailscale repos of note:

For background on which parts of Tailscale are open source and why, see https://tailscale.com/opensource/.

Using

We serve packages for a variety of distros and platforms at https://pkgs.tailscale.com.

Other clients

The macOS, iOS, and Windows clients use the code in this repository but additionally include small GUI wrappers. The GUI wrappers on non-open source platforms are themselves not open source.

Building

We always require the latest Go release, currently Go 1.26. (While we build releases with our Go fork, its use is not required.)

go install tailscale.com/cmd/tailscale{,d}

If you're packaging Tailscale for distribution, use build_dist.sh instead, to burn commit IDs and version info into the binaries:

./build_dist.sh tailscale.com/cmd/tailscale
./build_dist.sh tailscale.com/cmd/tailscaled

If your distro has conventions that preclude the use of build_dist.sh, please do the equivalent of what it does in your distro's way, so that bug reports contain useful version information.

Bugs

Please file any issues about this code or the hosted service on the issue tracker.

Contributing

PRs welcome! But please file bugs. Commit messages should reference bugs.

We require Developer Certificate of Origin Signed-off-by lines in commits.

See commit-messages.md (or skim git log) for our commit message style.

About Us

Tailscale is primarily developed by the people at https://github.com/orgs/tailscale/people. For other contributors, see:

WireGuard is a registered trademark of Jason A. Donenfeld.