* cmd/k8s-operator,k8s-operator: apply ProxyClass probes to PeerRelay pods
The ProxyClass livenessProbe and readinessProbe from #22461 were applied
only to ProxyGroups. A PeerRelay StatefulSet rolls with RollingUpdate, but
its Pods had no readiness probe, so a template change replaced every
relay within seconds and peers relaying through them fell back to DERP.
The probe helpers move from cmd/k8s-operator to the shared tailscaled
reconciler package, and ApplyProxyClass now applies them to the relay
container. ProxyGroups use the same code, unchanged. With a
readinessProbe set, a PeerRelay rollout waits for each new relay to be
Ready before it replaces the next one.
Fixes#22670
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Nurullah Morshed <[email protected]>
* k8s-operator: report a PeerRelay ProxyClass whose probes can't run
A ProxyGroup reports a ProxyClass that sets probes while its env turns
the /livez and /readyz endpoints off as invalid. A PeerRelay skipped the
probes without saying so.
The check moves to tailscaled.ValidateProbes, shared by both. A PeerRelay
whose ProxyClass fails it gets Ready=False with reason ProxyClassInvalid,
and nothing is created, as for its other invalid specs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Nurullah Morshed <[email protected]>
* k8s-operator/reconciler/tailscaled: rename probes subtest for tsvet
Updates #22670
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Nurullah Morshed <[email protected]>
---------
Signed-off-by: Nurullah Morshed <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Add MultiLabelMap metrics alongside derper_tls_request_version and
gauge_derper_tls_active_version to track post-quantum vs classic key
exchange usage across all HTTPS endpoints served by derper:
- derper_tls_request_key_exchange{pq,group} (counter)
- derper_tls_active_key_exchange{pq,group} (gauge)
The active gauge reuses hijackTrackingResponseWriter so hijacked
connections (DERP, WebSocket DERP, CONNECT) remain counted until closed.
Updates tailscale/corp#52720
Change-Id: Iea553ee6efd30907d3f719f7e5a7de3573b34533
Signed-off-by: James Tucker <[email protected]>
Track accepted and currently active DERP connections in Server.ExpVar by
transport ("http" vs "websocket"), post-quantum status ("true", "false",
or "none" when r.TLS is nil), and negotiated TLS key exchange group:
- derp_tls_accepts{transport,pq,group}
- derp_current_tls_connections{transport,pq,group}
Both derpserver.Handler and derpserver.AddWebSocketSupport inspect r.TLS
before handing off to Server.Accept (without retaining *http.Request on
hijacked goroutines) and decrement the active gauge when Accept returns.
Updates tailscale/corp#52720
Change-Id: I32bdb549c1218654df1f86e91b0217c5a169c566
Signed-off-by: James Tucker <[email protected]>
Add two clientmetric counters recording whether TLS DERP client
connections (both HTTPS upgrade and WebSocket paths where TLS state is
available) negotiated a post-quantum or classic key exchange:
- derphttp_connect_tls_pq
- derphttp_connect_tls_classic
Also propagate res.TLS from websocket.Dial in derphttp/websocket.go so
non-js WebSocket dials populate Client.tlsState and report PQ status.
Updates tailscale/corp#52720
Change-Id: Idcbc7fe4580e515632a4ade7a0bbfe9ae266e4f1
Signed-off-by: James Tucker <[email protected]>
Move post-quantum TLS key exchange classification from control/controlhttp
into net/tlsdial.IsPQCurve so DERP client and server metrics can share the
same classification. Also add net/tlsdial.CurveName to format tls.CurveID
values into bounded metric label strings.
Updates tailscale/corp#52720
Change-Id: Ibfdc787a4afe411364888d61fe2314a4589b4f73
Signed-off-by: James Tucker <[email protected]>
Add PeerStatus.LastProtocol, the protocol of the WireGuard session
last established with a peer. Unlike Protocol, it is kept after
the session ends. It is forgotten when the peer is removed or
its node key changes, and it is not persisted across tailscaled
restarts.
Use it for the hybrid-pq label in tailscale status --verbose and
on the web status page, so that the label no longer depends on
the session still being up.
Updates #22853
Updates tailscale/corp#50068
Updates tailscale/corp#52622
Signed-off-by: Nick Khyl <[email protected]>
Previously, the Noise control dialer preferred plaintext HTTP on port 80
and only fell back to HTTPS on port 443 for middlebox compatibility,
because Noise already encrypted the inner connection with X25519.
To protect control connections against near-term 256-bit ECC / quantum
concerns when the server supports stronger key exchange, without
sacrificing compatibility, dial in three staggered stages:
1. TLS 1.3 with post-quantum key exchange (hybrid ML-KEM), falling
back to P-384/P-521 (excluding 256-bit ECC curves X25519 and P-256)
2. Plaintext HTTP (Noise over HTTP), unless forceNoise443 is set
3. Default HTTPS using Go's default TLS settings (matching the
existing Tailscale HTTPS fallback)
Also adds clientmetric counters for the negotiated transport
(controlhttp_dial_pq_https, controlhttp_dial_p384_https,
controlhttp_dial_http, controlhttp_dial_classic_https) and a
TS_DISABLE_NOISE_PQ_HTTPS envknob to restore the legacy HTTP-first order.
Updates #21022
Updates tailscale/corp#52709
Change-Id: I9f1d264ee196a58e75857b4401be8185de4b3e3e
Signed-off-by: James Tucker <[email protected]>
The iptables and nftables cleanups didn't remove the connmark rules
from the mangle tables, so they were left behind by --cleanup and
after an unclean exit followed by a switch to another firewall mode.
AddConnmarkSaveRule created mangle/OUTPUT with type filter, which
iptables-nft can't add rules to. Create it with type route, as
iptables-nft does, and at startup delete the old filter-type chain
if nothing else uses it.
Updates #22363
Change-Id: I7b64e8e9894773f1dd88384c3339106603db15ae
Signed-off-by: Nikolaos Gkarlis <[email protected]>
Report in ipn.PeerState and ipnstate.PeerStatus whether the current
WireGuard session with a peer was established with a hybrid
post-quantum handshake, and print "hybrid-pq" for such peers
in tailscale status --verbose.
The value comes from wireguard-go's PeerSessionStateFunc,
which now carries it along with the session state.
Updates #22853
Updates tailscale/corp#50068
Updates tailscale/corp#52622
Signed-off-by: Nick Khyl <[email protected]>
Go 1.27 (crypto/mldsa, crypto/x509) and golang.org/x/crypto v0.59.0
already implement pure ML-DSA SSH host keys (ssh-mldsa-44, per
draft-sfluhrer-ssh-mldsa-08) and PKCS#8 private key serialization.
Filter host key specs against ssh.SupportedAlgorithms().HostKeys so
builds without ML-DSA support (such as GOFIPS140=v1.0.0) continue to
skip unsupported key types cleanly, and add mldsa44 host key
generation, system key lookup, and handshake/integration test coverage.
Updates #22864
Updates #22807
Change-Id: I191e62a9a3d439db0c999172b283d00d501e1bcc
Signed-off-by: James Tucker <[email protected]>
On macOS, launchd's sshd-keygen-wrapper recreates missing system host
keys on any TCP connection to port 22. tailssh preferred system keys
and re-read them on every connection, but only advertised its keys in
Hostinfo at startup or on prefs changes, so peers then failed host key
verification. Keep using host keys tailssh previously generated even
if system keys appear later, and load the keys once per process.
Fixestailscale/corp#52474
Change-Id: I3ab9d27ecb246b91d184700ca6aabbb366f11023
Signed-off-by: Brad Fitzpatrick <[email protected]>
proxy-test-server already imports golang.org/x/crypto/acme/autocert and
only uses acme.ALPNProto, so it does not need tailscale.com/tempfork/acme.
Updates #10238
Change-Id: Ife3b33e1ce3164cebeb75041238d04eb808490ba
Signed-off-by: James Tucker <[email protected]>
Upstream golang.org/x/crypto/acme gained issuance profile support in
v0.59.0 (golang/go#73101), so cmd/derper no longer needs
tailscale.com/tempfork/acme. Switch ipcert.go to upstream
golang.org/x/crypto/acme using acme.WithOrderIssuanceProfile.
Also switch from CreateOrderCert to CreateCertFromOrder so order
finalization does not depend on the optional Location header in the
finalize response.
Updates #10238
Updates #22654
Change-Id: I28b4ed7f0af5e496fcc9e56ea9cd1112bbe19bb0
Signed-off-by: James Tucker <[email protected]>
We want to measure the relative availability of each port mapping
protocol in the wild in order to more effectively prioritize
work in this area. This weighs active devices more heavily.
Updates tailscale/corp#51202
Change-Id: Iea5908cc3108e602256a9a7bd73c89ec5e3e10ff
Signed-off-by: Francois Marier <[email protected]>
A full netmap from control produced up to five separate ipn.Notify
messages: LoginFinished, the login prefs, the self node and peers, the
exit node suggestion, and the re-resolved exit node prefs. A GUI that
applied each one on arrival briefly showed the state between them.
setControlClientStatusLocked now collects all of them into one Notify,
sent from a deferred call when any field is set. suggestExitNodeLocked
no longer sends. It records a changed suggestion in a Notify that its
caller passes in, and the caller sends it with its other changes. The
two netmap blocks after the prefs save are merged. Nothing between them
ran unlocked.
Fixes#22206
Signed-off-by: Brendan Creane <[email protected]>
The visibility timer's callback only checked that its Warnable was
still unhealthy. If the Warnable was reset just as the timer fired, the
callback published the old Change even though the Warnable was no
longer visible, and removed the new timer from pendingVisibleTimers, so
that SetHealthy could not stop it. Similarly, changing a pending
Warnable's args left the old timer running.
Subscribers such as captive portal detection then received a Change for
a Warnable that was not in CurrentState.
Stop the pending timer when the unhealthy state changes, and make the
callback check that the state it was started for is still current.
Updates #15396
Updates #1634
Updates tailscale/corp#27985
Signed-off-by: Nick Khyl <[email protected]>
Without this, we try to send probes through the Tailscale interface when an exit node
is in use. The exit node is usually unreachable until the user signs in to the captive portal,
so the probes get blackholed and we miss the portal.
Updates #1634
Updates #17095
Updates tailscale/corp#21896
Change-Id: I124652d5a4e933089084f4317f7242c3e1470b99
Signed-off-by: Nick Khyl <[email protected]>
nodeBackend indexed device names under both their FQDN and short name
but DNS.ExtraRecords only under the record name, and control sends
Services only as FQDNs. So with userspace networking, dials of a
Service by its short name fell through to the system resolver and
failed, while TUN clients worked via the OS search domain. Also index
ExtraRecords under the MagicDNS suffix by their short name, if it is a
single label. Device names and literal short-name records still win.
Fixes#22778
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I4c03df285a80fcd7093cf47fe9a3eb73de116a13
We ran overlapping checks in four tools at different versions:
golangci-lint only reported problems on changed lines, vet only ran
for linux, and staticcheck took seven CI jobs, each compiling the tree
from scratch.
cmd/tsvet now runs the go vet suite, staticcheck, checklocks, and our
own analyzers as a single vettool, for linux, windows, and darwin, plus
a goimports check of all Go files. Small analyzers replace the
golangci-lint and revive checks that nothing else covered, and
lint:ignore directives work for every check.
CI runs it with the next toolchain (tailscale.go1.28), whose go vet
type checks dependencies instead of compiling them. Pushes to main
save one cache that per-GOOS PR jobs restore, and go test no longer
runs its own vet in jobs that tsvet covers.
Over the past 30 days, these checks cost about 43 runner-minutes per
PR (29 of them staticcheck's). On a 4-core machine, tsvet checks the
whole tree for all three GOOS values in 3m27s from an empty cache and
10s when nothing changed. Its cache for all three is 1.3 GB (176 MB
compressed), versus 5 GB for just linux when vet compiles with Go
1.27. Dropping golangci-lint also removes 161 lines from go.mod.
Fixes#22645Fixes#22653
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Idf8779d8d3e1f5e87a8a431a53949db9c143d236
* cmd/k8s-operator/e2e: consolidate shared test helpers and fix PeerRelay test
Move the readiness and reachability checks for ingress, ProxyGroup and API
server proxy tests into shared helpers in helpers_test.go so the upcoming
upgrade/downgrade suite can reuse them.
Also change the PeerRelay verify helpers from exact-equality to subset
checks so this does not fail in real clusters once the Service gets a
LoadBalancer address.
Updates tailscale/corp#34562
Signed-off-by: Becky Pauley <[email protected]>
* cmd/k8s-operator/e2e: add test for upgrade/downgrade of the operator
TestOperatorVersionChange installs the operator at one version, performs
baseline checks, changes the operator to another version, and asserts the
resources stay healthy across the change.
Tests can be run as an upgrade, downgrade or a round-trip (upgrade then
rollback). After each version change, the test re-verifies every managed
resource (ingress, egress, ProxyGroup, API server proxy, PeerRelay),
confirms the operator and proxy workloads actually rolled to the new image,
and performs connectivity checks.
Also skip rebuilding and side-loading a kind image when the node already has
the tagged image, matching the existing EnsurePushed logic when using the
--registry path.
Updates tailscale/corp#34836
Change-Id: Id643255f99a06cf9fbabb722dd37293c8f097c61
Signed-off-by: Becky Pauley <[email protected]>
---------
Signed-off-by: Becky Pauley <[email protected]>
The Linux systemd unit runs "tailscaled --cleanup" as ExecStopPost
without $FLAGS, so --no-logs-no-support in FLAGS wasn't seen and
cleanup started logtail on every stop or restart, contacting
log.tailscale.com and falling back to bootstrap DNS. Cleanup only
tears down local DNS and router state, so skip logtail setup for it.
TestCollectPanic relied on --cleanup uploading the previous run's
panic, so it now uploads it from a normal daemon start instead.
Fixes#22836
Change-Id: Ie7a9cbd7be29aae37613b49deac1285f4a0aaa6d
Signed-off-by: Jimmyman1465 <[email protected]>
Co-authored-by: Brad Fitzpatrick <[email protected]>
Add Network.ListenPacket, making Network a nettype.PacketListener with
in-memory UDP sockets. Packets go by exact destination address and
port. Sending never blocks; packets to an address without a socket, or
to a full receive queue, are dropped. An unspecified or empty listen IP
binds the family's loopback address, and port zero picks the next
ephemeral port in rotation, so a just-closed socket's port isn't handed
right back out, as with an OS.
Reads block only on channels and timers, including for read deadlines,
so the sockets work in testing/synctest bubbles. That's for running
magicsock (via its TestOnlyPacketListener) and STUN (via
stuntest.ServeWithPacketListener) on an in-memory network with fake
time.
Updates #22831
Change-Id: Id7043412ca036b075927c6352c663d73f2b8657f
Signed-off-by: Brad Fitzpatrick <[email protected]>
To enable synctest across more and more Tailscale tests, this wires up
some existing test-only hooks more, and adds another.
With them and a memnet.Network (and #22833 for memnet UDP support), a
test can run full userspace engines, their DERP server and a STUN
server in a testing/synctest bubble.
Updates #22831
Change-Id: I751775a1b3d8c89cbc9d669951f0ec22a00d9696
Signed-off-by: Brad Fitzpatrick <[email protected]>
Listener.Dial checked strings.HasSuffix(network, "tcp"), so it rejected
"tcp4" and "tcp6", which Network.Dial accepts and passes through. A
derphttp region client dials each DERP node with "tcp4" or "tcp6", so
it couldn't reach a DERP server on a memnet Network.
Accept exactly "tcp", "tcp4" and "tcp6".
Updates #22831
Change-Id: I699c40ed9c0b4a41fa3509514bd1f1bf828adb25
Signed-off-by: Brad Fitzpatrick <[email protected]>
A conn25 app grant reaches the connector as a peer capability keyed
tailscale.com/cap/conn25/<app>, and peercap.Conn25Prefix already documents
that each value under such a key is a tailcfg.ProtoPortRange whose union is
what the peer may reach. Nothing implemented that: both consumers only called
PeerCapMap.HasCapability, so once a client had registered a transit IP, the
connector accepted any protocol on any port to any address in the transit
pool.
Decode the values when the client registers a transit IP, store them with the
mapping, and check every inbound packet against them in the connector's
ingress filter hook. A packet from WireGuard addressed to a transit IP always
falls through to IngressAllowHooks, since a transit IP is never in localNets,
so the check sees every packet rather than just TCP SYNs, and a denial gets
the usual RejectedDueToACLs TSMP reply.
Split packetFilterAllow in two along the way. linkLocalAllow keeps the old
pool-membership behaviour, which exists only to lift the filter's blanket drop
of link-local unicast destinations; ingressAllow makes the access decision. A
transit IP with no registered mapping still passes ingressAllow, so that the
datapath can drop it and answer with the TSMP that prompts the client to
re-register. Nothing is forwarded on its behalf.
Updates https://github.com/tailscale/corp/issues/49815
Change-Id: Ic7abc89be12afe2be758fac7700fc21f89465be5
Signed-off-by: Mazdak Nasab <[email protected]>
tailscaled uses the [unexpected] log prefix for conditions that should
never happen. Record such lines as the log catcher receives them and
report each one as a test error when the test environment shuts down.
Run tailscaled with IN_TS_TEST=1 so logs are uploaded as they are
written, rather than batched every two seconds and partly lost when the
process is killed at the end of the test.
Updates #22307
Signed-off-by: Nick Khyl <[email protected]>
The fixed ControlTime of 2020-08-03 is before the epoch that ipnlocal's
peer expiry code uses to reject implausible control times, so every
tailscaled in the integration suite logged an [unexpected] warning on
each netmap update and skipped peer expiry handling. Move it to
2024-01-01, keeping it fixed so TestControlTimeLogLine can still match
it exactly.
Updates #22307
Signed-off-by: Nick Khyl <[email protected]>
Since bd9725c5f, every self-check made while out of a map poll marked
no-derp-connection and derp-timeout healthy and then unhealthy again,
restarting their TimeToVisible. As failed DERP reconnects and engine
status updates each run a self-check every few seconds,
no-derp-connection rarely became visible, and captive portal detection
was not triggered or had its warning cleared right away.
Determine each DERP warnable's state once per self-check.
Updates #15396
Updates #14687
Updates #1634
Updates tailscale/corp#27985
Change-Id: Id6d43ece267765b064956167c3d359138b0faeff
Signed-off-by: Nick Khyl <[email protected]>
The extension starts a logger when the control client is created,
which for a new profile happens before the profile has an ID.
Start then tried to load stored logs with an empty key and logged
"[unexpected] failed to restore logs: empty key" on every fresh start,
as seen in the Windows integration tests.
A profile without an ID has no stored logs, so skip the restore.
Updates #cleanup
Updates #22309 (the only [unexpected] log line in integration tests)
Signed-off-by: Nick Khyl <[email protected]>
* cmd/k8s-operator,k8s-operator: give ProxyGroups the chart imagePullSecrets
The operator copies the Helm chart imagePullSecrets value from the proxies
ServiceAccount onto the ServiceAccount of each Service, Ingress, Connector
and PeerRelay proxy, but not onto the one it creates for each ProxyGroup,
so with a private registry ProxyGroup Pods cannot pull the proxy image.
Its update of that ServiceAccount also removed all annotations, while
OpenShift adds an annotation and a pull secret to every ServiceAccount,
adds them again when they are removed, and the operator watches this one.
This fixes this by adding the imagePullSecrets of the proxies
ServiceAccount to the ProxyGroup ServiceAccount and keeping the
annotations and pull secrets that others add. Entries removed from the
chart value stay on existing ProxyGroup ServiceAccounts.
Fixes#22783Fixes#22784
Change-Id: Ided67a2972b81c1a95281cf8ef85eae34fee4a3c
Signed-off-by: chaosinthecrd <[email protected]>
* cmd/k8s-operator: test ProxyGroup ServiceAccount pull secrets and annotations
Adds a test that egress, ingress and kube-apiserver ProxyGroups get the
imagePullSecrets of the proxies ServiceAccount without losing entries or
annotations that others add, and that kube-apiserver ProxyGroups in auth
mode leave the static ServiceAccount alone. It also checks that reconcile
fails without creating the ServiceAccount when the proxies ServiceAccount
cannot be read.
Updates #22783
Updates #22784
Change-Id: Ibf73086cdf0f622cc7761cc5f0a6cee482a3b5c8
Signed-off-by: chaosinthecrd <[email protected]>
---------
Signed-off-by: chaosinthecrd <[email protected]>
These were hidden because golangci-lint only reported problems on
changed lines and vet never ran for windows or darwin. Among them, a
tsconnect build ignored precompression errors and two printf calls
formatted pointers with %d.
Fixing them first clears the way for an upcoming rework of vet in CI
that unifies our assorted static analysis checkers into one tool.
Fixes#22652
Updates #22653
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I89e8f5899a2fb9a2d477379e0c2c977d48e001a0
If msiexec failed to install an update for any reason, installMSI
assumed it was a downgrade, which msiexec does not permit, uninstalled
the current version and tried again. If the second attempt failed too,
such as when a custom action in the new package kept failing,
the device was left without Tailscale.
Uninstall the current version only if the requested version is older
than it, and do so before running the installer. Otherwise, return
the error and let Windows Installer roll back to the current version.
If the current version has been uninstalled and Windows Installer
is busy with another installation, keep retrying with a backoff
for up to 30 minutes rather than leaving the device without Tailscale.
Fixestailscale/corp#45537
Updates tailscale/corp#52316
Change-Id: I066480c718b3bfca53a65c54ebf948562bc6ba2b
Signed-off-by: Nick Khyl <[email protected]>
On Windows, tailscaled runs as a service that starts a subprocess to do
the actual work. Only the service process uploads logs, and only its own
client metrics went with them, which left out nearly all of the metrics,
as they are counted in the subprocess.
Have the subprocess write the changes in its metrics to its output ahead
of its log lines, and have the service process merge them into its own
metrics with clientmetric.Remote rather than log them.
Stop skipping TestClientMetricsUploaded for the Windows service.
Fixestailscale/corp#6528
Signed-off-by: Nick Khyl <[email protected]>
Client metrics are uploaded along with the logs of the process that
has them. A process whose logs are uploaded by another process, such as
the tailscaled subprocess of the Windows service, has no way to report
its metrics.
Add Remote, which applies the deltas encoded by another process to the
metrics of the same names in this one, so that both are reported as one,
by Metric.Value as well as in the logs.
A counter is the sum of its values in both processes, and keeps what
a remote process has added to it after that process exits.
A gauge is set to its value in the remote process, and to zero
when that process exits.
Updates tailscale/corp#6528
Signed-off-by: Nick Khyl <[email protected]>
Add a test that waits for a metric counted by the backend to be
uploaded along with the logs.
Skip it if tailscaled runs as a Windows service. The service process
uploads the logs, and only its own metrics with them, while nearly all
of the metrics are counted in its subprocess.
Updates tailscale/corp#6528
Signed-off-by: Nick Khyl <[email protected]>
Since 77d2c87b1, the Linux router removes any Tailscale-range address
on the tunnel interface that is not in LocalAddrs. That deleted the
address of a Tailscale Service served in TUN mode when the operator had
assigned it to the tunnel interface. Pass the Service addresses to the
router as Config.ServiceAddrs so the sweep keeps them, and skip the
sweep while LocalAddrs is empty.
Updates #22701
Signed-off-by: Brendan Creane <[email protected]>
In PR #22749 we attempteed to clear up the casting needed for the fileOps for the close action by using the io.Closer interface. This broke the dependency to our android repo.
This change both removes this interface change that breaks compatability, and also removes the closeOps field. After further review this field was no longer necessary after we removed the persistent root behavior.
Updates tailscale/corp#51118
Change-Id: I1870030f130e92950843afb8c306b32f2008fca4
Signed-off-by: Mike Jensen <[email protected]>
These were the last two uses of github.com/pkg/errors in the tree and both
were plain errors.New calls, so they move to the standard library
unchanged. Several dependencies still require the module, so it becomes an
indirect requirement rather than leaving go.mod, and it drops out of
cmd/k8s-operator's binary entirely, so its depaware manifest no longer
lists it.
Moving the require line changes the go.mod fingerprint recorded in
flakehashes.json, so its goModSum is regenerated. The vendor SRI is
unchanged, because the module is still vendored for those other
dependencies.
Updates #cleanup
Change-Id: I6beb0ea2943863a46c56714f2878f3e019d120d2
Signed-off-by: luckydropship <[email protected]>
Commit 54a4fecaf made nodeAddrForNetwork copy the node's addresses
into a heap-allocated slice on every device-name dial. Use a small
stack buffer instead, and add a test that it doesn't allocate.
Updates #22261
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Id7d68b3db954d56193b80a3a1f1d7977f17b001a
* k8s-operator/reconciler/recorder: requeue Recorders when their Tailnet changes
A Recorder whose spec.tailnet refers to a Tailnet that is not ready yet is
marked RecorderReady=False and not requeued. Watch Tailnet resources and
enqueue the Recorders that refer to the changed Tailnet.
Fixes#22457
Signed-off-by: Alex Castillo <[email protected]>
* k8s-operator/reconciler/recorder: requeue when the Tailnet client is not ready
The Tailnet reconciler writes Ready and its finalizer before it marks the
client ready, and both writes enqueue Recorders. A reconcile in that window
still sees the tailnet as unavailable. Return the existing short requeue so
that case retries without waiting for another Tailnet event.
Move the Tailnet watch mapping test next to the other recorder tests.
Updates #22457
Signed-off-by: Alex Castillo <[email protected]>
* k8s-operator/reconciler/recorder: use FakeClientProvider in the ready test
TestRecorderProvisionsWhenTailnetBecomesReady had its own client provider,
a copy of reconcilertest.FakeClientProvider. Run two reconcilers on the
same fake client instead: the first fails to resolve the tailnet, and the
second resolves it with NewFakeClientProvider.
Updates #22457
Signed-off-by: Alex Castillo <[email protected]>
---------
Signed-off-by: Alex Castillo <[email protected]>
nodeBackend rebuilt extraDNS from DNS.ExtraRecords as a
map[string]netip.Addr, so a Service's A and AAAA records under the
same name overwrote each other and only the last one (the AAAA,
i.e. the IPv6 VIP) survived. resolveMagicDNS then returned only the
IPv6 VIP for UserDial dials of the Service name, with no IPv4
fallback, and a tcp4 dial of the name failed outright.
Keep every address per name (map[string][]netip.Addr) and select
among them with the same addrForNetwork helper used for device
names, which prefers IPv4 for unqualified networks and honors
tcp4/tcp6. This makes outbound HTTP proxy, SOCKS5, and 'tailscale
nc' dials of Service names reach the IPv4 VIP in IPv4-only
deployments (e.g. Kubernetes operator ingress ProxyGroups).
Fixes#22261
Signed-off-by: evan188199-tech <[email protected]>
linkChange only reconfigured the router after a network change
if LAN access was allowed, but the router config depends on
the local interfaces whenever an exit node is in use.
Fixes#22739
Signed-off-by: Nick Khyl <[email protected]>
authRoutine reported login attempts canceled by a pause, shutdown or
new login, such as when LocalBackend is restarting, to the health
tracker. A cancelation is either irrelevant, or it replaces an earlier
error and masks a real issue. Don't report errors once the attempt's
context is done, as is already the case for status updates.
login-state is then unhealthy only when logging in to the control plane
fails, so mark it as impacting connectivity. Among other things, that
lets it trigger captive portal detection.
Updates #12991
Updates #20078
Updates #18116
Updates #13378
Updates #1634
Updates tailscale/corp#27985
Updates #12701
Updates #14126
Signed-off-by: Nick Khyl <[email protected]>
In this PR, we make ExitNodeID, ExitNodeIP, ExitNode.AllowOverride,
AllowedSuggestedExitNodes, ExitNodeAllowLANAccess, EnableDNSRegistration,
UseTailscaleDNSSettings, UseTailscaleSubnets and ReconnectAfter profile
settings, so they can be configured by a policy source in the current
profile's scope as well as for the device.
We also make the current profile's scope the default one, so that tailscaled
uses settings from such sources. Device settings still take precedence,
and nothing changes until a profile-scoped source is registered.
Updates tailscale/corp#51945
Change-Id: I472595eb723cd3419003a02de8c66b0d8ebf9417
Signed-off-by: Nick Khyl <[email protected]>
crypto/tls sends no SNI for an IP address ServerName, so the
ConnectionState.ServerName seen by our VerifyConnection hook was empty.
x509 verification with an empty DNSName skips the name check, so any
cert from a trusted CA was accepted when dialing by IP, such as a DERP
node whose HostName is an IP using a LetsEncrypt IP cert. Fall back to
the IP in the tls.Config's ServerName, and fail if there's no name
to check, which includes net/http dials by IP.
Also, stop clearing RootCAs in Config, so SetConfigExpectedCert (used
for DERPNode.CertName) no longer drops the caller's extra roots.
Updates #11776
Updates #8085
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I3c810277895ba18f16f0b5de229b7d4fd972a802
Registering, replacing or unregistering a store, or calling Policy.Reload,
waited for the policy change callbacks to return, deadlocking if the caller
held a lock that a callback acquires, such as LocalBackend.mu.
Invoke the callbacks from an execqueue instead. The effective policy is
still updated by the time these calls return.
Updates tailscale/corp#51945
Change-Id: I4afa36b9acaa0e0104e4e420c561eab076d06c80
Signed-off-by: Nick Khyl <[email protected]>
Bump plan9netshell for go4org/plan9netshell@f7dfc18b3a,
which fixes interactive shells (broken since Go 1.25 by syscall.Exec),
^C, and hangup on disconnect.
Also stop creating the Plan 9 incubator with exec.CommandContext, which
killed it on any disconnect, unlike the graceful disconnect semantics
the Unix monitor path now has. For PTY sessions that orphaned the shell
and its foreground job. Now closing its stdio makes netshell hang up
the shell instead.
Updates #5794
Change-Id: I95cbca4997a6700c14d022fbf0d0c42486840782
Signed-off-by: Brad Fitzpatrick <[email protected]>
* cmd/k8s-proxy,ipn/ipnlocal,k8s-operator/api-proxy: drop PROXY protocol
The API server proxy in cmd/k8s-proxy took the caller's address from the
PROXY protocol header on its localhost listener, which any local process
could write. This fixes this by removing the header from both sides, and
making serve register each non-Funnel TCP forward to a loopback address
with the proxy mapper (as netstack does), so WhoIs on the connection's
real remote address returns the caller.
Updates tailscale/corp#48697
Thank you Winfunc for reporting
Signed-off-by: chaosinthecrd <[email protected]>
* ipn/ipnlocal,k8s-operator/api-proxy: add WhoIs and forged header tests
Adds a test that WhoIs on the backend side of a serve TCP forward returns
the source node while the forward is open and fails after it closes, for
IPv4, IPv6 and localhost targets, and that a Funnel flow or a backend on
a non-loopback address gets no node. Also adds a test that the API server
proxy's plain HTTP listener does not take the caller from a PROXY header
that a local client writes.
Updates tailscale/corp#48697
Signed-off-by: chaosinthecrd <[email protected]>
---------
Signed-off-by: chaosinthecrd <[email protected]>