7926 Commits

Author SHA1 Message Date
Jonathan Nobels
79ef5b32fe natlab: fix unixgram plumbing and add mac virtualization
Tweaked the unixgram plumbing to use the vm's remote
unix address for write operations.

Rudimentary macOS virtualization added which will spin
up a VM with some hardcoded config options that work with
natlabd's default settings in -dgram mode.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2024-08-02 12:00:41 -04:00
Brad Fitzpatrick
e6336fad18 add dgram mode for Hypervisor.Framework and VZFileHandleNetworkDeviceAttachment
Change-Id: I476b48fdf500699093f01ce353f9089ab3a9c08d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-31 14:42:35 -07:00
Brad Fitzpatrick
e971923a92 name NAT types, add constructors
Change-Id: Id558e763773e6efa700cfb7943b64c78bfffc4ed
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
0e9bbbebeb flesh out docs on WriteUDPPacketNoNAT
Change-Id: Id029726d22fe084d15b75510e37c2fcb453fd97d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
ae484da02e start to add NAT-PMP port mapping
Change-Id: Id8061ab8e907a9473f0931deebd6cabcd32deffc
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
40814eafb4 add gokrazy start script w/ qemu-system-x86_64 microvm
Change-Id: I85c4d155c63b03fea84976c7a906fcaf93f7fc53
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
ba5ada52ad add flag to demo hard-vs-easy quickly
Change-Id: I48945c0b84e7e863b71dd6bdf97cd41b3b1e81bb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
38aa2687ac make hard NAT work
Change-Id: Id7b4195639c7fbff17c5b52e3780a1fdbcefbd31
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
92c3a4ce9a add start of Easy NAT impl
untested so far

Change-Id: Id5a265693d77a4552342c08e643e4a7ed5545e6a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
c188795156 start to write down some TODOs in case I forget
Change-Id: I1cebc9c11e63892e0fe829e3f2949696b97955ac
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
cda2300682 add start of Hard NAT impl
untested so far

Change-Id: I682b604d0e90debf9eae3f1814663f336d03f57c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
bebfa254cf change, document NATTable locking rules
Change-Id: I4f01343911102f5acf16ca6d5eb39ec98a5f2478
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
0f2ecf8a18 start of pluggable NAT impl types
Change-Id: I633bce41e978f385eab26478baa42e56178c489a
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
1071dc5d4d add a second network
Change-Id: I0337e2f7c2402384c00ff81e7ec7614168c4fe5b
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
95da5023fc support proxying to real DERPs, for testing
Change-Id: I27da972ed6c37188b2de17e3d9287410eace73e4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
3ebc3495e7 add UDPPacket, NAT, routing abstractions, move/redo STUN
It's starting to come alive!

Change-Id: Iffa853eaab6da001d5c0935e45d3b47baf7211a6
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:34 -07:00
Brad Fitzpatrick
e617cf5af8 start to handle L2 vs L3 properly
Change-Id: I0efc9320aff419dc4b3e97c623c9af7f9d5dd48a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
c860129eb0 add EthernetPacket, network.HandleEthernetPacket
Change-Id: I9b9f471c8fcc49ea16d732fe3ce06d5be4ff1125
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
013ea64e94 move more to network, hardcode less
Change-Id: If1c773153f7f3fa7ea483d1b7231193ab093278a
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
87f777d21b start on declarative world config, not hard coding things
Change-Id: I76afccc50311f0894fbda4064ff0dd9696ef820e
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
9f63076827 STUN
Change-Id: I77eacb007d7fd315d165f14be2d2ecd892900843
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
8070c8d1d5 proxy controlplane so netcheck can get derpmap
Change-Id: Iecef62dc6f3904f588597e3134429b1521e9fe10
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
c0581779ed start of TCP netstack interception
Change-Id: I5523f8d45e34ac8074a55a67b3d3fd978bd7de44
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
13110cc11e DNS
Change-Id: Icabbdbf4810e2b4ac5ebe17550c8fdb344ebaaa4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
4c4d8cb4b8 DHCP and ARP
Change-Id: Id0a8bfd7047253562cd800ff4e3c75154fa773a8
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
7abee8aee6 packets
Change-Id: If385bb5f88ff7db9e388bd0724a1f953a3b11639
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
58fe931bca vnet: WIP
Change-Id: Id26b5ea0a1ec21dcc18e01aa4937351cfa49cd7c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:33 -07:00
Brad Fitzpatrick
2ab1d532e8 gokrazy/tsapp: add go.mod replacing two tailscale.com binaries with parent module
Updates #1866

Change-Id: I1ee7d41f7ee55806fb7ad94d0333dd0ec33d8efd
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 19:07:25 -07:00
Brad Fitzpatrick
360046e5c3 words: add some associated with scales
Updates tailscale/corp#14698

Change-Id: Ica7f179bd368d3c15f58fb236d377881cd80efcf
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-29 15:18:08 -07:00
Andrew Dunham
35a8fca379 cmd/tailscale/cli: release portmap after netcheck
Updates #12954

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ic14f037b48a79b1263b140c6699579b466d89310
2024-07-29 14:10:32 -04:00
Jonathan Nobels
19b0c8a024
net/dns, health: raise health warning for failing forwarded DNS queries (#12888)
updates tailscale/corp#21823

Misconfigured, broken, or blocked DNS will often present as
"internet is broken'" to the end user.  This  plumbs the health tracker
into the dns manager and forwarder and adds a health warning
with a 5 second delay that is raised on failures in the forwarder and
lowered on successes.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2024-07-29 13:48:46 -04:00
Percy Wegmann
3088c6105e go.mod: pull in latest github.com/tailscale/xnet
This picks up https://github.com/tailscale/xnet/pull/1 so that
clients can move files even when holding only a lock for the source
file.

Updates #12941

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-07-29 10:41:53 -05:00
Irbe Krumina
a21bf100f3
cmd/k8s-operator,k8s-operator/sessionrecording,sessionrecording,ssh/tailssh: refactor session recording functionality (#12945)
cmd/k8s-operator,k8s-operator/sessionrecording,sessionrecording,ssh/tailssh: refactor session recording functionality

Refactor SSH session recording functionality (mostly the bits related to
Kubernetes API server proxy 'kubectl exec' session recording):

- move the session recording bits used by both Tailscale SSH
and the Kubernetes API server proxy into a shared sessionrecording package,
to avoid having the operator to import ssh/tailssh

- move the Kubernetes API server proxy session recording functionality
into a k8s-operator/sessionrecording package, add some abstractions
in preparation for adding support for a second streaming protocol (WebSockets)

Updates tailscale/corp#19821

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-07-29 13:57:11 +01:00
Paul Scott
1bf7ed0348
tsweb: add QuietLogging option (#12838)
Allows the use of tsweb.LogHandler exclusively for callbacks describing the
handler HTTP requests.

Fixes #12837

Signed-off-by: Paul Scott <paul@tailscale.com>
2024-07-29 13:53:01 +01:00
Irbe Krumina
c5623e0471
go.{mod,sum},tstest/tools,k8s-operator,cmd/k8s-operator: autogenerate CRD API docs (#12884)
Re-instates the functionality that generates CRD API docs, but using
a different library as the one we were using earlier seemed to have
some issues with its Git history.
Also regenerates the docs (make kube-generate-all).

Updates tailscale/tailscale#12859

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-07-29 11:50:27 +01:00
Ross Williams
1bf82ddf84 util/osuser: run getent on non-Linux Unixes
Remove the restriction that getent is skipped on non-Linux unixes.
Improve validation of the parsed output from getent, in case unknown
systems return unusable information.

Fixes #12730.

Signed-off-by: Ross Williams <ross@ross-williams.net>
2024-07-26 14:25:46 -07:00
Andrea Gottardo
6840f471c0
net/dnsfallback: set CanPort80 in static DERPMap (#12929)
Updates tailscale/corp#21949

As discussed with @raggi, this PR updates the static DERPMap embedded in the client to reflect the availability of HTTP on the DERP servers run by Tailscale.

Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-07-26 13:04:12 -07:00
Andrea Gottardo
90be06bd5b
health: introduce captive-portal-detected Warnable (#12707)
Updates tailscale/tailscale#1634

This PR introduces a new `captive-portal-detected` Warnable which is set to an unhealthy state whenever a captive portal is detected on the local network, preventing Tailscale from connecting.



ipn/ipnlocal: fix captive portal loop shutdown


Change-Id: I7cafdbce68463a16260091bcec1741501a070c95

net/captivedetection: fix mutex misuse

ipn/ipnlocal: ensure that we don't fail to start the timer


Change-Id: I3e43fb19264d793e8707c5031c0898e48e3e7465

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-07-26 11:25:55 -07:00
Brad Fitzpatrick
cf97cff33b wgengine/netstack: simplify netaddrIPFromNetstackIP
Updates #cleanup

Change-Id: I66878b08a75d44170460cbf33c895277c187bd8d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-25 20:05:16 -07:00
Paul Scott
855da47777
tsweb: Add MiddlewareStack func to apply lists of Middleware (#12907)
Fixes #12909

Signed-off-by: Paul Scott <paul@tailscale.com>
2024-07-25 14:20:17 +01:00
Nick Khyl
43375c6efb types/lazy: re-init SyncValue during test cleanup if it wasn't set before SetForTest
Updates #12687

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-24 11:47:58 -05:00
Paul Scott
ba7f2d129e
tsweb: log all cancellations as 499s (#12894)
Updates #12141

Signed-off-by: Paul Scott <paul@tailscale.com>
2024-07-24 08:58:06 +01:00
Irbe Krumina
57856fc0d5
ipn,wgengine/magicsock: allow setting static node endpoints via tailscaled configfile (#12882)
wgengine/magicsock,ipn: allow setting static node endpoints via tailscaled config file.

Adds a new StaticEndpoints field to tailscaled config
that can be used to statically configure the endpoints
that the node advertizes. This field will replace
TS_DEBUG_PRETENDPOINTS env var that can be used to achieve the same.

Additionally adds some functionality that ensures that endpoints
are updated when configfile is reloaded.

Also, refactor configuring/reconfiguring components to use the
same functionality when configfile is parsed the first time or
subsequent times (after reload). Previously a configfile reload
did not result in resetting of prefs. Now it does- but does not yet
tell the relevant components to consume the new prefs. This is to
be done in a follow-up.

Updates tailscale/tailscale#12578


Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-07-23 16:50:55 +01:00
License Updater
9904421853 licenses: update license notices
Signed-off-by: License Updater <noreply+license-updater@tailscale.com>
2024-07-22 14:50:50 -07:00
Nick Khyl
5d09649b0b types/lazy: add (*SyncValue[T]).SetForTest method
It is sometimes necessary to change a global lazy.SyncValue for the duration of a test. This PR adds a (*SyncValue[T]).SetForTest method to facilitate that.

Updates #12687

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-22 15:10:31 -05:00
Nick Khyl
d500a92926 util/slicesx: add HasPrefix, HasSuffix, CutPrefix, and CutSuffix functions
The standard library includes these for strings and byte slices,
but it lacks similar functions for generic slices of comparable types.
Although they are not as commonly used, these functions are useful
in scenarios such as working with field index sequences (i.e., []int)
via reflection.

Updates #12687

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-22 11:03:46 -05:00
Flakes Updater
1f94047475 go.mod.sri: update SRI hash for go.mod changes
Signed-off-by: Flakes Updater <noreply+flakes-updater@tailscale.com>
2024-07-21 14:29:01 -07:00
Nick Khyl
bd54b61746 types/opt: add (Value[T]).GetOr(def T) T method
Updates #12736

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-19 15:50:24 -05:00
Nick Khyl
20562a4fb9 cmd/viewer, types/views, util/codegen: add viewer support for custom container types
This adds support for container-like types such as Container[T] that
don't explicitly specify a view type for T. Instead, a package implementing
a container type should also implement and export a ContainerView[T, V] type
and a ContainerViewOf(*Container[T]) ContainerView[T, V] function, which
returns a view for the specified container, inferring the element view type V
from the element type T.

Updates #12736

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-07-19 12:50:39 -05:00
Andrew Lytvynov
e7bf6e716b
cmd/tailscale: add --min-validity flag to the cert command (#12822)
Some users run "tailscale cert" in a cron job to renew their
certificates on disk. The time until the next cron job run may be long
enough for the old cert to expire with our default heristics.

Add a `--min-validity` flag which ensures that the returned cert is
valid for at least the provided duration (unless it's longer than the
cert lifetime set by Let's Encrypt).

Updates #8725

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2024-07-19 09:35:22 -07:00