summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2024-09-28Comparable struct as map keytomhjp/comparable-struct-as-keyTom Proctor3-18/+15
2024-09-27Code review feedbackIrbe Krumina5-59/+56
Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-20cmd/containerboot,kube,util/linuxfw: configure kube egress proxies to route ↵Irbe Krumina13-4/+1542
to 1+ tailnet targets This commit is first part of the work to allow running multiple replicas of the Kubernetes operator egress proxies per tailnet service + to allow exposing multiple tailnet services via each proxy replica. This expands the existing iptables/nftables-based proxy configuration mechanism. A proxy can now be configured to route to one or more tailnet targets via a (mounted) config file that, for each tailnet target, specifies: - the target's tailnet IP or FQDN - mappings of container ports to which cluster workloads will send traffic to tailnet target ports where the traffic should be forwarded. Example configfile contents: { "some-svc": {"tailnetTarget":{"fqdn":"foo.tailnetxyz.ts.net","ports"{"tcp:4006:80":{"protocol":"tcp","matchPort":4006,"targetPort":80},"tcp:4007:443":{"protocol":"tcp","matchPort":4007,"targetPort":443}}}} } A proxy that is configured with this config file will configure firewall rules to route cluster traffic to the tailnet targets. It will then watch the config file for updates as well as monitor relevant netmap updates and reconfigure firewall as needed. This adds a bunch of new iptables/nftables functionality to make it easier to dynamically update the firewall rules without needing to restart the proxy Pod as well as to make it easier to debug/understand the rules: - for iptables, each portmapping is a DNAT rule with a comment pointing at the 'service',i.e: -A PREROUTING ! -i tailscale0 -p tcp -m tcp --dport 4006 -m comment --comment "some-svc:tcp:4006 -> tcp:80" -j DNAT --to-destination 100.64.1.18:80 Additionally there is a SNAT rule for each tailnet target, to mask the source address. - for nftables, a separate prerouting chain is created for each tailnet target and all the portmapping rules are placed in that chain. This makes it easier to look up rules and delete services when no longer needed. (nftables allows hooking a custom chain to a prerouting hook, so no extra work is needed to ensure that the rules in the service chains are evaluated). The next steps will be to get the Kubernetes Operator to generate the configfile and ensure it is mounted to the relevant proxy nodes. Updates tailscale/tailscale#13406 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-19cmd/containerboot: split main.go (#13517)Tom Proctor7-744/+830
containerboot's main.go had grown to well over 1000 lines with lots of disparate bits of functionality. This commit is pure copy- paste to group related functionality outside of the main function into its own set of files. Everything is still in the main package to keep the diff incremental and reviewable. Updates #cleanup Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2024-09-18net/dns/resolver: fix dns-sd NXDOMAIN responses from quad-100James Tucker2-11/+77
mdnsResponder at least as of macOS Sequoia does not find NXDOMAIN responses to these dns-sd PTR queries acceptable unless they include the question section in the response. This was found debugging #13511, once we turned on additional diagnostic reporting from mdnsResponder we witnessed: ``` Received unacceptable 12-byte response from 100.100.100.100 over UDP via utun6/27 -- id: 0x7F41 (32577), flags: 0x8183 (R/Query, RD, RA, NXDomain), counts: 0/0/0/0, ``` If the response includes a question section, the resposnes are acceptable, e.g.: ``` Received acceptable 59-byte response from 8.8.8.8 over UDP via en0/17 -- id: 0x2E55 (11861), flags: 0x8183 (R/Query, RD, RA, NXDomain), counts: 1/0/0/0, ``` This may be contributing to an issue under diagnosis in #13511 wherein some combination of conditions results in mdnsResponder no longer answering DNS queries correctly to applications on the system for extended periods of time (multiple minutes), while dig against quad-100 provides correct responses for those same domains. If additional debug logging is enabled in mdnsResponder we see it reporting: ``` Penalizing server 100.100.100.100 for 60 seconds ``` It is also possible that the reason that macOS & iOS never "stopped spamming" these queries is that they have never been replied to with acceptable responses. It is not clear if this special case handling of dns-sd PTR queries was ever beneficial, and given this evidence may have always been harmful. If we subsequently observe that the queries settle down now that they have acceptable responses, we should remove these special cases - making upstream queries very occasionally isn't a lot of battery, so we should be better off having to maintain less special cases and avoid bugs of this class. Updates #2442 Updates #3025 Updates #3363 Updates #3594 Updates #13511 Signed-off-by: James Tucker <james@tailscale.com>
2024-09-18go/toolchain: use ed9dc37b2b000f376a3e819cbb159e2c17a2dac6 (#13507)Andrea Gottardo1-1/+1
Updates tailscale/tailscale#13452 Bump the Go toolchain to the latest to pick up changes required to not crash on Android 9/10. Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-09-17safeweb: add a ListenAndServe method to the Server type (#13498)M. J. Fromberger1-0/+13
Updates #13497 Change-Id: I398e9fa58ad0b9dc799ea280c9c7a32150150ee4 Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2024-09-17net/netcheck,wgengine/magicsock: plumb OnlyTCP443 controlknob through ↵Jordan Whited2-14/+22
netcheck (#13491) Updates tailscale/corp#17879 Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-17cmd/natc: fix nil pointerFran Bull1-0/+5
Fixes #13495 Signed-off-by: Fran Bull <fran@tailscale.com>
2024-09-16wgengine/magicsock: fix sendUDPStd docs (#13490)Jordan Whited1-1/+1
Updates #cleanup Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-16wgengine/magicsock: add side-effect-free function for netcheck UDP sends ↵Jordan Whited1-10/+22
(#13487) Updates #13484 Updates tailscale/corp#17879 Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-16derp: refactor DERP server's peer-gone watch mechanismBrad Fitzpatrick1-53/+97
In prep for upcoming flow tracking & mutex contention optimization changes, this change refactors (subjectively simplifying) how the DERP Server accounts for which peers have written to which other peers, to be able to send PeerGoneReasonDisconnected messages to writes to uncache their DRPO (DERP Return Path Optimization) routes. Notably, this removes the Server.sentTo field which was guarded by Server.mu and checked on all packet sends. Instead, the accounting is moved to each sclient's sendLoop goroutine and now only needs to acquire Server.mu for newly seen senders, the first time a peer sends a packet to that sclient. This change reduces the number of reasons to acquire Server.mu per-packet from two to one. Removing the last one is the subject of an upcoming change. Updates #3560 Updates #150 Change-Id: Id226216d6629d61254b6bfd532887534ac38586c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-16licenses: update license noticesLicense Updater4-55/+51
Signed-off-by: License Updater <noreply+license-updater@tailscale.com>
2024-09-16gokrazy, various: use point versions of Go and update Nix depsAndrew Dunham8-6/+14
This un-breaks vim-go (which doesn't understand "go 1.23") and allows the natlab tests to work in a Nix shell (by adding the "qemu-img" and "mkfs.ext4" binaries to the shell). These binaries are available even on macOS, as I'm testing on my M1 Max. Updates #13038 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I99f8521b5de93ea47dc33b099d5b243ffc1303da
2024-09-16wgengine/magicsock: disable raw disco by default; add envknob to enableAndrew Dunham4-12/+24
Updates #13140 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Ica85b2ac8ac7eab4ec5413b212f004aecc453279
2024-09-13{api.md,publicapi}: remove old API docs (#13468)Mario Minardi6-2880/+0
Now that we have our API docs hosted at https://tailscale.com/api we can remove the previous (and now outdated) markdown based docs. The top level api.md has been left with the only content being the redirect to the new docs. Updates #cleanup Signed-off-by: Mario Minardi <mario@tailscale.com>
2024-09-13wgengine/magicsock: remove redundant deadline from netcheck report call (#13395)Jordan Whited3-7/+25
netcheck.Client.GetReport() applies its own deadlines. This 2s deadline was causing GetReport() to never fall back to HTTPS/ICMP measurements as it was shorter than netcheck.stunProbeTimeout, leaving no time for fallbacks. Updates #13394 Updates #6187 Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-12tailcfg: add node attr for SSH environment variables (#13450)Mario Minardi1-0/+4
Add a node attr for enabling SSH environment variable handling logic. Updates https://github.com/tailscale/corp/issues/22775 Signed-off-by: Mario Minardi <mario@tailscale.com>
2024-09-12derp: add new concurrent server benchmarkBrad Fitzpatrick2-0/+68
In prep for reducing mutex contention on Server.mu. Updates #3560 Change-Id: Ie95e7c6dc9f4b64b6f79b3b2338f8cd86c688d98 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-12VERSION.txt: this is v1.75.0 (#13454)v1.75.0-prekari-ts1-1/+1
Signed-off-by: kari-ts <kari@tailscale.com>
2024-09-11util/slicesx: add FirstElementEqual and LastElementEqualBrad Fitzpatrick5-4/+45
And update a few callers as examples of motivation. (there are a couple others, but these are the ones where it's prettier) Updates #cleanup Change-Id: Ic8c5cb7af0a59c6e790a599136b591ebe16d38eb Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-11derp: unify server's clientSet interface into concrete typeBrad Fitzpatrick2-99/+169
73280595a8880bdca for #2751 added a "clientSet" interface to distinguish the two cases of a client being singly connected (the common case) vs tolerating multiple connections from the client at once. At the time (three years ago) it was kinda an experiment and we didn't know whether it'd stop the reconnect floods we saw from certain clients. It did. So this promotes it to a be first-class thing a bit, removing the interface. The old tests from 73280595a were invaluable in ensuring correctness while writing this change (they failed a bunch). But the real motivation for this change is that it'll permit a future optimization to add flow tracking for stats & performance where we don't contend on Server.mu for each packet sent via DERP. Instead, each client can track its active flows and hold on to a *clientSet and ask the clientSet per packet what the active client is via one atomic load rather than a mutex. And if the atomic load returns nil, we'll know we need to ask the server to see if they died and reconnected and got a new clientSet. But that's all coming later. Updates #3560 Change-Id: I9ccda3e5381226563b5ec171ceeacf5c210e1faf Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-11.github: enable fuzz testing again (go1.23)Maisem Ali1-1/+1
Updates #12912 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2024-09-11util/linuxfw: fall back to nftables when iptables not foundMaisem Ali2-1/+18
When the desired netfilter mode was unset, we would always try to use the `iptables` binary. In such cases if iptables was not found, tailscaled would just crash as seen in #13440. To work around this, in those cases check if the `iptables` binary even exists and if it doesn't fall back to the nftables implementation. Verified that it works on stock Ubuntu 24.04. Updates #5621 Updates #8555 Updates #8762 Fixes #13440 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2024-09-11cmd/k8s-operator,k8s-operator,kube: Add TSRecorder CRD + controller (#13299)Tom Proctor23-66/+5331
cmd/k8s-operator,k8s-operator,kube: Add TSRecorder CRD + controller Deploys tsrecorder images to the operator's cluster. S3 storage is configured via environment variables from a k8s Secret. Currently only supports a single tsrecorder replica, but I've tried to take early steps towards supporting multiple replicas by e.g. having a separate secret for auth and state storage. Example CR: ```yaml apiVersion: tailscale.com/v1alpha1 kind: Recorder metadata: name: rec spec: enableUI: true ``` Updates #13298 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2024-09-10ipnlocal,proxymap,wgengine/netstack: add optional WhoIs/proxymap debugBrad Fitzpatrick3-30/+68
Updates tailscale/corp#20600 Change-Id: I2bb17af0f40603ada1ba4cecc087443e00f9392a Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-10cmd/natc: fix nil pointerFran Bull1-0/+3
Fixes #13432 Signed-off-by: Fran Bull <fran@tailscale.com>
2024-09-10build(deps): bump ws from 8.14.2 to 8.17.1 in /client/web (#12524)dependabot[bot]1-3/+3
Bumps [ws](https://github.com/websockets/ws) from 8.14.2 to 8.17.1. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.14.2...8.17.1) --- updated-dependencies: - dependency-name: ws dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-10.github: Bump peter-evans/create-pull-request from 5.0.1 to 7.0.1 (#13419)dependabot[bot]2-2/+2
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.1 to 7.0.1. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/284f54f989303d2699d373481a0cfa13ad5a6666...8867c4aba1b742c39f8d0ba35429c2dfa4b6cb20) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-09cmd/stunstamp: add protocol context to timeout logs (#13422)Jordan Whited1-28/+15
We started out with a single protocol & port, now it's many. Updates #cleanup Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-09ipn/ipnlocal: don't program system DNS when node key is expired (#13370)Andrew Dunham3-4/+37
This mimics having Tailscale in the 'Stopped' state by programming an empty DNS configuration when the current node key is expired. Updates tailscale/support-escalations#55 Change-Id: I68ff4665761fb621ed57ebf879263c2f4b911610 Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
2024-09-09tsnet: remove old package doc experimental warningBrad Fitzpatrick1-2/+0
It was scaring people. It's been pretty stable for quite some time now and we're unlikely to change the API and break people at this point. We might, but have been trying not to. Fixes tailscale/corp#22933 Change-Id: I0c3c79b57ccac979693c62ba320643a940ac947e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-08kube,cmd/{k8s-operator,containerboot},envknob,ipn/store/kubestore,*/depaware ↵Irbe Krumina24-36/+36
.txt: rename packages (#13418) Rename kube/{types,client,api} -> kube/{kubetypes,kubeclient,kubeapi} so that we don't need to rename the package on each import to convey that it's kubernetes specific. Updates#cleanup Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-08kube,cmd/{k8s-operator,containerboot},envknob,ipn/store/kubestore,*/depaware ↵Irbe Krumina24-122/+143
.txt: split out kube types (#13417) Further split kube package into kube/{client,api,types}. This is so that consumers who only need constants/static types don't have to import the client and api bits. Updates#cleanup Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-08cmd/k8s-operator,kube: set app name for Kubernetes Operator proxies (#13410)Irbe Krumina17-17/+121
Updates tailscale/corp#22920 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-07net/dns: disable DNS registration for Tailscale interface on WindowsNick Khyl1-0/+3
We already disable dynamic updates by setting DisableDynamicUpdate to 1 for the Tailscale interface. However, this does not prevent non-dynamic DNS registration from happening when `ipconfig /registerdns` runs and in similar scenarios. Notably, dns/windowsManager.SetDNS runs `ipconfig /registerdns`, triggering DNS registration for all interfaces that do not explicitly disable it. In this PR, we update dns/windowsManager.disableDynamicUpdates to also set RegistrationEnabled to 0. Fixes #13411 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-09-07sessionrecording,ssh/tailssh,k8s-operator: log connected recorder address ↵Irbe Krumina3-8/+18
(#13382) Updates tailscale/corp#19821 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2024-09-06go.toolchain.rev: update to 1.23.1 (#13408)Patrick O'Doherty1-1/+1
Update Go toolchain to 1.23.1. Updates #cleanup Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2024-09-06go.mod: bump github.com/illarion/gonotify/v2Brad Fitzpatrick2-3/+3
Updates #13359 Change-Id: I28e048bf9d1d114d07d140f165f4ea89a82be79f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-05cmd/stunstamp: cleanup timeout and interval constants (#13393)Jordan Whited2-8/+17
Updates #cleanup Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-05ipn/ipnserver: remove IdleTimeoutNick Khyl1-10/+1
We no longer need this on Windows, and it was never required on other platforms. It just results in more short-lived connections unless we use HTTP/2. Updates tailscale/corp#18342 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-09-05cmd/systray: handle reconnects to IPN bus (#13386)Andrew Lytvynov1-3/+21
When tailscaled restarts and our watch connection goes down, we get stuck in an infinite loop printing `ipnbus error: EOF` (which ended up consuming all the disk space on my laptop via the log file). Instead, handle errors in `watchIPNBus` and reconnect after a short delay. Updates #1708 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2024-09-05go.mod.sri: update SRI hash for go.mod changesFlakes Updater3-3/+3
Signed-off-by: Flakes Updater <noreply+flakes-updater@tailscale.com>
2024-09-05net/tstun: probe TCP GRO (#13376)Jordan Whited7-32/+87
Disable TCP & UDP GRO if the probe fails. torvalds/linux@e269d79c7d35aa3808b1f3c1737d63dab504ddc8 broke virtio_net TCP & UDP GRO causing GRO writes to return EINVAL. The bug was then resolved later in torvalds/linux@89add40066f9ed9abe5f7f886fe5789ff7e0c50e. The offending commit was pulled into various LTS releases. Updates #13041 Signed-off-by: Jordan Whited <jordan@tailscale.com>
2024-09-05net/dns: fix IsZero and Equal methods on OSConfigAndrew Dunham3-1/+143
Discovered this while investigating the following issue; I think it's unrelated, but might as well fix it. Also, add a test helper for checking things that have an IsZero method using the reflect package. Updates tailscale/support-escalations#55 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I57b7adde43bcef9483763b561da173b4c35f49e2
2024-09-04health: fix magicsockReceiveFuncWarnable health clearingBrad Fitzpatrick1-1/+2
Fixes #13204 Change-Id: I7154cdabc9dc362dcc3221fd5a86e21f610bbff0 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-04all: use new Go 1.23 slices.Sorted moreBrad Fitzpatrick4-26/+9
Updates #12912 Change-Id: If1294e5bc7b5d3cf0067535ae10db75e8b988d8b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-04tka: truncate long rotation signature chainsAnton Tolchanov4-11/+221
When a rotation signature chain reaches a certain size, remove the oldest rotation signature from the chain before wrapping it in a new rotation signature. Since all previous rotation signatures are signed by the same wrapping pubkey (node's own tailnet lock key), the node can re-construct the chain, re-signing previous rotation signatures. This will satisfy the existing certificate validation logic. Updates #13185 Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2024-09-04cmd/tailscale/cli: use new Go 1.23 slices.SortedBrad Fitzpatrick1-7/+3
And a grammatical nit. Updates #12912 Change-Id: I9feae53beb4d28dfe98b583373e2e0a43c801fc4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-04control/controlclient,posture,util/syspolicy: use predefined syspolicy keys ↵Nick Khyl3-2/+10
instead of string literals With the upcoming syspolicy changes, it's imperative that all syspolicy keys are defined in the syspolicy package for proper registration. Otherwise, the corresponding policy settings will not be read. This updates a couple of places where we still use string literals rather than syspolicy consts. Updates #12687 Signed-off-by: Nick Khyl <nickk@tailscale.com>