interplane.Get Omega
Read in your language

omnet

aien-dev/omnet

Brought by drakestapleton

branch main Branches Tags History

omnet / integration / headscale / headscale.patch

4354 lines · 209162 bytes Raw Blame History
1diff --git a/go.mod b/go.mod
2index 6b96022..1710bc8 100644
3--- a/go.mod
4+++ b/go.mod
5@@ -2,11 +2,28 @@ module github.com/juanfont/headscale
6
7 go 1.27.3
8
9+// NOTE: modernc sqlite has a fragile dependency
10+// chain and it is important that they are updated
11+// in lockstep to ensure that they do not break
12+// some architectures and similar at runtime:
13+// https://github.com/juanfont/headscale/issues/2188
14+//
15+// Fragile libc dependency:
16+// https://pkg.go.dev/modernc.org/sqlite#hdr-Fragile_modernc_org_libc_dependency
17+// https://gitlab.com/cznic/sqlite/-/issues/177
18+//
19+// To upgrade, determine the new SQLite version to
20+// be used, and consult the `go.mod` file:
21+// https://gitlab.com/cznic/sqlite/-/blob/master/go.mod
22+// to find
23+// the appropriate `libc` version, then upgrade them
24+// together, e.g:
25+// go get modernc.org/libc@v1.55.3 modernc.org/sqlite@v1.33.1
26 require (
27 github.com/arl/statsviz v0.8.0
28 github.com/cenkalti/backoff/v5 v5.0.3
29 github.com/chasefleming/elem-go v0.31.0
30- github.com/coder/websocket v1.8.14
31+ github.com/coder/websocket v1.8.15
32 github.com/coreos/go-oidc/v3 v3.18.0
33 github.com/creachadair/command v0.2.12
34 github.com/creachadair/flax v0.0.6
35@@ -17,7 +34,7 @@ require (
36 github.com/go-chi/chi/v5 v5.4.0
37 github.com/go-chi/metrics v0.1.1
38 github.com/go-gormigrate/gormigrate/v2 v2.1.6
39- github.com/go-json-experiment/json v0.0.0-20260601182631-00ed12fed2a6
40+ github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3
41 github.com/gofrs/uuid/v5 v5.4.0
42 github.com/google/go-cmp v0.7.0
43 github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0
44@@ -27,8 +44,8 @@ require (
45 github.com/ory/dockertest/v3 v3.12.0
46 github.com/philip-bui/grpc-zerolog v1.0.1
47 github.com/pkg/profile v1.7.0
48- github.com/prometheus/client_golang v1.23.2
49- github.com/prometheus/common v0.69.0
50+ github.com/prometheus/client_golang v1.24.1
51+ github.com/prometheus/common v0.71.0
52 github.com/pterm/pterm v0.12.83
53 github.com/puzpuzpuz/xsync/v4 v4.5.0
54 github.com/realclientip/realclientip-go v1.0.0
55@@ -37,67 +54,36 @@ require (
56 github.com/sasha-s/go-deadlock v0.3.9
57 github.com/spf13/cobra v1.10.2
58 github.com/spf13/viper v1.21.0
59- github.com/stretchr/testify v1.11.1
60- github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd
61+ github.com/stretchr/testify v1.12.1
62+ github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f
63 github.com/tailscale/squibble v0.0.0-20260411062017-141f5d618bc4
64 github.com/tailscale/tailsql v0.0.0-20260522170732-77aec5aabc76
65 github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
66- go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
67- golang.org/x/crypto v0.57.0
68- golang.org/x/exp v0.0.0-20260603202125-055de637280b
69+ go4.org/netipx v0.0.0-20260823151212-3075585bcbeb
70+ golang.org/x/crypto v0.58.0
71+ golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba
72 golang.org/x/net v0.60.0
73- golang.org/x/oauth2 v0.36.0
74+ golang.org/x/oauth2 v0.37.0
75 golang.org/x/sync v0.24.0
76 google.golang.org/genproto/googleapis/api v0.0.0-20260610212136-7ab31c22f7ad
77 google.golang.org/grpc v1.83.2
78- google.golang.org/protobuf v1.36.11
79+ google.golang.org/protobuf v1.36.12
80 gopkg.in/yaml.v3 v3.0.1
81 gorm.io/driver/postgres v1.6.0
82 gorm.io/gorm v1.31.1
83+ modernc.org/sqlite v1.52.0
84 pgregory.net/rapid v1.3.0
85- tailscale.com v1.102.0
86+ tailscale.com v1.104.5
87 zombiezen.com/go/postgrestest v1.0.1
88 )
89
90-// NOTE: modernc sqlite has a fragile dependency
91-// chain and it is important that they are updated
92-// in lockstep to ensure that they do not break
93-// some architectures and similar at runtime:
94-// https://github.com/juanfont/headscale/issues/2188
95-//
96-// Fragile libc dependency:
97-// https://pkg.go.dev/modernc.org/sqlite#hdr-Fragile_modernc_org_libc_dependency
98-// https://gitlab.com/cznic/sqlite/-/issues/177
99-//
100-// To upgrade, determine the new SQLite version to
101-// be used, and consult the `go.mod` file:
102-// https://gitlab.com/cznic/sqlite/-/blob/master/go.mod
103-// to find
104-// the appropriate `libc` version, then upgrade them
105-// together, e.g:
106-// go get modernc.org/libc@v1.55.3 modernc.org/sqlite@v1.33.1
107-require (
108- modernc.org/libc v1.72.3 // indirect
109- modernc.org/mathutil v1.7.1 // indirect
110- modernc.org/memory v1.11.0 // indirect
111- modernc.org/sqlite v1.52.0
112-)
113-
114-// NOTE: gvisor must be updated in lockstep with
115-// tailscale.com. The version used here should match
116-// the version required by the tailscale.com dependency.
117-// To find the correct version, check tailscale.com's
118-// go.mod file for the gvisor.dev/gvisor version:
119-// https://github.com/tailscale/tailscale/blob/main/go.mod
120-require gvisor.dev/gvisor v0.0.0-20260224225140-573d5e7127a8 // indirect
121-
122 require (
123 atomicgo.dev/cursor v0.2.0 // indirect
124 atomicgo.dev/keyboard v0.2.10 // indirect
125 atomicgo.dev/schedule v0.1.0 // indirect
126 dario.cat/mergo v1.0.2 // indirect
127 filippo.io/edwards25519 v1.2.0 // indirect
128- fyne.io/systray v1.11.1-0.20250812065214-4856ac3adc3c // indirect
129+ fyne.io/systray v1.12.2 // indirect
130 github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
131 github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 // indirect
132 github.com/Microsoft/go-winio v0.6.2 // indirect
133@@ -105,21 +91,21 @@ require (
134 github.com/akutz/memconn v0.1.0 // indirect
135 github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect
136 github.com/atotto/clipboard v0.1.4 // indirect
137- github.com/aws/aws-sdk-go-v2 v1.42.1 // indirect
138- github.com/aws/aws-sdk-go-v2/config v1.32.17 // indirect
139- github.com/aws/aws-sdk-go-v2/credentials v1.19.16 // indirect
140- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 // indirect
141- github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.30 // indirect
142- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.30 // indirect
143- github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect
144- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.13 // indirect
145- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.30 // indirect
146- github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect
147- github.com/aws/aws-sdk-go-v2/service/ssm v1.45.0 // indirect
148- github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
149- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
150- github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect
151- github.com/aws/smithy-go v1.27.3 // indirect
152+ github.com/aws/aws-sdk-go-v2 v1.46.0 // indirect
153+ github.com/aws/aws-sdk-go-v2/config v1.33.3 // indirect
154+ github.com/aws/aws-sdk-go-v2/credentials v1.20.3 // indirect
155+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2 // indirect
156+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2 // indirect
157+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2 // indirect
158+ github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2 // indirect
159+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 // indirect
160+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2 // indirect
161+ github.com/aws/aws-sdk-go-v2/service/signin v1.9.0 // indirect
162+ github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0 // indirect
163+ github.com/aws/aws-sdk-go-v2/service/sso v1.37.0 // indirect
164+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0 // indirect
165+ github.com/aws/aws-sdk-go-v2/service/sts v1.49.0 // indirect
166+ github.com/aws/smithy-go v1.28.1 // indirect
167 github.com/axiomhq/hyperloglog v0.2.6 // indirect
168 github.com/beorn7/perks v1.0.1 // indirect
169 github.com/bradfitz/monogok v0.0.0-20260630033929-b1eef977b41f // indirect
170@@ -132,26 +118,26 @@ require (
171 github.com/containerd/errdefs/pkg v0.3.0 // indirect
172 github.com/creachadair/mds v0.31.0 // indirect
173 github.com/creachadair/msync v0.10.1 // indirect
174- github.com/dblohm7/wingoes v0.0.0-20250822163801-6d8e6105c62d // indirect
175+ github.com/dblohm7/wingoes v0.0.0-20260526185140-fb298caac7ca // indirect
176 github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect
177- github.com/diskfs/go-diskfs v1.9.3 // indirect
178+ github.com/diskfs/go-diskfs v1.9.4 // indirect
179 github.com/distribution/reference v0.6.0 // indirect
180- github.com/docker/cli v29.5.3+incompatible // indirect
181+ github.com/docker/cli v29.7.2+incompatible // indirect
182 github.com/docker/go-connections v0.7.0 // indirect
183 github.com/docker/go-units v0.5.0 // indirect
184 github.com/dustin/go-humanize v1.0.1 // indirect
185 github.com/felixge/fgprof v0.9.5 // indirect
186- github.com/felixge/httpsnoop v1.0.4 // indirect
187+ github.com/felixge/httpsnoop v1.1.0 // indirect
188 github.com/fogleman/gg v1.3.0 // indirect
189- github.com/fxamacker/cbor/v2 v2.9.0 // indirect
190- github.com/gaissmai/bart v0.26.1 // indirect
191+ github.com/fxamacker/cbor/v2 v2.9.3 // indirect
192+ github.com/gaissmai/bart v0.29.0 // indirect
193 github.com/glebarez/go-sqlite v1.22.0 // indirect
194 github.com/go-jose/go-jose/v3 v3.0.5 // indirect
195 github.com/go-jose/go-jose/v4 v4.1.4 // indirect
196- github.com/go-logr/logr v1.4.3 // indirect
197+ github.com/go-logr/logr v1.4.4 // indirect
198 github.com/go-logr/stdr v1.2.2 // indirect
199 github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
200- github.com/go4org/hashtriemap v0.0.0-20251130024219-545ba229f689 // indirect
201+ github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 // indirect
202 github.com/godbus/dbus/v5 v5.2.2 // indirect
203 github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
204 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
205@@ -175,22 +161,21 @@ require (
206 github.com/jackc/puddle/v2 v2.2.2 // indirect
207 github.com/jinzhu/inflection v1.0.0 // indirect
208 github.com/jinzhu/now v1.1.5 // indirect
209- github.com/jmespath/go-jmespath v0.4.0 // indirect
210 github.com/jsimonetti/rtnetlink v1.4.2 // indirect
211 github.com/kamstrup/intmap v0.5.2 // indirect
212 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
213- github.com/klauspost/compress v1.19.1 // indirect
214+ github.com/klauspost/compress v1.20.0 // indirect
215 github.com/lib/pq v1.12.3 // indirect
216 github.com/lithammer/fuzzysearch v1.1.8 // indirect
217 github.com/mattn/go-colorable v0.1.15 // indirect
218- github.com/mattn/go-isatty v0.0.23 // indirect
219+ github.com/mattn/go-isatty v0.0.24 // indirect
220 github.com/mattn/go-runewidth v0.0.24 // indirect
221- github.com/mdlayher/netlink v1.8.0 // indirect
222- github.com/mdlayher/socket v0.5.1 // indirect
223+ github.com/mdlayher/netlink v1.11.2 // indirect
224+ github.com/mdlayher/socket v0.7.0 // indirect
225 github.com/mitchellh/go-ps v1.0.0 // indirect
226 github.com/moby/docker-image-spec v1.3.1 // indirect
227- github.com/moby/moby/api v1.54.2 // indirect
228- github.com/moby/moby/client v0.4.1 // indirect
229+ github.com/moby/moby/api v1.55.0 // indirect
230+ github.com/moby/moby/client v0.5.1 // indirect
231 github.com/moby/sys/atomicwriter v0.1.0 // indirect
232 github.com/moby/sys/user v0.4.0 // indirect
233 github.com/moby/term v0.5.2 // indirect
234@@ -200,18 +185,17 @@ require (
235 github.com/opencontainers/go-digest v1.0.0 // indirect
236 github.com/opencontainers/image-spec v1.1.1 // indirect
237 github.com/opencontainers/runc v1.3.2 // indirect
238- github.com/pelletier/go-toml/v2 v2.3.1 // indirect
239+ github.com/pelletier/go-toml/v2 v2.4.3 // indirect
240 github.com/peterbourgon/ff/v3 v3.4.0 // indirect
241 github.com/petermattis/goid v0.0.0-20260330135022-df67b199bc81 // indirect
242- github.com/pires/go-proxyproto v0.9.2 // indirect
243+ github.com/pires/go-proxyproto v0.15.0 // indirect
244 github.com/pkg/errors v0.9.1 // indirect
245- github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
246- github.com/prometheus/client_model v0.6.2 // indirect
247- github.com/prometheus/procfs v0.20.1 // indirect
248+ github.com/prometheus/client_model v0.6.3 // indirect
249+ github.com/prometheus/procfs v0.21.1 // indirect
250 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
251 github.com/safchain/ethtool v0.7.0 // indirect
252 github.com/sagikazarmark/locafero v0.12.0 // indirect
253- github.com/sirupsen/logrus v1.9.4 // indirect
254+ github.com/sirupsen/logrus v1.10.2 // indirect
255 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
256 github.com/spf13/afero v1.15.0 // indirect
257 github.com/spf13/cast v1.10.0 // indirect
258@@ -220,38 +204,47 @@ require (
259 github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d // indirect
260 github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 // indirect
261 github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect
262- github.com/tailscale/setec v0.0.0-20260310221408-dcd97e42f251 // indirect
263- github.com/tailscale/web-client-prebuilt v0.0.0-20251127225136-f19339b67368 // indirect
264- github.com/tailscale/wireguard-go v0.0.0-20260715223240-2e01ba5b00f0 // indirect
265- github.com/toqueteos/webbrowser v1.2.0 // indirect
266+ github.com/tailscale/setec v0.0.0-20260824224040-f8d7a936837c // indirect
267+ github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea // indirect
268+ github.com/tailscale/wireguard-go v0.0.0-20260928213032-417aef361226 // indirect
269+ github.com/toqueteos/webbrowser v1.2.1 // indirect
270 github.com/x448/float16 v0.8.4 // indirect
271 github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
272 github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
273 github.com/xeipuuv/gojsonschema v1.2.0 // indirect
274- github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
275+ github.com/xo/terminfo v1.0.0 // indirect
276 go.opentelemetry.io/auto/sdk v1.2.1 // indirect
277- go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 // indirect
278- go.opentelemetry.io/otel v1.44.0 // indirect
279+ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect
280+ go.opentelemetry.io/otel v1.45.0 // indirect
281 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect
282- go.opentelemetry.io/otel/metric v1.44.0 // indirect
283- go.opentelemetry.io/otel/trace v1.44.0 // indirect
284+ go.opentelemetry.io/otel/metric v1.45.0 // indirect
285+ go.opentelemetry.io/otel/trace v1.45.0 // indirect
286 go.yaml.in/yaml/v2 v2.4.4 // indirect
287- go.yaml.in/yaml/v3 v3.0.4 // indirect
288+ go.yaml.in/yaml/v3 v3.0.5 // indirect
289 go4.org/mem v0.0.0-20240501181205-ae6ca9944745 // indirect
290- golang.org/x/exp/typeparams v0.0.0-20260603202125-055de637280b // indirect
291- golang.org/x/image v0.41.0 // indirect
292+ golang.org/x/image v0.46.0 // indirect
293 golang.org/x/mod v0.41.0 // indirect
294- golang.org/x/sys v0.48.0 // indirect
295- golang.org/x/term v0.46.0 // indirect
296- golang.org/x/text v0.42.0 // indirect
297- golang.org/x/time v0.15.0 // indirect
298- golang.org/x/tools v0.49.0 // indirect
299+ golang.org/x/sys v0.49.0 // indirect
300+ golang.org/x/term v0.47.0 // indirect
301+ golang.org/x/text v0.43.0 // indirect
302+ golang.org/x/time v0.16.0 // indirect
303+ golang.org/x/tools v0.51.0 // indirect
304 golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
305- golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
306+ golang.zx2c4.com/wireguard/windows v1.0.1 // indirect
307 google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
308- k8s.io/client-go v0.34.0 // indirect
309+ // NOTE: gvisor must be updated in lockstep with
310+ // tailscale.com. The version used here should match
311+ // the version required by the tailscale.com dependency.
312+ // To find the correct version, check tailscale.com's
313+ // go.mod file for the gvisor.dev/gvisor version:
314+ // https://github.com/tailscale/tailscale/blob/main/go.mod
315+ gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 // indirect
316+ k8s.io/client-go v0.37.0 // indirect
317+ modernc.org/libc v1.72.3 // indirect
318+ modernc.org/mathutil v1.7.1 // indirect
319+ modernc.org/memory v1.11.0 // indirect
320 sigs.k8s.io/yaml v1.6.0 // indirect
321- software.sslmate.com/src/go-pkcs12 v0.4.0 // indirect
322+ software.sslmate.com/src/go-pkcs12 v0.7.3 // indirect
323 )
324
325 tool (
326diff --git a/go.sum b/go.sum
327index 07b0670..a4ec6d2 100644
328--- a/go.sum
329+++ b/go.sum
330@@ -14,12 +14,12 @@ filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
331 filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
332 filippo.io/mkcert v1.4.4 h1:8eVbbwfVlaqUM7OwuftKc2nuYOoTDQWqsoXmzoXZdbc=
333 filippo.io/mkcert v1.4.4/go.mod h1:VyvOchVuAye3BoUsPUOOofKygVwLV2KQMVFJNRq+1dA=
334-fyne.io/systray v1.11.1-0.20250812065214-4856ac3adc3c h1:km4PIleGtbbF1oxmFQuO93CyNCldwuRTPB8WlzNWNZs=
335-fyne.io/systray v1.11.1-0.20250812065214-4856ac3adc3c/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
336+fyne.io/systray v1.12.2 h1:Y8DZxgLHsVQt6rY9Zrkkg+j67S7vv/1F2viOWKPpVeA=
337+fyne.io/systray v1.12.2/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
338 github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg=
339 github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
340-github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
341-github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
342+github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
343+github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
344 github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 h1:1ltqoej5GtaWF8jaiA49HwsZD459jqm9YFz9ZtMFpQA=
345 github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
346 github.com/MarvinJWendt/testza v0.5.2 h1:53KDo64C1z/h/d/stCYCPY69bt/OSwjq5KpFNwi+zB4=
347@@ -40,50 +40,54 @@ github.com/arl/statsviz v0.8.0 h1:O6GjjVxEDxcByAucOSl29HaGYLXsuwA3ujJw8H9E7/U=
348 github.com/arl/statsviz v0.8.0/go.mod h1:XlrbiT7xYT03xaW9JMMfD8KFUhBOESJwfyNJu83PbB0=
349 github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
350 github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
351-github.com/aws/aws-sdk-go-v2 v1.42.1 h1:9eOTgu1z/dVtYpNZ3/8/XbbaX0x/BqE3HUzAzs6K0ek=
352-github.com/aws/aws-sdk-go-v2 v1.42.1/go.mod h1:5pKeft2eJj+gElQ38Jqg4ibCqh+/AK33/0X3hip7IjM=
353-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU=
354-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4/go.mod h1:IOAPF6oT9KCsceNTvvYMNHy0+kMF8akOjeDvPENWxp4=
355-github.com/aws/aws-sdk-go-v2/config v1.32.17 h1:FpL4/758/diKwqbytU0prpuiu60fgXKUWCpDJtApclU=
356-github.com/aws/aws-sdk-go-v2/config v1.32.17/go.mod h1:OXqUMzgXytfoF9JaKkhrOYsyh72t9G+MJH8mMRaexOE=
357-github.com/aws/aws-sdk-go-v2/credentials v1.19.16 h1:r3RJBuU7X9ibt8RHbMjWE6y60QbKBiII6wSrXnapxSU=
358-github.com/aws/aws-sdk-go-v2/credentials v1.19.16/go.mod h1:6cx7zqDENJDbBIIWX6P8s0h6hqHC8Avbjh9Dseo27ug=
359-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 h1:UuSfcORqNSz/ey3VPRS8TcVH2Ikf0/sC+Hdj400QI6U=
360-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23/go.mod h1:+G/OSGiOFnSOkYloKj/9M35s74LgVAdJBSD5lsFfqKg=
361-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.30 h1:xM/Is9cKMHa8Jj8zkvWhvrFkZsXJV9E+BB4g0HW0duQ=
362-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.30/go.mod h1:WueJeNDZvK1fMYEWJIkcivBfEzUkTpBhzlrUKKY8EuA=
363-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.30 h1:jn46zC9LdsVR/ZpMIJqMqb8hHv31BlLx3ulVqNspUOk=
364-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.30/go.mod h1:1hTMsAgbdS/AtUi4bw8+gUuh1pceo+eXRLfpSuSQj3M=
365-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 h1:OQqn11BtaYv1WLUowvcA30MpzIu8Ti4pcLPIIyoKZrA=
366-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24/go.mod h1:X5ZJyfwVrWA96GzPmUCWFQaEARPR7gCrpq2E92PJwAE=
367-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.13 h1:mbRIur/BiHK6SKPjoBIXSE/hJ6g6JGRLuxQy1jGjlN4=
368-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.13/go.mod h1:ITg9em2KbJx1s0y4aqRX5OYWG6HBZ5TVR//OdpEZ2CQ=
369-github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 h1:DIBqIrJ7hv+e4CmIk2z3pyKT+3B6qVMgRsawHiR3qso=
370-github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7/go.mod h1:vLm00xmBke75UmpNvOcZQ/Q30ZFjbczeLFqGx5urmGo=
371-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.30 h1:/Z5jmNrKsSD7EmDjzAPsm/3L9IuOkzaynklJZ1qX7S4=
372-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.30/go.mod h1:lEzEZnOosE7zi8Z6royW1cFJTD9fpab4Ul1SBrllewk=
373-github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 h1:NSbvS17MlI2lurYgXnCOLvCFX38sBW4eiVER7+kkgsU=
374-github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16/go.mod h1:SwT8Tmqd4sA6G1qaGdzWCJN99bUmPGHfRwwq3G5Qb+A=
375-github.com/aws/aws-sdk-go-v2/service/s3 v1.93.2 h1:U3ygWUhCpiSPYSHOrRhb3gOl9T5Y3kB8k5Vjs//57bE=
376-github.com/aws/aws-sdk-go-v2/service/s3 v1.93.2/go.mod h1:79S2BdqCJpScXZA2y+cpZuocWsjGjJINyXnOsf5DTz8=
377-github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 h1:TdJ+HdzOBhU8+iVAOGUTU63VXopcumCOF1paFulHWZc=
378-github.com/aws/aws-sdk-go-v2/service/signin v1.0.11/go.mod h1:R82ZRExE/nheo0N+T8zHPcLRTcH8MGsnR3BiVGX0TwI=
379-github.com/aws/aws-sdk-go-v2/service/ssm v1.45.0 h1:IOdss+igJDFdic9w3WKwxGCmHqUxydvIhJOm9LJ32Dk=
380-github.com/aws/aws-sdk-go-v2/service/ssm v1.45.0/go.mod h1:Q7XIWsMo0JcMpI/6TGD6XXcXcV1DbTj6e9BKNntIMIM=
381-github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 h1:7byT8HUWrgoRp6sXjxtZwgOKfhss5fW6SkLBtqzgRoE=
382-github.com/aws/aws-sdk-go-v2/service/sso v1.30.17/go.mod h1:xNWknVi4Ezm1vg1QsB/5EWpAJURq22uqd38U8qKvOJc=
383-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 h1:+1Kl1zx6bWi4X7cKi3VYh29h8BvsCoHQEQ6ST9X8w7w=
384-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21/go.mod h1:4vIRDq+CJB2xFAXZ+YgGUTiEft7oAQlhIs71xcSeuVg=
385-github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 h1:F/M5Y9I3nwr2IEpshZgh1GeHpOItExNM9L1euNuh/fk=
386-github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio=
387-github.com/aws/smithy-go v1.27.3 h1:F3Zb497UhhskkfpJmfkXswyo+t0sh9OTBnIHjogWbVY=
388-github.com/aws/smithy-go v1.27.3/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
389+github.com/aws/aws-sdk-go-v2 v1.46.0 h1:1kt7m/EKcEHt5mlyyxx9cSlMddRPIKbjb6DIQsu4HPk=
390+github.com/aws/aws-sdk-go-v2 v1.46.0/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU=
391+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20 h1:GPRlPwz40I2B2VrBEASOA3Bi77NyeqejNLkifosX0rs=
392+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.20/go.mod h1:g7PNzKcsOKWb4fkSRBA7BZVAS6Y8IcxzN+nRohhQ1Q8=
393+github.com/aws/aws-sdk-go-v2/config v1.33.3 h1:h090b3O5S17bF87/0ysHZuIT/7DCb4EBRFQX2PMVPCw=
394+github.com/aws/aws-sdk-go-v2/config v1.33.3/go.mod h1:YYDB1kTejxbfAbEVUqgCtkVp26xvNCHev9cLKABMGAk=
395+github.com/aws/aws-sdk-go-v2/credentials v1.20.3 h1:tToOYM/LXev4NpfWlIYGDvBvjHmJ3HXpRU9ppl+pM6k=
396+github.com/aws/aws-sdk-go-v2/credentials v1.20.3/go.mod h1:wfGneWyncO7p67wqXV2IQhPk14JqIc25woKlaArT3WI=
397+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2 h1:Ldv7RPHs7qwwTscRjAl3YBud32f3BvdAGRmSvAx5L38=
398+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.19.2/go.mod h1:XyK6UV8xbo66ysVqLd2783C09pBYHOm8aKTRV5DVJ30=
399+github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2 h1:q/PSLGuRWCChWg+dLnb9dWOnrCxJtnboXbBtFoqqRrI=
400+github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.2/go.mod h1:TD1jvU2LvXkJexct5vBqcd8QlNXh5EmRUeL/Z32p0n4=
401+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2 h1:6fl86IPqKEXoySqiOWdfgbEp9OVbn44zTfEICNEBDhY=
402+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.2/go.mod h1:63HDfhFkdzBpI8WGXTSKUHPKS6mqldj4u3LJW7RZtSU=
403+github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2 h1:XMgIRS+uW9F3yFKnXGRrI9pkHi99CXTmoz2kz2/TGBA=
404+github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.2/go.mod h1:vorxDzK+n3jiv9a5ST/LG0Eu9cSv1CRdKTpG6pDMs+M=
405+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 h1:bAdDl/HkGCcGPoe25ToSHEw23VIxt6CT5fLcg111BKg=
406+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19/go.mod h1:KaUzbLxv4CeSxh6ZCl9B4m7CuFenS8kUEaDs+f/DQr4=
407+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.2 h1:CO485zrLOZBeq8mrdsudc8cjyhvC4LY4JFt8ZfHvXZ0=
408+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.11.2/go.mod h1:cBAjVUKBr+5wnx1K3XWS8u5AZsqpA2S/0z7YtI6BGFc=
409+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2 h1:ZtHYnumr6QyxhzEzNZwzQTFJEXOswrZqTTkRxthwvr4=
410+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.2/go.mod h1:a1NXrYpBd311gBzn1UI5UzJyyvXktM4xNh/ydPiPpqY=
411+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.2 h1:Enx5JcIy/o90kio1LFZ/HguxIsos3clbGuSpGdyshX8=
412+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.20.2/go.mod h1:Ldmll8/2VqaVerWWDf8IGG+6pAvZY04gs3tevq3nIFs=
413+github.com/aws/aws-sdk-go-v2/service/s3 v1.112.0 h1:clAH6BH9cZ6JHy6uUfUS26TGuzFSn+gb2lj8DK54TR4=
414+github.com/aws/aws-sdk-go-v2/service/s3 v1.112.0/go.mod h1:6ZFrmv/qIAYFmG+2WhA7mFU8+edldRlISwT+tNnyLuA=
415+github.com/aws/aws-sdk-go-v2/service/signin v1.9.0 h1:c3k+k/CS4L+sAIH6fxikL+g5g2LpeNczaoyjjw1iMKI=
416+github.com/aws/aws-sdk-go-v2/service/signin v1.9.0/go.mod h1:AGIoQg99fBrOIQnF78TLx4lj18mc4gZ0hJx1UaLIFM4=
417+github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0 h1:JqKSBJlS68F4nxoPLwD7tB3lJ3gWEK9p+7eOiBE/lsM=
418+github.com/aws/aws-sdk-go-v2/service/ssm v1.77.0/go.mod h1:5TMMHmQGjCODMeIopSNfxkan11jG0SmFpyjcMvCLzHA=
419+github.com/aws/aws-sdk-go-v2/service/sso v1.37.0 h1:+rqBaOq7jzInjY8M12hr+zEe85JpRll9BjMx38r33Ok=
420+github.com/aws/aws-sdk-go-v2/service/sso v1.37.0/go.mod h1:XFlVwUsw3sYh8Hw37umYVJnrcWrwXWRxbNw/JY0bblw=
421+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0 h1:hzM3GslEAOBcLn3DHH6ENToFi+vXP+n02W+x6zejAIM=
422+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.42.0/go.mod h1:588e7skMkYIYkSUseT8E3WKFfbAfrA1bj3Zf+qxJtJY=
423+github.com/aws/aws-sdk-go-v2/service/sts v1.49.0 h1:N7Ey8obY3uSui+cxl0OUzFlFmkxSucoJnrniFhw+cLc=
424+github.com/aws/aws-sdk-go-v2/service/sts v1.49.0/go.mod h1:zMBwjSf4Pt8a1OHYiZ5rPD0PJRK1kQrUaxhS/Dbld8E=
425+github.com/aws/smithy-go v1.28.1 h1:R/nXH00c8qcfCzQVELtRw+eLQWtzv+VAIEFJ1/xxXlQ=
426+github.com/aws/smithy-go v1.28.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
427 github.com/axiomhq/hyperloglog v0.2.6 h1:sRhvvF3RIXWQgAXaTphLp4yJiX4S0IN3MWTaAgZoRJw=
428 github.com/axiomhq/hyperloglog v0.2.6/go.mod h1:YjX/dQqCR/7QYX0g8mu8UZAjpIenz1FKM71UEsjFoTo=
429+github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA=
430+github.com/benbjohnson/immutable v0.4.3/go.mod h1:qJIKKSmdqz1tVzNtst1DZzvaqOU1onk1rc03IeM3Owk=
431 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
432 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
433 github.com/bradfitz/monogok v0.0.0-20260630033929-b1eef977b41f h1:voy0korWbg2e1gsJpBZ8/OBhVL8evXeUwbCZcA1PWv8=
434 github.com/bradfitz/monogok v0.0.0-20260630033929-b1eef977b41f/go.mod h1:TG1HbU9fRVDnNgXncVkKz9GdvjIvqquXjH6QZSEVmY4=
435+github.com/bradfitz/reco v0.0.0-20260929154613-b883fbd17e3f h1:jdXGSp5Ge5/kzikuxGOw9+6HSStUjkNBJZjGNtpItek=
436+github.com/bradfitz/reco v0.0.0-20260929154613-b883fbd17e3f/go.mod h1:oiCPXxBoDKSkb/RGEZwAZk8y/fwDlQ1vYlBbNRxPysw=
437 github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
438 github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
439 github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
440@@ -101,12 +105,12 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
441 github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
442 github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
443 github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
444-github.com/cilium/ebpf v0.17.3 h1:FnP4r16PWYSE4ux6zN+//jMcW4nMVRvuTLVTvCjyyjg=
445-github.com/cilium/ebpf v0.17.3/go.mod h1:G5EDHij8yiLzaqn0WjyfJHvRa+3aDlReIaLVRMvOyJk=
446+github.com/cilium/ebpf v0.22.0 h1:v2ktp0roffpMOj2MMf3idtCQZOsAoC4BJbAJN+ke2bY=
447+github.com/cilium/ebpf v0.22.0/go.mod h1:CDzZbe2hC5JjlDC+CY3KFCzlYwN4gbxppYM+Z10bQt4=
448 github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
449 github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
450-github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
451-github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
452+github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
453+github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
454 github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc=
455 github.com/containerd/console v1.0.5/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
456 github.com/containerd/continuity v0.5.0 h1:7a85HZpCSs+1Zps0Ee3DPSuAWY+0SJM1JNM51nlEVDg=
457@@ -117,8 +121,8 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X
458 github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
459 github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
460 github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
461-github.com/coreos/go-iptables v0.7.1-0.20240112124308-65c67c9f46e6 h1:8h5+bWd7R6AYUslN6c6iuZWTKsKxUFDlpnmilO6R2n0=
462-github.com/coreos/go-iptables v0.7.1-0.20240112124308-65c67c9f46e6/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
463+github.com/coreos/go-iptables v0.8.0 h1:MPc2P89IhuVpLI7ETL/2tx3XZ61VeICZjYqDEgNsPRc=
464+github.com/coreos/go-iptables v0.8.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
465 github.com/coreos/go-oidc/v3 v3.18.0 h1:V9orjXynvu5wiC9SemFTWnG4F45v403aIcjWo0d41+A=
466 github.com/coreos/go-oidc/v3 v3.18.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
467 github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
468@@ -130,28 +134,28 @@ github.com/creachadair/mds v0.31.0 h1:h4SXXgallvZfD8CFQnQNAOtBkUGpZjPwNBRQpHpHM/
469 github.com/creachadair/mds v0.31.0/go.mod h1:IZ3oLffgVNZ4O5WXTPxx7EX5ilSl1ypdv5FekYyynyI=
470 github.com/creachadair/msync v0.10.1 h1:14jT5Ujob64Zp2D3ZcUidayDMoXikhmYN8xBxEuPKPk=
471 github.com/creachadair/msync v0.10.1/go.mod h1:dFf4Z0cxE2nibFmAdq5OqTuGn++GgEqA9JuKH+7ceSA=
472-github.com/creachadair/taskgroup v0.13.2 h1:3KyqakBuFsm3KkXi/9XIb0QcA8tEzLHLgaoidf0MdVc=
473-github.com/creachadair/taskgroup v0.13.2/go.mod h1:i3V1Zx7H8RjwljUEeUWYT30Lmb9poewSb2XI1yTwD0g=
474+github.com/creachadair/taskgroup v0.14.4 h1:ttR8StLWmYA1O6x96YlTpQLXjKyRpO4RBo+OcO6W6C0=
475+github.com/creachadair/taskgroup v0.14.4/go.mod h1:uhCtIEsa7zpeMAFixddhCYjbJi7e4JMyU7OXUygkSsg=
476 github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
477 github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
478 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
479 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
480 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
481 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
482-github.com/dblohm7/wingoes v0.0.0-20250822163801-6d8e6105c62d h1:QRKpU+9ZBDs62LyBfwhZkJdB5DJX2Sm3p4kUh7l1aA0=
483-github.com/dblohm7/wingoes v0.0.0-20250822163801-6d8e6105c62d/go.mod h1:SUxUaAK/0UG5lYyZR1L1nC4AaYYvSSYTWQSH3FPcxKU=
484+github.com/dblohm7/wingoes v0.0.0-20260526185140-fb298caac7ca h1:h1Awca4lQOspNR/2eeo04Ricn5NixDX9mb17WSAgLhQ=
485+github.com/dblohm7/wingoes v0.0.0-20260526185140-fb298caac7ca/go.mod h1:2TGl1jRJrRpbzykmg7asHm3h08TqutUgQqY5v9k/g3c=
486 github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mTEIGbvhcYU3S8+uSNkuMjx/qZFfhtM=
487 github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
488 github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e h1:vUmf0yezR0y7jJ5pceLHthLaYf4bA5T14B6q39S4q2Q=
489 github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e/go.mod h1:YTIHhz/QFSYnu/EhlF2SpU2Uk+32abacUYA5ZPljz1A=
490-github.com/diskfs/go-diskfs v1.9.3 h1:cLciNCeZ4QAXVxyPJDr1ZJ9N9CCG3rQlQ/z/Cs/cNDM=
491-github.com/diskfs/go-diskfs v1.9.3/go.mod h1:TePJORO83Adh5pb2SqsxAwaP0fofFxKLkxctiS/9OQc=
492+github.com/diskfs/go-diskfs v1.9.4 h1:0j2d7eG4IjyxL6+ChWbDPocdBCF6HQ4HBWU2WDYWVnc=
493+github.com/diskfs/go-diskfs v1.9.4/go.mod h1:TePJORO83Adh5pb2SqsxAwaP0fofFxKLkxctiS/9OQc=
494 github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
495 github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
496 github.com/djherbis/times v1.6.0 h1:w2ctJ92J8fBvWPxugmXIv7Nz7Q3iDMKNx9v5ocVH20c=
497 github.com/djherbis/times v1.6.0/go.mod h1:gOHeRAz2h+VJNZ5Gmc/o7iD9k4wW7NMVqieYCY99oc0=
498-github.com/docker/cli v29.5.3+incompatible h1:nbEFfz774vBwQ5KRYv7c/AghjReqnGISvrRhzjV0evs=
499-github.com/docker/cli v29.5.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
500+github.com/docker/cli v29.7.2+incompatible h1:dlkwallR8XqfeVnA2ELEhdwvb4lsSwuB4IgsG8Q9cLY=
501+github.com/docker/cli v29.7.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
502 github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=
503 github.com/docker/docker v28.5.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
504 github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf0mN39c=
505@@ -165,18 +169,18 @@ github.com/elliotwutingfeng/asciiset v0.0.0-20260129054604-cfde2086bc57/go.mod h
506 github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw=
507 github.com/felixge/fgprof v0.9.5 h1:8+vR6yu2vvSKn08urWyEuxx75NWPEvybbkBirEpsbVY=
508 github.com/felixge/fgprof v0.9.5/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM=
509-github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
510-github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
511+github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
512+github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
513 github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
514 github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
515 github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
516 github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
517 github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
518 github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
519-github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
520-github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
521-github.com/gaissmai/bart v0.26.1 h1:+w4rnLGNlA2GDVn382Tfe3jOsK5vOr5n4KmigJ9lbTo=
522-github.com/gaissmai/bart v0.26.1/go.mod h1:GREWQfTLRWz/c5FTOsIw+KkscuFkIV5t8Rp7Nd1Td5c=
523+github.com/fxamacker/cbor/v2 v2.9.3 h1:oQBnFATpNdY8gJHTndDDv5Xl4QqNaz51G5LLEPhng3Q=
524+github.com/fxamacker/cbor/v2 v2.9.3/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
525+github.com/gaissmai/bart v0.29.0 h1:wO6HGE8g9YE0Wm0bCpYxwRzfQ4+fbJKOhL64e5ACGCI=
526+github.com/gaissmai/bart v0.29.0/go.mod h1:GREWQfTLRWz/c5FTOsIw+KkscuFkIV5t8Rp7Nd1Td5c=
527 github.com/github/fakeca v0.1.0 h1:Km/MVOFvclqxPM9dZBC4+QE564nU4gz4iZ0D9pMw28I=
528 github.com/github/fakeca v0.1.0/go.mod h1:+bormgoGMMuamOscx7N91aOuUST7wdaJ2rNjeohylyo=
529 github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
530@@ -193,11 +197,11 @@ github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQ
531 github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
532 github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
533 github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
534-github.com/go-json-experiment/json v0.0.0-20260601182631-00ed12fed2a6 h1:nxP4pPoyqOAgX8lYDFCfl3DyKeXErCvSvhcyzwGV9CE=
535-github.com/go-json-experiment/json v0.0.0-20260601182631-00ed12fed2a6/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
536+github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3 h1:UADEEmDKgfXbtnGJZ97beY5XLo9ZechG1nlU4KnRrkE=
537+github.com/go-json-experiment/json v0.0.0-20260820222146-c27c302e5fc3/go.mod h1:tphK2c80bpPhMOI4v6bIc2xWywPfbqi1Z06+RcrMkDg=
538 github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
539-github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
540-github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
541+github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
542+github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
543 github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
544 github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
545 github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
546@@ -208,8 +212,8 @@ github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
547 github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
548 github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
549 github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
550-github.com/go4org/hashtriemap v0.0.0-20251130024219-545ba229f689 h1:0psnKZ+N2IP43/SZC8SKx6OpFJwLmQb9m9QyV9BC2f8=
551-github.com/go4org/hashtriemap v0.0.0-20251130024219-545ba229f689/go.mod h1:OGmRfY/9QEK2P5zCRtmqfbCF283xPkU2dvVA4MvbvpI=
552+github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9 h1:J8S+Ms89nvHX1F9Ma2m3KhdTl41ZhbFKMyAJqvDA+iE=
553+github.com/go4org/hashtriemap v0.0.0-20260925222741-44e5305f85d9/go.mod h1:OGmRfY/9QEK2P5zCRtmqfbCF283xPkU2dvVA4MvbvpI=
554 github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737 h1:cf60tHxREO3g1nroKr2osU3JWZsJzkfi7rEg+oAB0Lo=
555 github.com/go4org/plan9netshell v0.0.0-20250324183649-788daa080737/go.mod h1:MIS0jDzbU/vuM9MC4YnBITCv+RYuTRq8dJzmCrFsK9g=
556 github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
557@@ -237,10 +241,10 @@ github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4r
558 github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
559 github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
560 github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
561-github.com/google/go-tpm v0.9.4 h1:awZRf9FwOeTunQmHoDYSHJps3ie6f1UlhS1fOdPEt1I=
562-github.com/google/go-tpm v0.9.4/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY=
563-github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806 h1:wG8RYIyctLhdFk6Vl1yPGtSRtwGpVkWyZww1OCil2MI=
564-github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806/go.mod h1:Beg6V6zZ3oEn0JuiUQ4wqwuyqqzasOltcoXPtgLbFp4=
565+github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
566+github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY=
567+github.com/google/nftables v0.3.0 h1:bkyZ0cbpVeMHXOrtlFc8ISmfVqq5gPJukoYieyVmITg=
568+github.com/google/nftables v0.3.0/go.mod h1:BCp9FsrbF1Fn/Yu6CLUc9GGZFw/+hsxfluNXXmxBfRM=
569 github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
570 github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
571 github.com/google/pprof v0.0.0-20260604005048-7023385849c0 h1:h1QTMDl6q9wDvDCJVpKQSjgleGFYnd2fOxmg2K+6BGE=
572@@ -271,8 +275,8 @@ github.com/illarion/gonotify/v3 v3.0.2 h1:O7S6vcopHexutmpObkeWsnzMJt/r1hONIEogeV
573 github.com/illarion/gonotify/v3 v3.0.2/go.mod h1:HWGPdPe817GfvY3w7cx6zkbzNZfi3QjcBm/wgVvEL1U=
574 github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
575 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
576-github.com/insomniacslk/dhcp v0.0.0-20240129002554-15c9b8791914 h1:kD8PseueGeYiid/Mmcv17Q0Qqicc4F46jcX22L/e/Hs=
577-github.com/insomniacslk/dhcp v0.0.0-20240129002554-15c9b8791914/go.mod h1:3A9PQ1cunSDF/1rbTq99Ts4pVnycWg+vlPkfeD2NLFI=
578+github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae h1:nXGg65fXsylSUTNNWwvHuQsXev7mhIzQTnZREPTbWzs=
579+github.com/insomniacslk/dhcp v0.0.0-20260901064844-234b97448fae/go.mod h1:tGfUTcnFYGYvVNCaZZhwlJySU/fQQxh9TmpsFzWXnnY=
580 github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
581 github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
582 github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
583@@ -283,16 +287,12 @@ github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo
584 github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
585 github.com/jagottsicher/termcolor v1.0.2 h1:fo0c51pQSuLBN1+yVX2ZE+hE+P7ULb/TY8eRowJnrsM=
586 github.com/jagottsicher/termcolor v1.0.2/go.mod h1:RcH8uFwF/0wbEdQmi83rjmlJ+QOKdMSE9Rc1BEB7zFo=
587-github.com/jellydator/ttlcache/v3 v3.1.0 h1:0gPFG0IHHP6xyUyXq+JaD8fwkDCqgqwohXNJBcYE71g=
588-github.com/jellydator/ttlcache/v3 v3.1.0/go.mod h1:hi7MGFdMAwZna5n2tuvh63DvFLzVKySzCVW6+0gA2n4=
589+github.com/jellydator/ttlcache/v3 v3.4.1 h1:bOdXmXiycyK6E6Qjyuj5vl+/vU3SCOoDs8a86NbHjAQ=
590+github.com/jellydator/ttlcache/v3 v3.4.1/go.mod h1:j7LO12PNghFg5+0v9budMAT4rDK4JY969jb9vOdOBBk=
591 github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
592 github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
593 github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
594 github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
595-github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
596-github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
597-github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
598-github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
599 github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
600 github.com/jsimonetti/rtnetlink v1.4.2 h1:Df9w9TZ3npHTyDn0Ev9e1uzmN2odmXd0QX+J5GTEn90=
601 github.com/jsimonetti/rtnetlink v1.4.2/go.mod h1:92s6LJdE+1iOrw+F2/RO7LYI2Qd8pPpFNNUYW06gcoM=
602@@ -300,8 +300,8 @@ github.com/kamstrup/intmap v0.5.2 h1:qnwBm1mh4XAnW9W9Ue9tZtTff8pS6+s6iKF6JRIV2Dk
603 github.com/kamstrup/intmap v0.5.2/go.mod h1:gWUVWHKzWj8xpJVFf5GC0O26bWmv3GqdnIX/LMT6Aq4=
604 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
605 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
606-github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
607-github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
608+github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA=
609+github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
610 github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
611 github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
612 github.com/kortschak/wol v0.0.0-20200729010619-da482cc4850a h1:+RR6SqnTkDLWyICxS1xpjCi/3dhyV+TgZwA6Ww3KncQ=
613@@ -323,28 +323,28 @@ github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ
614 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
615 github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
616 github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
617-github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ=
618-github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
619+github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
620+github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
621 github.com/mattn/go-runewidth v0.0.24 h1:cpokDiIn0MGnhdHwuWnJBITySJ20QyNGnY2kR/ay2DU=
622 github.com/mattn/go-runewidth v0.0.24/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
623-github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
624-github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o=
625-github.com/mdlayher/netlink v1.8.0 h1:e7XNIYJKD7hUct3Px04RuIGJbBxy1/c4nX7D5YyvvlM=
626-github.com/mdlayher/netlink v1.8.0/go.mod h1:UhgKXUlDQhzb09DrCl2GuRNEglHmhYoWAHid9HK3594=
627+github.com/mdlayher/genetlink v1.4.0 h1:f/Xs7Y2T+GyX9b3dbiUhnLE9InGs5F9RxJ2JwBMl71o=
628+github.com/mdlayher/genetlink v1.4.0/go.mod h1:d1hrKr8fwZU2JkcAtQUAzeTrI7nbgQSl+5k1cC0biSA=
629+github.com/mdlayher/netlink v1.11.2 h1:HKh2jqe+omdSWcQ88nrT7INE61B0NXfiSPFdgL4YbNI=
630+github.com/mdlayher/netlink v1.11.2/go.mod h1:uT2Yc/QLaZubzDpZIBi9d4GoeLwtp3x1AMeqSRrK2sA=
631 github.com/mdlayher/sdnotify v1.0.0 h1:Ma9XeLVN/l0qpyx1tNeMSeTjCPH6NtuD6/N9XdTlQ3c=
632 github.com/mdlayher/sdnotify v1.0.0/go.mod h1:HQUmpM4XgYkhDLtd+Uad8ZFK1T9D5+pNxnXQjCeJlGE=
633-github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
634-github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
635-github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4=
636-github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY=
637+github.com/mdlayher/socket v0.7.0 h1:qVREPVwtUMg17pwvveQxpurq0PVisMxi3FGgpsorMYQ=
638+github.com/mdlayher/socket v0.7.0/go.mod h1:f7iKql2EK/rfsWYDKofKjk2Ig7I+6HQWdMIdn1tO4A4=
639+github.com/miekg/dns v1.1.73 h1:uhT8nJxmTrPJYClxVxTCX+CVn6qnzSiybRk72Z6DgrE=
640+github.com/miekg/dns v1.1.73/go.mod h1:RW2Obtfd5NZHvOFe3zYG0W8koWOQtAzyHaLo8vASBuQ=
641 github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
642 github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
643 github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
644 github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
645-github.com/moby/moby/api v1.54.2 h1:wiat9QAhnDQjA7wk1kh/TqHz2I1uUA7M7t9SAl/JNXg=
646-github.com/moby/moby/api v1.54.2/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs=
647-github.com/moby/moby/client v0.4.1 h1:DMQgisVoMkmMs7fp3ROSdiBnoAu8+vo3GggFl06M/wY=
648-github.com/moby/moby/client v0.4.1/go.mod h1:z52C9O2POPOsnxZAy//WtKcQ32P+jT/NGeXu/7nfjGQ=
649+github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc=
650+github.com/moby/moby/api v1.55.0/go.mod h1:+RQ6wluLwtYaTd1WnPLykIDPekkuyD/ROWQClE83pzs=
651+github.com/moby/moby/client v0.5.1 h1:tYNaJno4c0HXz12y5BiqEDy0rVTYkWzI26lGvnTMiJw=
652+github.com/moby/moby/client v0.5.1/go.mod h1:odLstlZ6uSnfvAgVxMpvgmb8SUdd+siH2T0GBuxVAlM=
653 github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=
654 github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
655 github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU=
656@@ -372,8 +372,8 @@ github.com/opencontainers/runc v1.3.2/go.mod h1:F7UQQEsxcjUNnFpT1qPLHZBKYP7yWwk6
657 github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
658 github.com/ory/dockertest/v3 v3.12.0 h1:3oV9d0sDzlSQfHtIaB5k6ghUCVMVLpAY8hwrqoCyRCw=
659 github.com/ory/dockertest/v3 v3.12.0/go.mod h1:aKNDTva3cp8dwOWwb9cWuX84aH5akkxXRvO7KCwWVjE=
660-github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=
661-github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
662+github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY=
663+github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
664 github.com/peterbourgon/ff/v3 v3.4.0 h1:QBvM/rizZM1cB0p0lGMdmR7HxZeI/ZrBWB4DqLkMUBc=
665 github.com/peterbourgon/ff/v3 v3.4.0/go.mod h1:zjJVUhx+twciwfDl0zBcFzl4dW8axCRyXE/eKY9RztQ=
666 github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
667@@ -383,27 +383,25 @@ github.com/philip-bui/grpc-zerolog v1.0.1 h1:EMacvLRUd2O1K0eWod27ZP5CY1iTNkhBDLS
668 github.com/philip-bui/grpc-zerolog v1.0.1/go.mod h1:qXbiq/2X4ZUMMshsqlWyTHOcw7ns+GZmlqZZN05ZHcQ=
669 github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY=
670 github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4=
671-github.com/pires/go-proxyproto v0.9.2 h1:H1UdHn695zUVVmB0lQ354lOWHOy6TZSpzBl3tgN0s1U=
672-github.com/pires/go-proxyproto v0.9.2/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU=
673+github.com/pires/go-proxyproto v0.15.0 h1:dTshmNbFm/D+0+sbrxUuddPOZ5Y0B7c5NhtsBkm6LqI=
674+github.com/pires/go-proxyproto v0.15.0/go.mod h1:OXsCrKwrK2tXS9YrI5tkHx5xaQlO8FH3lFW76orFh24=
675 github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
676 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
677 github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA=
678 github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo=
679-github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo=
680-github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk=
681+github.com/pkg/sftp v1.13.11 h1:0N92SLTB8JqASJB14ZLHHzFnBV8mG9zw4K7jghEFWuE=
682+github.com/pkg/sftp v1.13.11/go.mod h1:uNkH9roSXglNJqM+glJJi+TQXQUm0fXFWqCFmT8hsN0=
683 github.com/pkg/xattr v0.4.12 h1:rRTkSyFNTRElv6pkA3zpjHpQ90p/OdHQC1GmGh1aTjM=
684 github.com/pkg/xattr v0.4.12/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU=
685 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
686-github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
687-github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
688-github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
689-github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
690-github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
691-github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
692-github.com/prometheus/common v0.69.0 h1:OA85nJQS/T/MaYh/Q2CcgDKSGWqNIgrBDvDH85CuiNk=
693-github.com/prometheus/common v0.69.0/go.mod h1:ZzL3f6u94qUxh9p+tJTrF+FvBS1XXbbRAZCQkytAL0Y=
694-github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
695-github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
696+github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
697+github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
698+github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=
699+github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM=
700+github.com/prometheus/common v0.71.0 h1:9KDAKb7Mj3HEVKyFCK6Dc/HIwlBzZIN2l7/lrHl3KK8=
701+github.com/prometheus/common v0.71.0/go.mod h1:CLJ5H8TEsGX8bl31BdMkfhIZ+QmZ9tBPPotUxUbfcmk=
702+github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
703+github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
704 github.com/pterm/pterm v0.12.83 h1:ie+YmGmA727VuhxBlyGr74Ks+7McV6kT99IB8EU80aA=
705 github.com/pterm/pterm v0.12.83/go.mod h1:xlgc6bFWyJIMtmLJvGim+L7jhSReilOlOnodeIYe4Tk=
706 github.com/puzpuzpuz/xsync/v4 v4.5.0 h1:vOSWu6b57/emh+L/Cw0BeQfvxa/cogFywXHeGUxQxAg=
707@@ -412,8 +410,8 @@ github.com/realclientip/realclientip-go v1.0.0 h1:+yPxeC0mEaJzq1BfCt2h4BxlyrvIIB
708 github.com/realclientip/realclientip-go v1.0.0/go.mod h1:CXnUdVwFRcXFJIRb/dTYqbT7ud48+Pi2pFm80bxDmcI=
709 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
710 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
711-github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
712-github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
713+github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g=
714+github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs=
715 github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI=
716 github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw=
717 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
718@@ -427,8 +425,8 @@ github.com/sasha-s/go-deadlock v0.3.9 h1:fiaT9rB7g5sr5ddNZvlwheclN9IP86eFW9WgqlE
719 github.com/sasha-s/go-deadlock v0.3.9/go.mod h1:KuZj51ZFmx42q/mPaYbRk0P1xcwe697zsJKE03vD4/Y=
720 github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw=
721 github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
722-github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
723-github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
724+github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBBo=
725+github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q=
726 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
727 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
728 github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
729@@ -444,60 +442,60 @@ github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
730 github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
731 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
732 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
733-github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
734-github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
735+github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
736+github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
737 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
738 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
739 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
740 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
741-github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
742-github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
743+github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
744+github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
745 github.com/studio-b12/gowebdav v0.13.0 h1:OcwSg6IQHOFNdYHn3bPOHwSE8looG8N56Y5xTT1asqQ=
746 github.com/studio-b12/gowebdav v0.13.0/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
747 github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
748 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
749 github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d h1:JcGKBZAL7ePLwOhUdN8qGQZlP5GueEiIZwY7R62pejE=
750 github.com/tailscale/certstore v0.1.1-0.20260409135935-3638fb84b77d/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4=
751-github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28 h1:Azz5ILxxVsHN/KjIu3wkJPAmmtiijucZw4Ax5Ye8n+s=
752-github.com/tailscale/gliderssh v0.3.4-0.20260716005906-1a0f895faf28/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw=
753+github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a h1:LQfS++EBVN2Bk9/FbFjJmdP/CsebU0OupOX58tO4p04=
754+github.com/tailscale/gliderssh v0.3.4-0.20261026144310-31f7cf365d3a/go.mod h1:wn16Km1EZOX4UEAyaZa3dBwfFGOJ7neck40NcwosJUw=
755 github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4=
756 github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55/go.mod h1:4k4QO+dQ3R5FofL+SanAUZe+/QfeK0+OIuwDIRu2vSg=
757-github.com/tailscale/golang-x-crypto v0.0.0-20260720153645-2ba0bf7866ed h1:uyvHhX1FQada0vVk8CSHa4tJT96EEAkTypaYz8Tq5Nc=
758-github.com/tailscale/golang-x-crypto v0.0.0-20260720153645-2ba0bf7866ed/go.mod h1:NC3xRCu4UR+m4n6ix8b6oLLbHa820Y0StbOQEdWTDo0=
759-github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd h1:Rf9uhF1+VJ7ZHqxrG8pJ6YacmHvVCmByDmGbAWCc/gA=
760-github.com/tailscale/hujson v0.0.0-20260302212456-ecc657c15afd/go.mod h1:EbW0wDK/qEUYI0A5bqq0C2kF8JTQwWONmGDBbzsxxHo=
761+github.com/tailscale/golang-x-crypto v0.0.0-20260720160339-c86ca1284b96 h1:m9EAsCu/afUkg9YkknXaRqMPl/omkUNRol5yB7hbG0Y=
762+github.com/tailscale/golang-x-crypto v0.0.0-20260720160339-c86ca1284b96/go.mod h1:NC3xRCu4UR+m4n6ix8b6oLLbHa820Y0StbOQEdWTDo0=
763+github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f h1:9hiVElpCmKzsBKQHkBqZ8LGzt82iLfM8egxr4sew+Ys=
764+github.com/tailscale/hujson v0.0.0-20260727124030-b80ff77dac4f/go.mod h1:8/zr1Tv0+cKpVtGCEB/7YfRXr2TszsMxMXLaT8YuBgU=
765 github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7 h1:uFsXVBE9Qr4ZoF094vE6iYTLDl0qCiKzYXlL6UeWObU=
766 github.com/tailscale/netlink v1.1.1-0.20240822203006-4d49adab4de7/go.mod h1:NzVQi3Mleb+qzq8VmcWpSkcSYxXIg0DkI6XDzpVkhJ0=
767 github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc h1:24heQPtnFR+yfntqhI3oAu9i27nEojcQ4NuBQOo5ZFA=
768 github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc/go.mod h1:f93CXfllFsO9ZQVq+Zocb1Gp4G5Fz0b0rXHLOzt/Djc=
769-github.com/tailscale/setec v0.0.0-20260310221408-dcd97e42f251 h1:kNnJlwxSzue+VRJuDdZ/yebcMM2q9KqFmK9xQqH1YRc=
770-github.com/tailscale/setec v0.0.0-20260310221408-dcd97e42f251/go.mod h1:6NU8H/GLPVX2TnXAY1duyy9ylLaHwFpr0X93UPiYmNI=
771+github.com/tailscale/setec v0.0.0-20260824224040-f8d7a936837c h1:J0aTCtzXxik475w8EXUbP/0LK6l3+06MwWdybrsXOmM=
772+github.com/tailscale/setec v0.0.0-20260824224040-f8d7a936837c/go.mod h1:ILYCfHqZuCwIE4+ajWhLYaFBkoYij3P1uFv4K86BhRA=
773 github.com/tailscale/squibble v0.0.0-20260411062017-141f5d618bc4 h1:1ghkd9YIC4J7umZuu9jZz8afWJSj1hCRSzfvdI2Q3Vo=
774 github.com/tailscale/squibble v0.0.0-20260411062017-141f5d618bc4/go.mod h1:EVp9PDh7v69Do6aNzFfLvL0fdCph3XskGMi+WcS/uOM=
775 github.com/tailscale/tailsql v0.0.0-20260522170732-77aec5aabc76 h1:o7mEEIci+U0H3Ddo0JRMOxm2VGcCKaVPro/F+f3qFbg=
776 github.com/tailscale/tailsql v0.0.0-20260522170732-77aec5aabc76/go.mod h1:N2Dm+UzRWz01zPMDl5XHkSVq91kNPWU13uUUibcOm+c=
777-github.com/tailscale/web-client-prebuilt v0.0.0-20251127225136-f19339b67368 h1:0tpDdAj9sSfSZg4gMwNTdqMP592sBrq2Sm0w6ipnh7k=
778-github.com/tailscale/web-client-prebuilt v0.0.0-20251127225136-f19339b67368/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ=
779+github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea h1:ah5jt6ZnxMvNclt6kBBoLcMpLLjMA44PTsnov2y7gpU=
780+github.com/tailscale/web-client-prebuilt v0.0.0-20260917222731-e0ed2d0d0fea/go.mod h1:agQPE6y6ldqCOui2gkIh7ZMztTkIQKH049tv8siLuNQ=
781 github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6 h1:l10Gi6w9jxvinoiq15g8OToDdASBni4CyJOdHY1Hr8M=
782 github.com/tailscale/wf v0.0.0-20240214030419-6fbb0a674ee6/go.mod h1:ZXRML051h7o4OcI0d3AaILDIad/Xw0IkXaHM17dic1Y=
783-github.com/tailscale/wireguard-go v0.0.0-20260715223240-2e01ba5b00f0 h1:CnIEL2n7Xql6Ux1k+Vu5S5ubDHCT/kxFgkKCY8FjefU=
784-github.com/tailscale/wireguard-go v0.0.0-20260715223240-2e01ba5b00f0/go.mod h1:6SerzcvHWQchKO2BfNdmquA77CHSECZuFl+D9fp4RnI=
785+github.com/tailscale/wireguard-go v0.0.0-20260928213032-417aef361226 h1:v3Lpj2iHPWQDqeCwemQPz4fWweIEMLqBkwJqCjRyJQc=
786+github.com/tailscale/wireguard-go v0.0.0-20260928213032-417aef361226/go.mod h1:rUelGmuK4UnSJYM5gl5Mknp6YbwwcL8+VAPMhNYe+jg=
787 github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e h1:zOGKqN5D5hHhiYUp091JqK7DPCqSARyUfduhGUY8Bek=
788 github.com/tailscale/xnet v0.0.0-20240729143630-8497ac4dab2e/go.mod h1:orPd6JZXXRyuDusYilywte7k094d7dycXXU5YnWsrwg=
789-github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA=
790-github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
791+github.com/tc-hib/winres v0.3.1 h1:CwRjEGrKdbi5CvZ4ID+iyVhgyfatxFoizjPhzez9Io4=
792+github.com/tc-hib/winres v0.3.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
793 github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e h1:IWllFTiDjjLIf2oeKxpIUmtiDV5sn71VgeQgg6vcE7k=
794 github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e/go.mod h1:d7u6HkTYKSv5m6MCKkOQlHwaShTMl3HjqSGW3XtVhXM=
795 github.com/tink-crypto/tink-go/v2 v2.6.0 h1:+KHNBHhWH33Vn+igZWcsgdEPUxKwBMEe0QC60t388v4=
796 github.com/tink-crypto/tink-go/v2 v2.6.0/go.mod h1:2WbBA6pfNsAfBwDCggboaHeB2X29wkU8XHtGwh2YIk8=
797-github.com/toqueteos/webbrowser v1.2.0 h1:tVP/gpK69Fx+qMJKsLE7TD8LuGWPnEV71wBN9rrstGQ=
798-github.com/toqueteos/webbrowser v1.2.0/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM=
799-github.com/u-root/u-root v0.14.0 h1:Ka4T10EEML7dQ5XDvO9c3MBN8z4nuSnGjcd1jmU2ivg=
800-github.com/u-root/u-root v0.14.0/go.mod h1:hAyZorapJe4qzbLWlAkmSVCJGbfoU9Pu4jpJ1WMluqE=
801+github.com/toqueteos/webbrowser v1.2.1 h1:O7IsnnU7XQyJ1nHMRfAktUUJOAZD3aQyUVnxzhWphCg=
802+github.com/toqueteos/webbrowser v1.2.1/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM=
803+github.com/u-root/u-root v0.16.0 h1:wY40O83MBVks97+Is0WlFlOPSwKQMIrWP9R1IsrExg8=
804+github.com/u-root/u-root v0.16.0/go.mod h1:yL/XdSSW27PdGLgUh4MNRBy54mKM+TBLzpwiB4nwj90=
805 github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=
806 github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
807-github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
808-github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
809+github.com/ulikunitz/xz v0.5.16 h1:ld6NyySjx5lowVKwJvMRLnW5nxKX/xnpSiFYZ/Lxur0=
810+github.com/ulikunitz/xz v0.5.16/go.mod h1:H9Rt/W6/Qj27PGauhQc6nfCDy7vHpzsOThBSaYDoEhw=
811 github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
812 github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
813 github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
814@@ -509,50 +507,51 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
815 github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
816 github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
817 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
818-github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
819-github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
820+github.com/xo/terminfo v1.0.0 h1:2ZpYzqWzyyytjk3TP6aJVDhkMAkc99/1xKQdA3TDTBY=
821+github.com/xo/terminfo v1.0.0/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
822 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
823 go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
824 go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
825-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo=
826-go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI=
827-go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
828-go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
829+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI=
830+go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04=
831+go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU=
832+go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ=
833 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k=
834 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A=
835 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJKlCZufyRzPzlQhUIWVmfltrXuGyfjREgGP3UUjc=
836 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak=
837-go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
838-go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
839-go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
840-go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
841-go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
842-go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
843-go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
844-go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
845+go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M=
846+go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s=
847+go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw=
848+go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA=
849+go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o=
850+go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA=
851+go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag=
852+go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
853 go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
854 go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
855 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
856 go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
857 go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
858 go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
859-go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
860 go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
861+go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
862+go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
863 go4.org/mem v0.0.0-20240501181205-ae6ca9944745 h1:Tl++JLUCe4sxGu8cTpDzRLd3tN7US4hOxG5YpKCzkek=
864 go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g=
865-go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
866-go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
867+go4.org/netipx v0.0.0-20260823151212-3075585bcbeb h1:XBM4hvfwGAttkkiTIFfeigdfcL1xIfdKXqFdgiHGtDs=
868+go4.org/netipx v0.0.0-20260823151212-3075585bcbeb/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
869 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
870 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
871 golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
872-golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
873-golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
874-golang.org/x/exp v0.0.0-20260603202125-055de637280b h1:v1uXiEBHo8QA0LiGCo7UgHMzHT4Kdfpl2zmtH5vaP1Q=
875-golang.org/x/exp v0.0.0-20260603202125-055de637280b/go.mod h1:d2fgXJLVs4dYDHUk5lwMIfzRzSrWCfGZb0ZqeLa/Vcw=
876-golang.org/x/exp/typeparams v0.0.0-20260603202125-055de637280b h1:E7MAoHE/7prIY6tu29UATfH3hVHv6IWqOchjE48pTAU=
877-golang.org/x/exp/typeparams v0.0.0-20260603202125-055de637280b/go.mod h1:PqrXSW65cXDZH0k4IeUbhmg/bcAZDbzNz3byBpKCsXo=
878-golang.org/x/image v0.41.0 h1:8wS72eGJMJaBxK6okTzd4WaXumUlTVlb753MlsSvTCo=
879-golang.org/x/image v0.41.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA=
880+golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
881+golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
882+golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba h1:Ck8QetSgk912qxWLMCKxd0in+aiyBQyDSMae6e/xmpU=
883+golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba/go.mod h1:50RgIsmK7OwqzTTeqcSXQW8SswW0o8fRcDxmqGluJ8E=
884+golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f h1:+lI8cDJ4uceLipg2f1ODay7fEuLkk0BIHXd6PB8icxo=
885+golang.org/x/exp/typeparams v0.0.0-20260811152304-ee035b5b010f/go.mod h1:PqrXSW65cXDZH0k4IeUbhmg/bcAZDbzNz3byBpKCsXo=
886+golang.org/x/image v0.46.0 h1:b1+oYj0Jbp6K5MDT4i4/eZpYlk3V8SJhhDKh6LBHAyQ=
887+golang.org/x/image v0.46.0/go.mod h1:3B3W05VGVQyuXucLINLjXKrqISASfi4Xj+iCVkLMwew=
888 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
889 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
890 golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
891@@ -564,8 +563,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
892 golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
893 golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU=
894 golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
895-golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
896-golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
897+golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
898+golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
899 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
900 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
901 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
902@@ -585,38 +584,38 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
903 golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
904 golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
905 golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
906-golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
907-golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
908+golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
909+golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
910 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
911 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
912 golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
913 golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
914 golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
915-golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
916-golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
917+golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
918+golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
919 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
920 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
921 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
922 golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
923 golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
924 golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
925-golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
926-golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
927-golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
928-golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
929+golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
930+golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
931+golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
932+golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
933 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
934 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
935 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
936 golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
937-golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
938-golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
939+golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI=
940+golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA=
941 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
942 golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
943 golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
944 golang.zx2c4.com/wireguard v0.0.0-20260522210424-ecfc5a8d5446 h1:cqHQ3AycTHvM2R7ikgyX57D+XvtcSnGylsLkOVhta/w=
945 golang.zx2c4.com/wireguard v0.0.0-20260522210424-ecfc5a8d5446/go.mod h1:rpwXGsirqLqN2L0JDJQlwOboGHmptD5ZD6T2VmcqhTw=
946-golang.zx2c4.com/wireguard/windows v0.5.3 h1:On6j2Rpn3OEMXqBq00QEDC7bWSZrPIHKIus8eIuExIE=
947-golang.zx2c4.com/wireguard/windows v0.5.3/go.mod h1:9TEe8TJmtwyQebdFwAkEWOPr3prrtqm+REGFifP60hI=
948+golang.zx2c4.com/wireguard/windows v1.0.1 h1:eOxiDVbywPC+ZQqvdCK7x+ZwWXKbYv50TtH8ysFIbw8=
949+golang.zx2c4.com/wireguard/windows v1.0.1/go.mod h1:+fbT3FFdX4zzYDLwJh5+HPEcNN/3HyNdzhNSVsQM+zs=
950 gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
951 gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
952 google.golang.org/genproto/googleapis/api v0.0.0-20260610212136-7ab31c22f7ad h1:3iLyITS/sySRwbUKoC7ogfj2Yr1Cjs0pfaRKj5U5HEw=
953@@ -625,14 +624,11 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:
954 google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
955 google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU=
956 google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8=
957-google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
958-google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
959+google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
960+google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
961 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
962 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
963 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
964-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
965-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
966-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
967 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
968 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
969 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
970@@ -642,14 +638,14 @@ gorm.io/gorm v1.31.1 h1:7CA8FTFz/gRfgqgpeKIBcervUn3xSyPUmr6B2WXJ7kg=
971 gorm.io/gorm v1.31.1/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
972 gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
973 gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
974-gvisor.dev/gvisor v0.0.0-20260224225140-573d5e7127a8 h1:Zy8IV/+FMLxy6j6p87vk/vQGKcdnbprwjTxc8UiUtsA=
975-gvisor.dev/gvisor v0.0.0-20260224225140-573d5e7127a8/go.mod h1:QkHjoMIBaYtpVufgwv3keYAbln78mBoCuShZrPrer1Q=
976+gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72 h1:EytKYr5WrVs+Aah/0xDO8ZAZZzS/iTEVC8ln4ipDbL0=
977+gvisor.dev/gvisor v0.0.0-20260915211658-a6f909f08a72/go.mod h1:8aLQqUBHDH8fY5y60lzmwDpMMbQCcT3EBfoSwhfaGCY=
978 honnef.co/go/tools v0.8.1 h1:+JKf3xJ1ni4CwrhVg4/pqsfPGP6vNAXcKbMXJodYx3w=
979 honnef.co/go/tools v0.8.1/go.mod h1:XA+OnlRA9EDh/ukGvXMNSZNKGwFQJ+5dER0ioUkOxks=
980 howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
981 howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
982-k8s.io/client-go v0.34.0 h1:YoWv5r7bsBfb0Hs2jh8SOvFbKzzxyNo0nSb0zC19KZo=
983-k8s.io/client-go v0.34.0/go.mod h1:ozgMnEKXkRjeMvBZdV1AijMHLTh3pbACPvK7zFR+QQY=
984+k8s.io/client-go v0.37.0 h1:nsN31fy8wBySuZ+QRnKmrjRSQLOG2rvoGN0tKd12zhQ=
985+k8s.io/client-go v0.37.0/go.mod h1:FcGqw+Ll/gNQiq+nPGY1Oyt9y7SgDh1d3MW3RFDEbn0=
986 modernc.org/cc/v4 v4.28.2 h1:3tQ0lf2ADtoby2EtSP+J7IE2SHwEJdP8ioR59wx7XpY=
987 modernc.org/cc/v4 v4.28.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
988 modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ=
989@@ -682,9 +678,9 @@ pgregory.net/rapid v1.3.0 h1:vBvO0VSqti75J1jjYqpgPNBLKMd1+gxa9fYo7vk/Exc=
990 pgregory.net/rapid v1.3.0/go.mod h1:dPlE4OBBxgXPqkP79flB6sJL1dx5azpI7HQ9MY9Z7uk=
991 sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
992 sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
993-software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k=
994-software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
995-tailscale.com v1.102.0 h1:yAYrykMZWlgp7Qq2ECDrDnxeySWBhNXNMkXdDmVMyrE=
996-tailscale.com v1.102.0/go.mod h1:NdndXfkSklVPbRUZMAzzRuDNaR5B+YWGbAyE1HpSQZg=
997+software.sslmate.com/src/go-pkcs12 v0.7.3 h1:JBQD3FDqYjTeyDAeZQklj2ar88ykBLtALloPJHyAauU=
998+software.sslmate.com/src/go-pkcs12 v0.7.3/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
999+tailscale.com v1.104.5 h1:TLemRww20+bcQ0FEVTTZ7yMtVDZ4pOpSCL86Oo9g3mA=
1000+tailscale.com v1.104.5/go.mod h1:Hq4zB8UpaxMW1fvqO30CLVQo3A7Ith0t9MnvEyiuoSA=
1001 zombiezen.com/go/postgrestest v1.0.1 h1:aXoADQAJmZDU3+xilYVut0pHhgc0sF8ZspPW9gFNwP4=
1002 zombiezen.com/go/postgrestest v1.0.1/go.mod h1:marlZezr+k2oSJrvXHnZUs1olHqpE9czlz8ZYkVxliQ=
1003diff --git a/hscontrol/app.go b/hscontrol/app.go
1004index 864252f..654d7e0 100644
1005--- a/hscontrol/app.go
1006+++ b/hscontrol/app.go
1007@@ -98,6 +98,7 @@ type Headscale struct {
1008 state *state.State
1009 noisePrivateKey *key.MachinePrivate
1010 ephemeralGC *db.EphemeralGarbageCollector
1011+ tkad *tkaAdapter
1012
1013 DERPServer *derpServer.DERPServer
1014
1015@@ -642,6 +643,10 @@ func (h *Headscale) Serve() error {
1016 Str("minimum_version", capver.TailscaleVersion(capver.MinSupportedCapabilityVersion)).
1017 Msg("Clients with a lower minimum version will be rejected")
1018
1019+ if err := h.initTKA(); err != nil {
1020+ return fmt.Errorf("initializing omnet adapter: %w", err)
1021+ }
1022+
1023 h.mapBatcher = mapper.NewBatcherAndMapper(h.cfg, h.state)
1024
1025 h.mapBatcher.Start()
1026@@ -701,6 +706,7 @@ func (h *Headscale) Serve() error {
1027 defer scheduleCancel()
1028
1029 go h.scheduledTasks(scheduleCtx)
1030+ go h.watchTKA(scheduleCtx)
1031
1032 if zl.GlobalLevel() == zl.TraceLevel {
1033 zerolog.RespLog = true
1034diff --git a/hscontrol/auth.go b/hscontrol/auth.go
1035index 7f50f80..0c05334 100644
1036--- a/hscontrol/auth.go
1037+++ b/hscontrol/auth.go
1038@@ -331,6 +331,9 @@ func (h *Headscale) waitForFollowup(
1039 case verdict = <-reg.WaitForAuth():
1040 }
1041 }
1042+ if h.tkad != nil && verdict.Err != nil {
1043+ return nil, verdict.Err
1044+ }
1045
1046 if verdict.Accept() {
1047 if !verdict.Node.Valid() {
1048@@ -397,10 +400,12 @@ func registrationDataFromRequest(
1049 }
1050
1051 regData := &types.RegistrationData{
1052- MachineKey: machineKey,
1053- NodeKey: req.NodeKey,
1054- Hostname: hostname,
1055- Hostinfo: req.Hostinfo,
1056+ MachineKey: machineKey,
1057+ NodeKey: req.NodeKey,
1058+ Hostname: hostname,
1059+ Hostinfo: req.Hostinfo,
1060+ TKAKey: req.NLKey,
1061+ TKASignature: append([]byte(nil), req.NodeKeySignature...),
1062 }
1063
1064 if !req.Expiry.IsZero() {
1065diff --git a/hscontrol/db/db.go b/hscontrol/db/db.go
1066index 824afb4..5836e3e 100644
1067--- a/hscontrol/db/db.go
1068+++ b/hscontrol/db/db.go
1069@@ -808,6 +808,18 @@ WHERE tags IS NOT NULL AND tags != '[]' AND tags != '' AND tags != 'null'
1070 },
1071 Rollback: func(db *gorm.DB) error { return nil },
1072 },
1073+ {
1074+ ID: "202610251600-omnet-tka-registration",
1075+ Migrate: func(tx *gorm.DB) error {
1076+ if err := tx.Migrator().AddColumn(&types.Node{}, "TKAKey"); err != nil {
1077+ return err
1078+ }
1079+ if err := tx.Migrator().AddColumn(&types.Node{}, "TKASignature"); err != nil {
1080+ return err
1081+ }
1082+ return tx.Migrator().CreateTable(&types.OmnetCheckpoint{})
1083+ },
1084+ },
1085 },
1086 )
1087
1088@@ -819,6 +831,7 @@ WHERE tags IS NOT NULL AND tags != '[]' AND tags != '' AND tags != 'null'
1089 &types.APIKey{},
1090 &types.Node{},
1091 &types.Policy{},
1092+ &types.OmnetCheckpoint{},
1093 )
1094 if err != nil {
1095 return err
1096diff --git a/hscontrol/db/schema.sql b/hscontrol/db/schema.sql
1097index 781446c..95986af 100644
1098--- a/hscontrol/db/schema.sql
1099+++ b/hscontrol/db/schema.sql
1100@@ -72,6 +72,8 @@ CREATE TABLE nodes(
1101 machine_key text,
1102 node_key text,
1103 disco_key text,
1104+ tka_key text,
1105+ tka_signature blob,
1106
1107 endpoints text,
1108 host_info text,
1109@@ -112,3 +114,8 @@ CREATE TABLE database_versions(
1110 version text NOT NULL,
1111 updated_at datetime
1112 );
1113+
1114+CREATE TABLE omnet_checkpoints(
1115+ id integer PRIMARY KEY AUTOINCREMENT,
1116+ revision integer
1117+);
1118diff --git a/hscontrol/derp/derp.go b/hscontrol/derp/derp.go
1119index 3d0b7d5..f0d2ac2 100644
1120--- a/hscontrol/derp/derp.go
1121+++ b/hscontrol/derp/derp.go
1122@@ -80,7 +80,7 @@ func loadDERPMapFromURL(addr url.URL) (*tailcfg.DERPMap, error) {
1123 func mergeDERPMaps(derpMaps []*tailcfg.DERPMap) *tailcfg.DERPMap {
1124 result := tailcfg.DERPMap{
1125 OmitDefaultRegions: false,
1126- Regions: map[int]*tailcfg.DERPRegion{},
1127+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{},
1128 }
1129
1130 for _, derpMap := range derpMaps {
1131@@ -139,7 +139,7 @@ func shuffleDERPMap(dm *tailcfg.DERPMap) {
1132 // Collect region IDs and sort them to ensure deterministic iteration order.
1133 // Map iteration order is non-deterministic in Go, which would cause the
1134 // shuffle to be non-deterministic even with a fixed seed.
1135- ids := make([]int, 0, len(dm.Regions))
1136+ ids := make([]tailcfg.DERPRegionID, 0, len(dm.Regions))
1137 for id := range dm.Regions {
1138 ids = append(ids, id)
1139 }
1140diff --git a/hscontrol/derp/derp_merge_test.go b/hscontrol/derp/derp_merge_test.go
1141index e1ac412..330bcf5 100644
1142--- a/hscontrol/derp/derp_merge_test.go
1143+++ b/hscontrol/derp/derp_merge_test.go
1144@@ -12,7 +12,7 @@ import (
1145 // cannot mutate a shared or previously served map.
1146 func TestMergeDERPMapsClonesRegions(t *testing.T) {
1147 src := &tailcfg.DERPMap{
1148- Regions: map[int]*tailcfg.DERPRegion{
1149+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1150 1: {RegionID: 1, Nodes: []*tailcfg.DERPNode{{Name: "a"}, {Name: "b"}}},
1151 },
1152 }
1153diff --git a/hscontrol/derp/derp_test.go b/hscontrol/derp/derp_test.go
1154index 445c104..fb0423b 100644
1155--- a/hscontrol/derp/derp_test.go
1156+++ b/hscontrol/derp/derp_test.go
1157@@ -19,7 +19,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1158 name: "single region with 4 nodes",
1159 baseDomain: "test1.example.com",
1160 derpMap: &tailcfg.DERPMap{
1161- Regions: map[int]*tailcfg.DERPRegion{
1162+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1163 1: {
1164 RegionID: 1,
1165 RegionCode: "nyc",
1166@@ -34,7 +34,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1167 },
1168 },
1169 expected: &tailcfg.DERPMap{
1170- Regions: map[int]*tailcfg.DERPRegion{
1171+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1172 1: {
1173 RegionID: 1,
1174 RegionCode: "nyc",
1175@@ -53,7 +53,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1176 name: "multiple regions with nodes",
1177 baseDomain: "test2.example.com",
1178 derpMap: &tailcfg.DERPMap{
1179- Regions: map[int]*tailcfg.DERPRegion{
1180+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1181 10: {
1182 RegionID: 10,
1183 RegionCode: "sea",
1184@@ -77,7 +77,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1185 },
1186 },
1187 expected: &tailcfg.DERPMap{
1188- Regions: map[int]*tailcfg.DERPRegion{
1189+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1190 10: {
1191 RegionID: 10,
1192 RegionCode: "sea",
1193@@ -105,7 +105,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1194 name: "large region with many nodes",
1195 baseDomain: "test3.example.com",
1196 derpMap: &tailcfg.DERPMap{
1197- Regions: map[int]*tailcfg.DERPRegion{
1198+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1199 4: {
1200 RegionID: 4,
1201 RegionCode: "fra",
1202@@ -120,7 +120,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1203 },
1204 },
1205 expected: &tailcfg.DERPMap{
1206- Regions: map[int]*tailcfg.DERPRegion{
1207+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1208 4: {
1209 RegionID: 4,
1210 RegionCode: "fra",
1211@@ -139,7 +139,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1212 name: "same region different base domain",
1213 baseDomain: "different.example.com",
1214 derpMap: &tailcfg.DERPMap{
1215- Regions: map[int]*tailcfg.DERPRegion{
1216+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1217 4: {
1218 RegionID: 4,
1219 RegionCode: "fra",
1220@@ -154,7 +154,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1221 },
1222 },
1223 expected: &tailcfg.DERPMap{
1224- Regions: map[int]*tailcfg.DERPRegion{
1225+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1226 4: {
1227 RegionID: 4,
1228 RegionCode: "fra",
1229@@ -173,7 +173,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1230 name: "same dataset with another base domain",
1231 baseDomain: "another.example.com",
1232 derpMap: &tailcfg.DERPMap{
1233- Regions: map[int]*tailcfg.DERPRegion{
1234+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1235 4: {
1236 RegionID: 4,
1237 RegionCode: "fra",
1238@@ -188,7 +188,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1239 },
1240 },
1241 expected: &tailcfg.DERPMap{
1242- Regions: map[int]*tailcfg.DERPRegion{
1243+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1244 4: {
1245 RegionID: 4,
1246 RegionCode: "fra",
1247@@ -207,7 +207,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1248 name: "same dataset with yet another base domain",
1249 baseDomain: "yetanother.example.com",
1250 derpMap: &tailcfg.DERPMap{
1251- Regions: map[int]*tailcfg.DERPRegion{
1252+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1253 4: {
1254 RegionID: 4,
1255 RegionCode: "fra",
1256@@ -222,7 +222,7 @@ func TestShuffleDERPMapDeterministic(t *testing.T) {
1257 },
1258 },
1259 expected: &tailcfg.DERPMap{
1260- Regions: map[int]*tailcfg.DERPRegion{
1261+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1262 4: {
1263 RegionID: 4,
1264 RegionCode: "fra",
1265@@ -269,13 +269,13 @@ func TestShuffleDERPMapEdgeCases(t *testing.T) {
1266 {
1267 name: "empty derp map",
1268 derpMap: &tailcfg.DERPMap{
1269- Regions: map[int]*tailcfg.DERPRegion{},
1270+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{},
1271 },
1272 },
1273 {
1274 name: "region with no nodes",
1275 derpMap: &tailcfg.DERPMap{
1276- Regions: map[int]*tailcfg.DERPRegion{
1277+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1278 1: {
1279 RegionID: 1,
1280 RegionCode: "empty",
1281@@ -288,7 +288,7 @@ func TestShuffleDERPMapEdgeCases(t *testing.T) {
1282 {
1283 name: "region with single node",
1284 derpMap: &tailcfg.DERPMap{
1285- Regions: map[int]*tailcfg.DERPRegion{
1286+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1287 1: {
1288 RegionID: 1,
1289 RegionCode: "single",
1290@@ -314,7 +314,7 @@ func TestShuffleDERPMapWithoutBaseDomain(t *testing.T) {
1291 resetDerpRandomForTesting()
1292
1293 derpMap := &tailcfg.DERPMap{
1294- Regions: map[int]*tailcfg.DERPRegion{
1295+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1296 1: {
1297 RegionID: 1,
1298 RegionCode: "test",
1299diff --git a/hscontrol/derp/server/derp_server.go b/hscontrol/derp/server/derp_server.go
1300index fdca651..44a37bd 100644
1301--- a/hscontrol/derp/server/derp_server.go
1302+++ b/hscontrol/derp/server/derp_server.go
1303@@ -119,7 +119,7 @@ func (d *DERPServer) GenerateRegion() (tailcfg.DERPRegion, error) {
1304 Avoid: false,
1305 Nodes: []*tailcfg.DERPNode{
1306 {
1307- Name: strconv.Itoa(d.cfg.ServerRegionID),
1308+ Name: d.cfg.ServerRegionID.String(),
1309 RegionID: d.cfg.ServerRegionID,
1310 HostName: host,
1311 DERPPort: port,
1312diff --git a/hscontrol/mapper/batcher.go b/hscontrol/mapper/batcher.go
1313index e37daa0..c6facb7 100644
1314--- a/hscontrol/mapper/batcher.go
1315+++ b/hscontrol/mapper/batcher.go
1316@@ -876,6 +876,12 @@ func (b *Batcher) MapResponseFromChange(id types.NodeID, ch change.Change) (*tai
1317 }
1318 }
1319
1320+// FullMapResponse builds a full response without requiring an existing stream.
1321+// The Omnet wire barrier uses this for non-stream reads and key-patch replacement.
1322+func (b *Batcher) FullMapResponse(id types.NodeID, version tailcfg.CapabilityVersion) (*tailcfg.MapResponse, error) {
1323+ return b.mapper.fullMapResponse(id, version)
1324+}
1325+
1326 // DebugNodeInfo contains debug information about a node's connections.
1327 type DebugNodeInfo struct {
1328 Connected bool `json:"connected"`
1329diff --git a/hscontrol/mapper/batcher_test.go b/hscontrol/mapper/batcher_test.go
1330index 80b4c93..232c3a0 100644
1331--- a/hscontrol/mapper/batcher_test.go
1332+++ b/hscontrol/mapper/batcher_test.go
1333@@ -191,7 +191,7 @@ func setupBatcherWithTestData(
1334 DERP: types.DERPConfig{
1335 ServerEnabled: false,
1336 DERPMap: &tailcfg.DERPMap{
1337- Regions: map[int]*tailcfg.DERPRegion{
1338+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1339 999: {
1340 RegionID: 999,
1341 },
1342@@ -351,7 +351,7 @@ func assertDERPMapResponse(t *testing.T, resp *tailcfg.MapResponse) {
1343
1344 assert.NotNil(t, resp.DERPMap, "DERPMap should not be nil in response")
1345 assert.Len(t, resp.DERPMap.Regions, 1, "Expected exactly one DERP region in response")
1346- assert.Equal(t, 999, resp.DERPMap.Regions[999].RegionID, "Expected DERP region ID to be 999")
1347+ assert.Equal(t, tailcfg.DERPRegionID(999), resp.DERPMap.Regions[999].RegionID, "Expected DERP region ID to be 999")
1348 }
1349
1350 func assertOnlineMapResponse(t *testing.T, resp *tailcfg.MapResponse, expected bool) {
1351diff --git a/hscontrol/mapper/initialmap_storm_test.go b/hscontrol/mapper/initialmap_storm_test.go
1352index 877a8d9..698ee1d 100644
1353--- a/hscontrol/mapper/initialmap_storm_test.go
1354+++ b/hscontrol/mapper/initialmap_storm_test.go
1355@@ -49,7 +49,7 @@ func setupStormBatcher(tb testing.TB, nodeCount, workers int, policy string) (*T
1356 DERP: types.DERPConfig{
1357 ServerEnabled: false,
1358 DERPMap: &tailcfg.DERPMap{
1359- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1360+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1361 },
1362 },
1363 Tuning: types.Tuning{
1364diff --git a/hscontrol/mapper/mapper_test.go b/hscontrol/mapper/mapper_test.go
1365index fd8896a..c7ea93b 100644
1366--- a/hscontrol/mapper/mapper_test.go
1367+++ b/hscontrol/mapper/mapper_test.go
1368@@ -224,7 +224,7 @@ func TestBuildFromChangeFiltersPeerPatchesByVisibility(t *testing.T) {
1369 Policy: types.PolicyConfig{Mode: types.PolicyModeDB},
1370 DERP: types.DERPConfig{
1371 DERPMap: &tailcfg.DERPMap{
1372- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1373+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1374 },
1375 },
1376 Tuning: types.Tuning{
1377@@ -310,7 +310,7 @@ func TestBuildFromChangeFiltersUserProfilesByVisibility(t *testing.T) {
1378 Policy: types.PolicyConfig{Mode: types.PolicyModeDB},
1379 DERP: types.DERPConfig{
1380 DERPMap: &tailcfg.DERPMap{
1381- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1382+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1383 },
1384 },
1385 Tuning: types.Tuning{
1386@@ -381,7 +381,7 @@ func TestBuildFromChangeVisibilityMatchesFullMap(t *testing.T) {
1387 Policy: types.PolicyConfig{Mode: types.PolicyModeDB},
1388 DERP: types.DERPConfig{
1389 DERPMap: &tailcfg.DERPMap{
1390- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1391+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1392 },
1393 },
1394 Tuning: types.Tuning{
1395@@ -574,7 +574,7 @@ func TestFullMapResponseSurvivesPeerWithInvalidName(t *testing.T) {
1396 Policy: types.PolicyConfig{Mode: types.PolicyModeDB},
1397 DERP: types.DERPConfig{
1398 DERPMap: &tailcfg.DERPMap{
1399- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1400+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1401 },
1402 },
1403 Tuning: types.Tuning{
1404@@ -833,7 +833,7 @@ func TestGenerateMapResponseDebugOnlyOnFullMaps(t *testing.T) {
1405 Policy: types.PolicyConfig{Mode: types.PolicyModeDB},
1406 DERP: types.DERPConfig{
1407 DERPMap: &tailcfg.DERPMap{
1408- Regions: map[int]*tailcfg.DERPRegion{999: {RegionID: 999}},
1409+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{999: {RegionID: 999}},
1410 },
1411 },
1412 Tuning: types.Tuning{
1413diff --git a/hscontrol/mapper/node_conn.go b/hscontrol/mapper/node_conn.go
1414index 9396854..f114ba0 100644
1415--- a/hscontrol/mapper/node_conn.go
1416+++ b/hscontrol/mapper/node_conn.go
1417@@ -370,7 +370,13 @@ func (mc *multiChannelNodeConn) send(data *tailcfg.MapResponse) error {
1418 )
1419
1420 for _, conn := range snapshot {
1421- err := conn.send(conn.withSSHPolicyDelta(conn.withSelfDelta(data)))
1422+ frame := data
1423+ // Omega decorates self signatures after this queue. Comparing the
1424+ // undecorated self would hide signature-only updates from that node.
1425+ if mc.mapper == nil || mc.mapper.state == nil || mc.mapper.state.TKAReconcile == nil {
1426+ frame = conn.withSelfDelta(frame)
1427+ }
1428+ err := conn.send(conn.withSSHPolicyDelta(frame))
1429 if err != nil {
1430 lastErr = err
1431
1432diff --git a/hscontrol/noise.go b/hscontrol/noise.go
1433index 20b0889..f57647f 100644
1434--- a/hscontrol/noise.go
1435+++ b/hscontrol/noise.go
1436@@ -168,6 +168,7 @@ func (h *Headscale) NoiseUpgradeHandler(
1437 r.Route("/machine", func(r chi.Router) {
1438 r.Post("/register", ns.RegistrationHandler)
1439 r.Post("/map", ns.PollNetMapHandler)
1440+ ns.tkaRoutes(r)
1441
1442 // SSH Check mode endpoint, consulted to validate if a given SSH connection should be accepted or rejected.
1443 r.Get("/ssh/action/{src_node_id}/to/{dst_node_id}", ns.SSHActionHandler)
1444@@ -752,6 +753,11 @@ func (ns *noiseServer) PollNetMapHandler(
1445 return
1446 }
1447
1448+ if err := ns.headscale.tkaMapReady(req.Context()); err != nil {
1449+ http.Error(writer, errTKAUnavailable.Error(), http.StatusServiceUnavailable)
1450+ return
1451+ }
1452+
1453 nv, err := ns.getAndValidateNode(mapRequest)
1454 if err != nil {
1455 // The node is gone, but the client does not know that. Tailscale
1456@@ -761,7 +767,7 @@ func (ns *noiseServer) PollNetMapHandler(
1457 // that says "deleted", so reuse the expiry signal headscale already
1458 // sends for expired nodes.
1459 // See: https://github.com/juanfont/headscale/issues/3410
1460- if errors.Is(err, errNodeNotInStore) && mapRequest.Stream {
1461+ if errors.Is(err, errNodeNotInStore) && mapRequest.Stream && ns.headscale.tkad == nil {
1462 expired := &tailcfg.MapResponse{
1463 Node: &tailcfg.Node{
1464 Key: mapRequest.NodeKey,
1465@@ -823,6 +829,13 @@ func (ns *noiseServer) RegistrationHandler(
1466 return &regReq, regErr(err)
1467 }
1468
1469+ resp, err = ns.headscale.registrationPrelude(req.Context(), regReq, ns.machineKey)
1470+ if err != nil {
1471+ return &regReq, regErr(err)
1472+ }
1473+ if resp != nil {
1474+ return &regReq, resp
1475+ }
1476 resp, err = ns.headscale.handleRegister(req.Context(), regReq, ns.conn.Peer())
1477 if err != nil {
1478 if httpErr, ok := errors.AsType[HTTPError](err); ok {
1479@@ -836,6 +849,12 @@ func (ns *noiseServer) RegistrationHandler(
1480 return &regReq, regErr(err)
1481 }
1482
1483+ if ns.headscale.tkad != nil && resp != nil && resp.MachineAuthorized && !resp.NodeKeyExpired && resp.AuthURL == "" {
1484+ if err := ns.headscale.state.TKARegisterCurrent(req.Context(), regReq, ns.machineKey); err != nil {
1485+ return &regReq, regErr(err)
1486+ }
1487+ }
1488+
1489 return &regReq, resp
1490 }()
1491
1492diff --git a/hscontrol/poll.go b/hscontrol/poll.go
1493index 09b8ccd..8212f4c 100644
1494--- a/hscontrol/poll.go
1495+++ b/hscontrol/poll.go
1496@@ -8,6 +8,7 @@ import (
1497 "fmt"
1498 "math/rand/v2"
1499 "net/http"
1500+ "sync"
1501 "sync/atomic"
1502 "time"
1503
1504@@ -51,6 +52,8 @@ type mapSession struct {
1505 // writing is set while [mapSession.writeMap] runs, so
1506 // [mapSession.stopFromBatcher] interrupts only a write that may be stuck.
1507 writing atomic.Bool
1508+ // Serializes deadline changes with stopFromBatcher, never network writes.
1509+ writeDeadlineMu sync.Mutex
1510
1511 keepAlive time.Duration
1512 keepAliveTicker *time.Ticker
1513@@ -105,6 +108,8 @@ func (m *mapSession) resetKeepAlive() {
1514 }
1515
1516 func (m *mapSession) stopFromBatcher() {
1517+ m.writeDeadlineMu.Lock()
1518+ defer m.writeDeadlineMu.Unlock()
1519 if m.cancelChClosed.CompareAndSwap(false, true) {
1520 close(m.cancelCh)
1521
1522@@ -162,6 +167,17 @@ func (m *mapSession) serve() {
1523 if m.isEndpointUpdate() {
1524 m.w.WriteHeader(http.StatusOK)
1525 mapResponseEndpointUpdates.WithLabelValues("ok").Inc()
1526+ return
1527+ }
1528+ if m.h.tkad != nil {
1529+ resp, err := m.h.mapBatcher.FullMapResponse(m.node.ID, m.capVer)
1530+ if err != nil {
1531+ httpError(m.w, err)
1532+ return
1533+ }
1534+ if err := m.writeMap(resp); err != nil {
1535+ httpError(m.w, err)
1536+ }
1537 }
1538 }
1539
1540@@ -312,11 +328,14 @@ func (m *mapSession) serveLongPoll() {
1541 m.h.Change(mapReqChange)
1542 m.h.Change(connectChanges...)
1543
1544+ tkaFailure := m.h.tkaFailure()
1545 // Loop through updates and continuously send them to the
1546 // client.
1547 for {
1548 // consume channels with update, keep alives or "batch" blocking signals
1549 select {
1550+ case <-tkaFailure:
1551+ return
1552 case <-m.cancelCh:
1553 m.log.Trace().Caller().Msg("poll cancelled received")
1554 mapResponseEnded.WithLabelValues("cancelled").Inc()
1555@@ -390,7 +409,7 @@ func (m *mapSession) writeMap(msg *tailcfg.MapResponse) error {
1556
1557 startWrite := time.Now()
1558
1559- err := writeMapResponse(m.w, m.req.Compress, m.isStreaming(), msg)
1560+ err := m.writeTKAMap(msg)
1561 if err != nil {
1562 return err
1563 }
1564@@ -414,9 +433,17 @@ func (m *mapSession) writeMap(msg *tailcfg.MapResponse) error {
1565 // It is shared with the deleted-node path in [noiseServer.PollNetMapHandler],
1566 // which has no [mapSession] to write through.
1567 func writeMapResponse(w http.ResponseWriter, compress string, flush bool, msg *tailcfg.MapResponse) error {
1568+ data, err := encodeMapResponse(compress, msg)
1569+ if err != nil {
1570+ return err
1571+ }
1572+ return writeMapFrame(w, flush, data)
1573+}
1574+
1575+func encodeMapResponse(compress string, msg *tailcfg.MapResponse) ([]byte, error) {
1576 jsonBody, err := json.Marshal(msg)
1577 if err != nil {
1578- return fmt.Errorf("marshalling map response: %w", err)
1579+ return nil, fmt.Errorf("marshalling map response: %w", err)
1580 }
1581
1582 if compress == util.ZstdCompression {
1583@@ -427,8 +454,11 @@ func writeMapResponse(w http.ResponseWriter, compress string, flush bool, msg *t
1584 //nolint:gosec // G115: JSON response size will not exceed uint32 max
1585 binary.LittleEndian.PutUint32(data, uint32(len(jsonBody)))
1586 data = append(data, jsonBody...)
1587+ return data, nil
1588+}
1589
1590- _, err = w.Write(data)
1591+func writeMapFrame(w http.ResponseWriter, flush bool, data []byte) error {
1592+ _, err := w.Write(data)
1593 if err != nil {
1594 return err
1595 }
1596diff --git a/hscontrol/servertest/server.go b/hscontrol/servertest/server.go
1597index 0c9f243..2e830b0 100644
1598--- a/hscontrol/servertest/server.go
1599+++ b/hscontrol/servertest/server.go
1600@@ -183,7 +183,7 @@ func NewServer(tb testing.TB, opts ...ServerOption) *TestServer {
1601
1602 // Set a minimal DERP map so MapResponse generation works.
1603 app.GetState().SetDERPMap(&tailcfg.DERPMap{
1604- Regions: map[int]*tailcfg.DERPRegion{
1605+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
1606 900: {
1607 RegionID: 900,
1608 RegionCode: "test",
1609diff --git a/hscontrol/state/debug.go b/hscontrol/state/debug.go
1610index 3fbd090..96aeed7 100644
1611--- a/hscontrol/state/debug.go
1612+++ b/hscontrol/state/debug.go
1613@@ -35,16 +35,16 @@ type DebugOverviewInfo struct {
1614
1615 // DebugDERPInfo represents DERP map information in a structured format.
1616 type DebugDERPInfo struct {
1617- Configured bool `json:"configured"`
1618- TotalRegions int `json:"total_regions"`
1619- Regions map[int]*DebugDERPRegion `json:"regions,omitempty"`
1620+ Configured bool `json:"configured"`
1621+ TotalRegions int `json:"total_regions"`
1622+ Regions map[tailcfg.DERPRegionID]*DebugDERPRegion `json:"regions,omitempty"`
1623 }
1624
1625 // DebugDERPRegion represents a single DERP region.
1626 type DebugDERPRegion struct {
1627- RegionID int `json:"region_id"`
1628- RegionName string `json:"region_name"`
1629- Nodes []*DebugDERPNode `json:"nodes"`
1630+ RegionID tailcfg.DERPRegionID `json:"region_id"`
1631+ RegionName string `json:"region_name"`
1632+ Nodes []*DebugDERPNode `json:"nodes"`
1633 }
1634
1635 // DebugDERPNode represents a single DERP node.
1636@@ -389,7 +389,7 @@ func (s *State) DebugDERPJSON() DebugDERPInfo {
1637
1638 info := DebugDERPInfo{
1639 Configured: derpMap != nil,
1640- Regions: make(map[int]*DebugDERPRegion),
1641+ Regions: make(map[tailcfg.DERPRegionID]*DebugDERPRegion),
1642 }
1643
1644 if derpMap == nil {
1645diff --git a/hscontrol/state/maprequest.go b/hscontrol/state/maprequest.go
1646index ea612c8..15bb04b 100644
1647--- a/hscontrol/state/maprequest.go
1648+++ b/hscontrol/state/maprequest.go
1649@@ -51,7 +51,7 @@ type mapRequestDelta struct {
1650 // clearing DERP to zero cannot be sent as a patch and forces a
1651 // whole-peer update.
1652 derpChanged bool
1653- oldDERP, newDERP int
1654+ oldDERP, newDERP tailcfg.DERPRegionID
1655
1656 // endpointBroadcast reports whether the endpoint delta is worth fanning
1657 // out (i.e., a newly-added useful non-STUN endpoint). Storage still
1658@@ -75,8 +75,8 @@ func (d mapRequestDelta) MarshalZerologObject(e *zerolog.Event) {
1659 Bool("hostinfo.peer_changed", d.peerHostinfoChanged).
1660 Bool("routes.changed", d.routesChanged).
1661 Bool("derp.changed", d.derpChanged).
1662- Int("derp.old", d.oldDERP).
1663- Int("derp.new", d.newDERP).
1664+ Int64("derp.old", d.oldDERP.Int64()).
1665+ Int64("derp.new", d.newDERP.Int64()).
1666 Bool("endpoint.broadcast", d.endpointBroadcast).
1667 Bool("key.changed", d.keyChanged).
1668 Bool("disco_key.changed", d.discoKeyChanged).
1669@@ -100,7 +100,7 @@ func netInfoFromMapRequest(
1670 log.Debug().
1671 Caller().
1672 Uint64(zf.NodeID, nodeID.Uint64()).
1673- Int(zf.DERP, currentHostinfo.NetInfo.PreferredDERP).
1674+ Int64(zf.DERP, currentHostinfo.NetInfo.PreferredDERP.Int64()).
1675 Msg("using NetInfo from previous Hostinfo in MapRequest")
1676
1677 return currentHostinfo.NetInfo
1678@@ -125,7 +125,7 @@ func netInfoFromMapRequest(
1679
1680 // hostinfoDERP returns the PreferredDERP value from a Hostinfo, or 0 when
1681 // either pointer is nil. 0 is the wire "unchanged" sentinel.
1682-func hostinfoDERP(hi *tailcfg.Hostinfo) int {
1683+func hostinfoDERP(hi *tailcfg.Hostinfo) tailcfg.DERPRegionID {
1684 if hi == nil || hi.NetInfo == nil {
1685 return 0
1686 }
1687diff --git a/hscontrol/state/maprequest_test.go b/hscontrol/state/maprequest_test.go
1688index 3369032..1717d8f 100644
1689--- a/hscontrol/state/maprequest_test.go
1690+++ b/hscontrol/state/maprequest_test.go
1691@@ -114,7 +114,7 @@ func TestNetInfoPreservationInRegistrationFlow(t *testing.T) {
1692 // CORRECT: Using the existing node's hostinfo (has NetInfo)
1693 correctResult := netInfoFromMapRequest(nodeID, existingNodeHostinfo, newRegistrationHostinfo)
1694 assert.NotNil(t, correctResult, "Fix: Should preserve NetInfo when using correct hostinfo reference")
1695- assert.Equal(t, 5, correctResult.PreferredDERP, "Should preserve the DERP region from existing node")
1696+ assert.Equal(t, tailcfg.DERPRegionID(5), correctResult.PreferredDERP, "Should preserve the DERP region from existing node")
1697 })
1698
1699 t.Run("new_node_creation_for_different_user_should_preserve_netinfo", func(t *testing.T) {
1700@@ -140,7 +140,7 @@ func TestNetInfoPreservationInRegistrationFlow(t *testing.T) {
1701 // When creating a new node for user2, we should preserve NetInfo from user1's node
1702 result := netInfoFromMapRequest(types.NodeID(2), existingNodeUser1Hostinfo, newNodeUser2Hostinfo)
1703 assert.NotNil(t, result, "New node for user2 should preserve NetInfo from user1's node")
1704- assert.Equal(t, 7, result.PreferredDERP, "Should preserve DERP region from existing node")
1705+ assert.Equal(t, tailcfg.DERPRegionID(7), result.PreferredDERP, "Should preserve DERP region from existing node")
1706 })
1707 }
1708
1709@@ -376,7 +376,7 @@ func TestMapRequestDERPLatencyJitterEmitsNoPeerChange(t *testing.T) {
1710
1711 after, ok := s.GetNodeByID(nodeID)
1712 require.True(t, ok)
1713- require.Equal(t, 1, after.Hostinfo().NetInfo().PreferredDERP(),
1714+ require.Equal(t, tailcfg.DERPRegionID(1), after.Hostinfo().NetInfo().PreferredDERP(),
1715 "the DERP region must survive a latency-only request")
1716 }
1717
1718@@ -439,7 +439,7 @@ func TestMapRequestOmittedNetInfoIsNoChange(t *testing.T) {
1719
1720 after, ok := s.GetNodeByID(nodeID)
1721 require.True(t, ok)
1722- require.Equal(t, int(1), hostinfoDERP(after.AsStruct().Hostinfo),
1723+ require.Equal(t, tailcfg.DERPRegionID(1), hostinfoDERP(after.AsStruct().Hostinfo),
1724 "stored NetInfo must survive a request that omits it")
1725 }
1726
1727@@ -492,7 +492,7 @@ func TestMapRequestDERPClearToZeroIsStoredAndBroadcast(t *testing.T) {
1728
1729 after, ok := s.GetNodeByID(nodeID)
1730 require.True(t, ok)
1731- require.Equal(t, int(0), hostinfoDERP(after.AsStruct().Hostinfo),
1732+ require.Equal(t, tailcfg.DERPRegionID(0), hostinfoDERP(after.AsStruct().Hostinfo),
1733 "clearing PreferredDERP must be stored")
1734
1735 require.Contains(t, c.PeersChanged, nodeID,
1736@@ -514,7 +514,7 @@ func TestMapRequestDERPOnlyChangeKeepsGivenName(t *testing.T) {
1737
1738 stored := nv.AsStruct()
1739
1740- req := func(derp int) tailcfg.MapRequest {
1741+ req := func(derp tailcfg.DERPRegionID) tailcfg.MapRequest {
1742 return tailcfg.MapRequest{
1743 NodeKey: stored.NodeKey,
1744 DiscoKey: stored.DiscoKey,
1745@@ -547,7 +547,7 @@ func TestConcurrentMapRequestDERPUsesPersistedState(t *testing.T) {
1746 for _, rotateKey := range []bool{false, true} {
1747 for _, tt := range []struct {
1748 name string
1749- firstDERP, lastDERP int
1750+ firstDERP, lastDERP tailcfg.DERPRegionID
1751 }{
1752 {name: "newer region", firstDERP: 2, lastDERP: 3},
1753 {name: "newer clear", firstDERP: 2, lastDERP: 0},
1754@@ -601,7 +601,7 @@ func TestConcurrentMapRequestDERPUsesPersistedState(t *testing.T) {
1755
1756 results := make(chan result, 2)
1757
1758- for _, derp := range []int{tt.firstDERP, tt.lastDERP} {
1759+ for _, derp := range []tailcfg.DERPRegionID{tt.firstDERP, tt.lastDERP} {
1760 request := req
1761 request.Hostinfo = req.Hostinfo.Clone()
1762 request.Hostinfo.NetInfo.PreferredDERP = derp
1763@@ -940,10 +940,10 @@ func TestNetInfoEqualIgnoringDERP(t *testing.T) {
1764 }
1765
1766 func TestHostinfoDERP(t *testing.T) {
1767- require.Equal(t, int(0), hostinfoDERP(nil))
1768- require.Equal(t, int(0), hostinfoDERP(&tailcfg.Hostinfo{}))
1769- require.Equal(t, int(0), hostinfoDERP(&tailcfg.Hostinfo{NetInfo: &tailcfg.NetInfo{}}))
1770- require.Equal(t, int(5), hostinfoDERP(&tailcfg.Hostinfo{NetInfo: &tailcfg.NetInfo{PreferredDERP: 5}}))
1771+ require.Equal(t, tailcfg.DERPRegionID(0), hostinfoDERP(nil))
1772+ require.Equal(t, tailcfg.DERPRegionID(0), hostinfoDERP(&tailcfg.Hostinfo{}))
1773+ require.Equal(t, tailcfg.DERPRegionID(0), hostinfoDERP(&tailcfg.Hostinfo{NetInfo: &tailcfg.NetInfo{}}))
1774+ require.Equal(t, tailcfg.DERPRegionID(5), hostinfoDERP(&tailcfg.Hostinfo{NetInfo: &tailcfg.NetInfo{PreferredDERP: 5}}))
1775 }
1776
1777 func TestBuildMapRequestChangeResponse(t *testing.T) {
1778@@ -957,13 +957,13 @@ func TestBuildMapRequestChangeResponse(t *testing.T) {
1779 tests := []struct {
1780 name string
1781 delta mapRequestDelta
1782- nodeDERP int
1783+ nodeDERP tailcfg.DERPRegionID
1784
1785 wantEmpty bool
1786 wantWholePeer bool
1787 wantKeys bool
1788 wantEndpoints bool
1789- wantDERP int
1790+ wantDERP tailcfg.DERPRegionID
1791 }{
1792 {
1793 name: "nothing peer visible",
1794diff --git a/hscontrol/state/state.go b/hscontrol/state/state.go
1795index 293e6ba..7253d82 100644
1796--- a/hscontrol/state/state.go
1797+++ b/hscontrol/state/state.go
1798@@ -141,6 +141,10 @@ type sshCheckPair struct {
1799 // See [policy.PolicyManager] for policy evaluation and [NodeStore] for the
1800 // in-memory node cache.
1801 type State struct {
1802+ // TKA publishes only committed identities. Set once before Serve.
1803+ TKAMu sync.Mutex
1804+ TKAReconcile func(context.Context, types.NodeID, []byte) error
1805+
1806 // cfg holds the current Headscale configuration
1807 cfg *types.Config
1808
1809@@ -342,6 +346,7 @@ func (s *State) DERPMap() tailcfg.DERPMapView {
1810 // ReloadPolicy reloads the access control policy and triggers auto-approval if changed.
1811 // Returns the resulting [change.Change] slice when the policy or routes changed.
1812 func (s *State) ReloadPolicy() ([]change.Change, error) {
1813+ defer s.lockTKA()()
1814 pol, err := hsdb.PolicyBytes(s.db.DB, s.cfg)
1815 if err != nil {
1816 return nil, fmt.Errorf("loading policy: %w", err)
1817@@ -471,6 +476,7 @@ func (s *State) UpdateUser(userID types.UserID, updateFn func(*types.User) error
1818 // It also updates the policy manager to ensure ACL policies referencing the deleted
1819 // user are re-evaluated immediately, fixing issue #2967.
1820 func (s *State) DeleteUser(userID types.UserID) (change.Change, error) {
1821+ defer s.lockTKA()()
1822 err := s.db.DestroyUser(userID)
1823 if err != nil {
1824 return change.Change{}, err
1825@@ -599,6 +605,7 @@ func (s *State) persistNodeAndRefreshPolicy(node types.NodeView) (types.NodeView
1826 }
1827
1828 func (s *State) SaveNode(node types.NodeView) (types.NodeView, change.Change, error) {
1829+ defer s.lockTKA()()
1830 // Update [NodeStore] first
1831 nodePtr := node.AsStruct()
1832
1833@@ -614,6 +621,7 @@ func (s *State) SaveNode(node types.NodeView) (types.NodeView, change.Change, er
1834 // must publish the changes before handling the error so live sessions are
1835 // still torn down after a committed deletion.
1836 func (s *State) DeleteNode(node types.NodeView) ([]change.Change, error) {
1837+ defer s.lockTKA()()
1838 s.persistMu.Lock()
1839
1840 err := s.db.DeleteNode(node.AsStruct())
1841@@ -702,6 +710,7 @@ func (s *State) Connect(id types.NodeID) ([]change.Change, uint64) {
1842 // [NodeStore.UpdateNode] closure, making them atomic against
1843 // concurrent connects. epoch identifies the session for logging only.
1844 func (s *State) Disconnect(id types.NodeID, epoch uint64) ([]change.Change, error) {
1845+ defer s.lockTKA()()
1846 var wentOffline bool
1847
1848 node, ok := s.nodeStore.UpdateNode(id, func(n *types.Node) {
1849@@ -912,6 +921,7 @@ func (s *State) ListEphemeralNodes() views.Slice[types.NodeView] {
1850 // SetNodeExpiry updates the expiration time for a node.
1851 // If expiry is nil, the node's expiry is disabled (node will never expire).
1852 func (s *State) SetNodeExpiry(nodeID types.NodeID, expiry *time.Time) (types.NodeView, change.Change, error) {
1853+ defer s.lockTKA()()
1854 var onlineChanged bool
1855
1856 // Update [NodeStore] before database to ensure consistency. The [NodeStore] update
1857@@ -958,6 +968,7 @@ func (s *State) SetNodeExpiry(nodeID types.NodeID, expiry *time.Time) (types.Nod
1858 // Once a node is tagged, it cannot be un-tagged (only tags can be changed).
1859 // Setting tags clears UserID since tagged nodes are owned by their tags.
1860 func (s *State) SetNodeTags(nodeID types.NodeID, tags []string) (types.NodeView, change.Change, error) {
1861+ defer s.lockTKA()()
1862 if len(tags) == 0 {
1863 return types.NodeView{}, change.Change{}, types.ErrCannotRemoveAllTags
1864 }
1865@@ -1022,6 +1033,11 @@ func (s *State) SetNodeTags(nodeID types.NodeID, tags []string) (types.NodeView,
1866
1867 // SetApprovedRoutes sets the network routes that a node is approved to advertise.
1868 func (s *State) SetApprovedRoutes(nodeID types.NodeID, routes []netip.Prefix) (types.NodeView, change.Change, error) {
1869+ defer s.lockTKA()()
1870+ return s.setApprovedRoutes(nodeID, routes)
1871+}
1872+
1873+func (s *State) setApprovedRoutes(nodeID types.NodeID, routes []netip.Prefix) (types.NodeView, change.Change, error) {
1874 // TODO(kradalby): In principle we should call the AutoApprove logic here
1875 // because even if the CLI removes an auto-approved route, it will be added
1876 // back automatically.
1877@@ -1062,6 +1078,7 @@ func (s *State) SetApprovedRoutes(nodeID types.NodeID, routes []netip.Prefix) (t
1878 // auto-sanitisation) and collisions error out rather than silently
1879 // bumping a user-facing label. See HOSTNAME.md for the CLI contract.
1880 func (s *State) RenameNode(nodeID types.NodeID, newName string) (types.NodeView, change.Change, error) {
1881+ defer s.lockTKA()()
1882 // Validate the label AND that the resulting FQDN fits MaxHostnameLength:
1883 // a valid 63-char label can still overflow under a long base_domain, and
1884 // an unmappable name would break this node and its peers (issue #3346).
1885@@ -1653,6 +1670,8 @@ type newNodeParams struct {
1886 User types.User
1887 MachineKey key.MachinePublic
1888 NodeKey key.NodePublic
1889+ TKAKey key.NLPublic
1890+ TKASignature []byte
1891 DiscoKey key.DiscoPublic
1892 Hostname string
1893 Hostinfo *tailcfg.Hostinfo
1894@@ -1747,13 +1766,16 @@ func (s *State) applyAuthNodeUpdate(params authNodeUpdateParams) (types.NodeView
1895 // re-authenticating node could rotate its key to a victim's and poison
1896 // the NodeStore NodeKey index (denying the victim service).
1897 if existing, ok := s.nodeStore.GetNodeByNodeKey(regData.NodeKey); ok &&
1898- existing.MachineKey() != regData.MachineKey {
1899+ (existing.MachineKey() != regData.MachineKey ||
1900+ (s.TKAReconcile != nil && existing.ID() != params.ExistingNode.ID())) {
1901 return types.NodeView{}, false, ErrNodeKeyInUse
1902 }
1903
1904 // Update existing node in [NodeStore] - validation passed, safe to mutate
1905 before, updatedNodeView, ok := s.nodeStore.UpdateNodeDiff(params.ExistingNode.ID(), func(node *types.Node) {
1906 node.NodeKey = regData.NodeKey
1907+ node.TKAKey = regData.TKAKey
1908+ node.TKASignature = slices.Clone(regData.TKASignature)
1909 node.DiscoKey = regData.DiscoKey
1910 node.Hostname = params.Hostname
1911
1912@@ -1859,9 +1881,9 @@ func (s *State) applyAuthNodeUpdate(params authNodeUpdateParams) (types.NodeView
1913 // is garbage-collected. Writing NULL can never cause an FK error, so include
1914 // the column only in that clearing case; the other transitions keep the
1915 // #2862-safe column set untouched.
1916- updateColumns := nodeUpdateColumns
1917+ updateColumns := append(slices.Clone(nodeUpdateColumns), "TKAKey", "TKASignature")
1918 if !updatedNodeView.AuthKeyID().Valid() {
1919- updateColumns = append(slices.Clone(nodeUpdateColumns), "AuthKeyID")
1920+ updateColumns = append(updateColumns, "AuthKeyID")
1921 }
1922
1923 _, err := hsdb.Write(s.db.DB, func(tx *gorm.DB) (*types.Node, error) {
1924@@ -1873,6 +1895,7 @@ func (s *State) applyAuthNodeUpdate(params authNodeUpdateParams) (types.NodeView
1925 return nil, nil //nolint:nilnil // side-effect only write
1926 })
1927 if err != nil {
1928+ s.nodeStore.PutNode(*before.AsStruct())
1929 return types.NodeView{}, false, err
1930 }
1931
1932@@ -1893,6 +1916,20 @@ func (s *State) applyAuthNodeUpdate(params authNodeUpdateParams) (types.NodeView
1933 // createAndSaveNewNode creates a new node, allocates IPs, saves to DB, and adds to [NodeStore].
1934 // It preserves netinfo from an existing node if one is provided (for faster DERP connectivity).
1935 func (s *State) createAndSaveNewNode(params newNodeParams) (types.NodeView, error) {
1936+ if s.TKAReconcile != nil {
1937+ nodes, err := s.TKACommittedNodes(context.Background())
1938+ if err != nil {
1939+ return types.NodeView{}, err
1940+ }
1941+ if len(nodes) >= 64 || params.TKAKey.IsZero() {
1942+ return types.NodeView{}, errors.New("omnet registration requires NLKey and capacity below 64")
1943+ }
1944+ for _, n := range nodes {
1945+ if n.NodeKey == params.NodeKey {
1946+ return types.NodeView{}, ErrNodeKeyInUse
1947+ }
1948+ }
1949+ }
1950 // Preserve NetInfo from existing node if available
1951 if params.Hostinfo != nil {
1952 params.Hostinfo.NetInfo = preserveNetInfo(
1953@@ -1921,6 +1958,8 @@ func (s *State) createAndSaveNewNode(params newNodeParams) (types.NodeView, erro
1954 Hostname: params.Hostname,
1955 MachineKey: params.MachineKey,
1956 NodeKey: params.NodeKey,
1957+ TKAKey: params.TKAKey,
1958+ TKASignature: slices.Clone(params.TKASignature),
1959 DiscoKey: params.DiscoKey,
1960 Hostinfo: params.Hostinfo,
1961 Endpoints: params.Endpoints,
1962@@ -2213,6 +2252,7 @@ func (s *State) HandleNodeFromAuthPath(
1963 expiry *time.Time,
1964 registrationMethod string,
1965 ) (types.NodeView, change.Change, error) {
1966+ defer s.lockTKA()()
1967 // Get the registration entry from cache
1968 regEntry, ok := s.GetAuthCacheEntry(authID)
1969 if !ok {
1970@@ -2342,12 +2382,6 @@ func (s *State) HandleNodeFromAuthPath(
1971 }
1972 }
1973
1974- // Signal to waiting clients
1975- regEntry.FinishAuth(types.AuthVerdict{Node: finalNode})
1976-
1977- // Remove from registration cache
1978- s.authCache.Remove(authID)
1979-
1980 // Update policy managers
1981 usersChange, err := s.updatePolicyManagerUsers()
1982 if err != nil {
1983@@ -2358,6 +2392,16 @@ func (s *State) HandleNodeFromAuthPath(
1984 if err != nil {
1985 return finalNode, change.NodeAdded(finalNode.ID()), fmt.Errorf("updating policy manager nodes: %w", err)
1986 }
1987+ if err := s.reconcileTKA(finalNode.ID(), regData.TKASignature); err != nil {
1988+ regEntry.FinishAuth(types.AuthVerdict{Err: err})
1989+ return types.NodeView{}, change.Change{}, err
1990+ }
1991+
1992+ // Signal to waiting clients
1993+ regEntry.FinishAuth(types.AuthVerdict{Node: finalNode})
1994+
1995+ // Remove from registration cache
1996+ s.authCache.Remove(authID)
1997
1998 policyChanged := !usersChange.IsEmpty() || !nodesChange.IsEmpty()
1999
2000@@ -2388,6 +2432,8 @@ func (s *State) createNewNodeFromAuth(
2001 User: *user,
2002 MachineKey: regData.MachineKey,
2003 NodeKey: regData.NodeKey,
2004+ TKAKey: regData.TKAKey,
2005+ TKASignature: regData.TKASignature,
2006 DiscoKey: regData.DiscoKey,
2007 Hostname: hostname,
2008 Hostinfo: validHostinfo,
2009@@ -2467,6 +2513,7 @@ func (s *State) HandleNodeFromPreAuthKey(
2010 regReq tailcfg.RegisterRequest,
2011 machineKey key.MachinePublic,
2012 ) (types.NodeView, change.Change, error) {
2013+ defer s.lockTKA()()
2014 // Serialise registration for this machine so concurrent restarts resolve
2015 // to a single node rather than racing the find-then-create section.
2016 defer s.lockRegistration(machineKey)()
2017@@ -2609,7 +2656,8 @@ func (s *State) HandleNodeFromPreAuthKey(
2018 // re-registering node could rotate its key to a victim's and poison the
2019 // NodeStore NodeKey index, denying the victim service.
2020 if existing, ok := s.nodeStore.GetNodeByNodeKey(regReq.NodeKey); ok &&
2021- existing.MachineKey() != machineKey {
2022+ (existing.MachineKey() != machineKey ||
2023+ (s.TKAReconcile != nil && existing.ID() != existingNodeSameUser.ID())) {
2024 return types.NodeView{}, change.Change{}, ErrNodeKeyInUse
2025 }
2026
2027@@ -2622,6 +2670,8 @@ func (s *State) HandleNodeFromPreAuthKey(
2028 // Update existing node - NodeStore first, then database
2029 before, updatedNodeView, ok := s.nodeStore.UpdateNodeDiff(existingNodeSameUser.ID(), func(node *types.Node) {
2030 node.NodeKey = regReq.NodeKey
2031+ node.TKAKey = regReq.NLKey
2032+ node.TKASignature = slices.Clone(regReq.NodeKeySignature)
2033 node.Hostname = hostname
2034
2035 // TODO(kradalby): We should ensure we use the same hostinfo and node merge semantics
2036@@ -2707,7 +2757,7 @@ func (s *State) HandleNodeFromPreAuthKey(
2037 // (#2862), but re-registration presents a freshly-validated key, so
2038 // its ID must be persisted here — otherwise a restart reloads the old
2039 // key and any key-scoped property (e.g. Ephemeral) silently reverts.
2040- reregColumns := append(slices.Clone(nodeUpdateColumns), "AuthKeyID")
2041+ reregColumns := append(slices.Clone(nodeUpdateColumns), "AuthKeyID", "TKAKey", "TKASignature")
2042
2043 err := tx.Select(reregColumns).Updates(updatedNodeView.AsStruct()).Error
2044 if err != nil {
2045@@ -2817,6 +2867,8 @@ func (s *State) HandleNodeFromPreAuthKey(
2046 User: pakUser,
2047 MachineKey: machineKey,
2048 NodeKey: regReq.NodeKey,
2049+ TKAKey: regReq.NLKey,
2050+ TKASignature: regReq.NodeKeySignature,
2051 DiscoKey: key.DiscoPublic{}, // DiscoKey not available in RegisterRequest
2052 Hostname: hostname,
2053 Hostinfo: validHostinfo,
2054@@ -2841,6 +2893,9 @@ func (s *State) HandleNodeFromPreAuthKey(
2055 if err != nil {
2056 return finalNode, change.NodeAdded(finalNode.ID()), fmt.Errorf("updating policy manager nodes: %w", err)
2057 }
2058+ if err := s.reconcileTKA(finalNode.ID(), regReq.NodeKeySignature); err != nil {
2059+ return types.NodeView{}, change.Change{}, err
2060+ }
2061
2062 policyChanged := !usersChange.IsEmpty() || !nodesChange.IsEmpty()
2063
2064@@ -3076,6 +3131,13 @@ func isAutoDerivedGivenName(given, hostname string) bool {
2065 // the mapRequestDelta classification, and (if the policy reads it)
2066 // [types.NodeView.HasPolicyChange].
2067 func (s *State) UpdateNodeFromMapRequest(id types.NodeID, req tailcfg.MapRequest) (change.Change, error) { //nolint:gocyclo // central map-request reconciliation; the sequential branch flow reads clearer as one function than split across helpers
2068+ defer s.lockTKA()()
2069+ if s.TKAReconcile != nil {
2070+ current, ok := s.GetNodeByID(id)
2071+ if !ok || current.NodeKey() != req.NodeKey {
2072+ return change.Change{}, errors.New("stale map node identity")
2073+ }
2074+ }
2075 log.Trace().
2076 Caller().
2077 Uint64(zf.NodeID, id.Uint64()).
2078@@ -3273,7 +3335,7 @@ func (s *State) UpdateNodeFromMapRequest(id types.NodeID, req tailcfg.MapRequest
2079 // TODO(kradalby): approval should ride the map request write above.
2080 // Writing it separately costs a second NodeStore write and a second
2081 // peer-map rebuild for one request.
2082- _, c, err := s.SetApprovedRoutes(id, autoApprovedRoutes)
2083+ _, c, err := s.setApprovedRoutes(id, autoApprovedRoutes)
2084 if err != nil {
2085 return change.Change{}, fmt.Errorf("persisting auto-approved routes: %w", err)
2086 }
2087@@ -3437,7 +3499,7 @@ func buildMapRequestChangeResponse(
2088 return change.NodeAdded(id)
2089 }
2090
2091- var currentDERP int
2092+ var currentDERP tailcfg.DERPRegionID
2093
2094 if delta.derpChanged {
2095 if hi := node.Hostinfo(); hi.Valid() && hi.NetInfo().Valid() {
2096diff --git a/hscontrol/state/tka.go b/hscontrol/state/tka.go
2097new file mode 100644
2098index 0000000..898446b
2099--- /dev/null
2100+++ b/hscontrol/state/tka.go
2101@@ -0,0 +1,166 @@
2102+package state
2103+
2104+import (
2105+ "bytes"
2106+ "context"
2107+ "errors"
2108+ "slices"
2109+ "time"
2110+
2111+ "github.com/juanfont/headscale/hscontrol/types"
2112+ "gorm.io/gorm"
2113+ "tailscale.com/tailcfg"
2114+ "tailscale.com/types/key"
2115+)
2116+
2117+// lockTKA is the publication barrier for identity-changing state operations.
2118+// The optional callback is configured once, before any server goroutines start.
2119+func (s *State) lockTKA() func() {
2120+ if s.TKAReconcile == nil {
2121+ return func() {}
2122+ }
2123+ s.TKAMu.Lock()
2124+ return s.TKAMu.Unlock
2125+}
2126+
2127+func (s *State) reconcileTKA(id types.NodeID, signature []byte) error {
2128+ if s.TKAReconcile == nil {
2129+ return nil
2130+ }
2131+ ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second)
2132+ defer cancel()
2133+ return s.TKAReconcile(ctx, id, signature)
2134+}
2135+
2136+// TKAAdmission resolves a Noise identity against committed SQL rows without
2137+// taking TKAMu, so unregistered clients cannot queue on the publication
2138+// barrier. The barrier repeats the authoritative lookup; this only rejects
2139+// identities the registry source does not have.
2140+func (s *State) TKAAdmission(ctx context.Context, machine key.MachinePublic, nodeKey key.NodePublic) (types.NodeID, bool, error) {
2141+ var ids []types.NodeID
2142+ err := s.db.DB.WithContext(ctx).Model(&types.Node{}).
2143+ Where("node_key = ? AND machine_key = ?", nodeKey.String(), machine.String()).
2144+ Limit(1).Pluck("id", &ids).Error
2145+ if err != nil {
2146+ return 0, false, err
2147+ }
2148+ if len(ids) == 0 {
2149+ return 0, false, nil
2150+ }
2151+ return ids[0], true, nil
2152+}
2153+
2154+// TKAAdapterInstalled reports whether this database already depends on the
2155+// adapter: a recorded checkpoint or any node carrying a tailnet-lock key.
2156+// Startup must not silently fall back to stock maps once that is true.
2157+func (s *State) TKAAdapterInstalled(ctx context.Context) (bool, error) {
2158+ var checkpoints int64
2159+ if err := s.db.DB.WithContext(ctx).Model(&types.OmnetCheckpoint{}).Count(&checkpoints).Error; err != nil {
2160+ return false, err
2161+ }
2162+ if checkpoints > 0 {
2163+ return true, nil
2164+ }
2165+ var nodes int64
2166+ err := s.db.DB.WithContext(ctx).Model(&types.Node{}).
2167+ Where("tka_key IS NOT NULL").Count(&nodes).Error
2168+ if err != nil {
2169+ return false, err
2170+ }
2171+ return nodes > 0, nil
2172+}
2173+
2174+// TKACheckRevision records the latest observed transport revision under TKAMu.
2175+// It catches empty/older snapshot replacement after restart. It cannot identify
2176+// an arbitrary different authority with a higher revision; same UID is trusted.
2177+func (s *State) TKACheckRevision(ctx context.Context, revision uint64) error {
2178+ var checkpoint types.OmnetCheckpoint
2179+ err := s.db.DB.WithContext(ctx).First(&checkpoint, 1).Error
2180+ if errors.Is(err, gorm.ErrRecordNotFound) {
2181+ return s.db.DB.WithContext(ctx).Create(&types.OmnetCheckpoint{ID: 1, Revision: revision}).Error
2182+ }
2183+ if err != nil {
2184+ return err
2185+ }
2186+ if revision < checkpoint.Revision {
2187+ return errors.New("omnet authority revision regressed")
2188+ }
2189+ if revision == checkpoint.Revision {
2190+ return nil
2191+ }
2192+ return s.db.DB.WithContext(ctx).Model(&checkpoint).Update("revision", revision).Error
2193+}
2194+
2195+// TKACommittedNodes must be called under TKAMu. It deliberately reads SQL,
2196+// not NodeStore: upstream registration can update NodeStore before SQL commits.
2197+// Limit+1 detects capacity exhaustion without truncating the frozen roster.
2198+func (s *State) TKACommittedNodes(ctx context.Context) ([]types.Node, error) {
2199+ var nodes []types.Node
2200+ if err := s.db.DB.WithContext(ctx).Preload("User").Order("id").Limit(65).Find(&nodes).Error; err != nil {
2201+ return nil, err
2202+ }
2203+ if len(nodes) > 64 {
2204+ return nil, errors.New("omnet registry exceeds 64 nodes")
2205+ }
2206+ seen := make(map[key.NodePublic]bool, len(nodes))
2207+ for _, n := range nodes {
2208+ if n.ID == 0 || n.ID > 1<<63-1 || seen[n.NodeKey] || n.NodeKey.IsZero() {
2209+ return nil, errors.New("omnet ambiguous committed identity")
2210+ }
2211+ seen[n.NodeKey] = true
2212+ cached, ok := s.GetNodeByID(n.ID)
2213+ if !ok || cached.NodeKey() != n.NodeKey || cached.MachineKey() != n.MachineKey ||
2214+ cached.TypedUserID() != n.View().TypedUserID() || !slices.Equal(cached.Tags().AsSlice(), n.Tags) {
2215+ return nil, errors.New("omnet uncommitted node identity")
2216+ }
2217+ }
2218+ return nodes, nil
2219+}
2220+
2221+// TKAAcknowledge clears only the durable forwarding outbox after Omega accepts
2222+// it, readback proves acceptance, or a definitive rejection is reconciled by a
2223+// successful unsigned upsert. Caller holds TKAMu; accepted signatures stay in Omega.
2224+func (s *State) TKAAcknowledge(ctx context.Context, n types.Node) error {
2225+ if len(n.TKASignature) == 0 {
2226+ return nil
2227+ }
2228+ if err := s.db.DB.WithContext(ctx).Model(&types.Node{}).Where("id = ?", n.ID).
2229+ Update("tka_signature", nil).Error; err != nil {
2230+ return err
2231+ }
2232+ s.nodeStore.UpdateNode(n.ID, func(current *types.Node) { current.TKASignature = nil })
2233+ return nil
2234+}
2235+
2236+// TKARegisterCurrent refreshes authenticated registration metadata, including
2237+// upstream's no-auth same-key restart fast path. It never grants ownership.
2238+func (s *State) TKARegisterCurrent(ctx context.Context, req tailcfg.RegisterRequest, machine key.MachinePublic) error {
2239+ defer s.lockTKA()()
2240+ nodes, err := s.TKACommittedNodes(ctx)
2241+ if err != nil {
2242+ return err
2243+ }
2244+ for _, n := range nodes {
2245+ if n.NodeKey != req.NodeKey {
2246+ continue
2247+ }
2248+ if n.MachineKey != machine || req.NLKey.IsZero() {
2249+ return errors.New("omnet registration identity mismatch")
2250+ }
2251+ if n.TKAKey != req.NLKey || (len(req.NodeKeySignature) != 0 && !bytes.Equal(n.TKASignature, req.NodeKeySignature)) {
2252+ n.TKAKey = req.NLKey
2253+ if len(req.NodeKeySignature) != 0 {
2254+ n.TKASignature = slices.Clone(req.NodeKeySignature)
2255+ }
2256+ if err := s.db.DB.WithContext(ctx).Select("TKAKey", "TKASignature").Updates(&n).Error; err != nil {
2257+ return err
2258+ }
2259+ s.nodeStore.UpdateNode(n.ID, func(current *types.Node) {
2260+ current.TKAKey = n.TKAKey
2261+ current.TKASignature = slices.Clone(n.TKASignature)
2262+ })
2263+ }
2264+ return s.reconcileTKA(n.ID, req.NodeKeySignature)
2265+ }
2266+ return errors.New("omnet registered identity missing")
2267+}
2268diff --git a/hscontrol/state/tka_test.go b/hscontrol/state/tka_test.go
2269new file mode 100644
2270index 0000000..d952634
2271--- /dev/null
2272+++ b/hscontrol/state/tka_test.go
2273@@ -0,0 +1,283 @@
2274+package state
2275+
2276+import (
2277+ "context"
2278+ "errors"
2279+ "fmt"
2280+ "testing"
2281+
2282+ "github.com/juanfont/headscale/hscontrol/types"
2283+ "github.com/stretchr/testify/require"
2284+ "tailscale.com/tailcfg"
2285+ "tailscale.com/types/key"
2286+)
2287+
2288+func TestOmnetRegistrationOutboxSurvivesReconcileFailureAndRestart(t *testing.T) {
2289+ path, s, id := persistTestSetup(t)
2290+ old, err := s.DB().GetNodeByID(id)
2291+ require.NoError(t, err)
2292+ owner := types.UserID(*old.UserID)
2293+ pak, err := s.CreatePreAuthKey(&owner, true, false, nil, nil)
2294+ require.NoError(t, err)
2295+ req := tailcfg.RegisterRequest{
2296+ NodeKey: key.NewNode().Public(), NLKey: key.NewNLPrivate().Public(),
2297+ NodeKeySignature: []byte("untrusted-pending-signature"),
2298+ Auth: &tailcfg.RegisterResponseAuth{AuthKey: pak.Key},
2299+ Hostinfo: &tailcfg.Hostinfo{Hostname: "outbox-node"},
2300+ }
2301+ outage := errors.New("injected daemon outage")
2302+ called := false
2303+ s.TKAReconcile = func(ctx context.Context, _ types.NodeID, _ []byte) error {
2304+ called = true
2305+ nodes, err := s.TKACommittedNodes(ctx)
2306+ require.NoError(t, err)
2307+ require.Len(t, nodes, 1)
2308+ require.Equal(t, req.NodeKey, nodes[0].NodeKey)
2309+ require.Equal(t, req.NLKey, nodes[0].TKAKey)
2310+ require.Equal(t, []byte(req.NodeKeySignature), nodes[0].TKASignature)
2311+ return outage
2312+ }
2313+ _, _, err = s.HandleNodeFromPreAuthKey(req, old.MachineKey)
2314+ require.ErrorIs(t, err, outage)
2315+ require.True(t, called)
2316+ require.NoError(t, s.Close())
2317+ restarted := persistTestReopen(t, path)
2318+ durable, err := restarted.DB().GetNodeByID(id)
2319+ require.NoError(t, err)
2320+ require.Equal(t, req.NLKey, durable.TKAKey)
2321+ require.Equal(t, req.NodeKey, durable.NodeKey)
2322+ require.Equal(t, []byte(req.NodeKeySignature), durable.TKASignature)
2323+ // Accepted readback or definitive rejection followed by unsigned upsert clears the outbox.
2324+ restarted.TKAMu.Lock()
2325+ require.NoError(t, restarted.TKAAcknowledge(context.Background(), *durable))
2326+ restarted.TKAMu.Unlock()
2327+ durable, err = restarted.DB().GetNodeByID(id)
2328+ require.NoError(t, err)
2329+ require.Empty(t, durable.TKASignature)
2330+}
2331+
2332+func TestOmnetStaleMapCannotUndoRotation(t *testing.T) {
2333+ _, s, id := persistTestSetup(t)
2334+ defer s.Close()
2335+ old, err := s.DB().GetNodeByID(id)
2336+ require.NoError(t, err)
2337+ s.TKAReconcile = func(context.Context, types.NodeID, []byte) error { return nil }
2338+ owner := types.UserID(*old.UserID)
2339+ pak, err := s.CreatePreAuthKey(&owner, true, false, nil, nil)
2340+ require.NoError(t, err)
2341+ req := tailcfg.RegisterRequest{
2342+ NodeKey: key.NewNode().Public(), NLKey: key.NewNLPrivate().Public(),
2343+ Auth: &tailcfg.RegisterResponseAuth{AuthKey: pak.Key},
2344+ Hostinfo: &tailcfg.Hostinfo{Hostname: old.Hostname},
2345+ }
2346+ _, _, err = s.HandleNodeFromPreAuthKey(req, old.MachineKey)
2347+ require.NoError(t, err)
2348+ _, err = s.UpdateNodeFromMapRequest(id, tailcfg.MapRequest{NodeKey: old.NodeKey})
2349+ require.ErrorContains(t, err, "stale map node identity")
2350+ current, err := s.DB().GetNodeByID(id)
2351+ require.NoError(t, err)
2352+ require.Equal(t, req.NodeKey, current.NodeKey)
2353+}
2354+
2355+func TestOmnetCommittedRosterRejectsSpeculativeIdentity(t *testing.T) {
2356+ _, s, id := persistTestSetup(t)
2357+ defer s.Close()
2358+ s.TKAReconcile = func(context.Context, types.NodeID, []byte) error { return nil }
2359+ s.nodeStore.UpdateNode(id, func(n *types.Node) { n.NodeKey = key.NewNode().Public() })
2360+ s.TKAMu.Lock()
2361+ _, err := s.TKACommittedNodes(context.Background())
2362+ s.TKAMu.Unlock()
2363+ require.ErrorContains(t, err, "uncommitted node identity")
2364+}
2365+
2366+func TestOmnetCommittedRosterRejectsDuplicateNodeKeys(t *testing.T) {
2367+ _, s, id := persistTestSetup(t)
2368+ defer s.Close()
2369+ first, err := s.DB().GetNodeByID(id)
2370+ require.NoError(t, err)
2371+ second := s.DB().CreateRegisteredNodeForTest(first.User, "duplicate-key")
2372+ second.NodeKey = first.NodeKey
2373+ require.NoError(t, s.DB().DB.Select("NodeKey").Updates(second).Error)
2374+ s.nodeStore.PutNode(*second)
2375+ s.TKAMu.Lock()
2376+ _, err = s.TKACommittedNodes(context.Background())
2377+ s.TKAMu.Unlock()
2378+ require.ErrorContains(t, err, "ambiguous committed identity")
2379+}
2380+
2381+func TestOmnetRevisionFloorSurvivesAdapterRestart(t *testing.T) {
2382+ path, s, _ := persistTestSetup(t)
2383+ s.TKAMu.Lock()
2384+ require.NoError(t, s.TKACheckRevision(context.Background(), 19))
2385+ require.NoError(t, s.TKACheckRevision(context.Background(), 19))
2386+ s.TKAMu.Unlock()
2387+ require.NoError(t, s.Close())
2388+ restarted := persistTestReopen(t, path)
2389+ restarted.TKAMu.Lock()
2390+ defer restarted.TKAMu.Unlock()
2391+ require.ErrorContains(t, restarted.TKACheckRevision(context.Background(), 0), "revision regressed")
2392+ require.ErrorContains(t, restarted.TKACheckRevision(context.Background(), 18), "revision regressed")
2393+ require.NoError(t, restarted.TKACheckRevision(context.Background(), 20))
2394+ var checkpoint types.OmnetCheckpoint
2395+ require.NoError(t, restarted.DB().DB.First(&checkpoint, 1).Error)
2396+ require.Equal(t, uint64(20), checkpoint.Revision)
2397+}
2398+
2399+func TestOmnetInteractiveCallbackPersistsBeforeAuthCompletion(t *testing.T) {
2400+ _, s, id := persistTestSetup(t)
2401+ defer s.Close()
2402+ old, err := s.DB().GetNodeByID(id)
2403+ require.NoError(t, err)
2404+ data := &types.RegistrationData{
2405+ MachineKey: old.MachineKey,
2406+ NodeKey: key.NewNode().Public(),
2407+ TKAKey: key.NewNLPrivate().Public(),
2408+ TKASignature: []byte("interactive-pending-signature"),
2409+ Hostname: old.Hostname,
2410+ Hostinfo: &tailcfg.Hostinfo{Hostname: old.Hostname},
2411+ }
2412+ authID := types.MustAuthID()
2413+ request := types.NewRegisterAuthRequest(data)
2414+ s.SetAuthCacheEntry(authID, request)
2415+ outage := errors.New("interactive forwarding outage")
2416+ s.TKAReconcile = func(ctx context.Context, _ types.NodeID, _ []byte) error {
2417+ // This is the real callback boundary, after SQL commit but before
2418+ // FinishAuth can report success to the waiting stock client.
2419+ nodes, err := s.TKACommittedNodes(ctx)
2420+ require.NoError(t, err)
2421+ require.Len(t, nodes, 1)
2422+ require.Equal(t, data.NodeKey, nodes[0].NodeKey)
2423+ require.Equal(t, data.TKAKey, nodes[0].TKAKey)
2424+ require.Equal(t, data.TKASignature, nodes[0].TKASignature)
2425+ select {
2426+ case <-request.WaitForAuth():
2427+ t.Fatal("interactive authentication completed before reconciliation")
2428+ default:
2429+ }
2430+ return outage
2431+ }
2432+ _, _, err = s.HandleNodeFromAuthPath(authID, types.UserID(*old.UserID), nil, "oidc")
2433+ require.ErrorIs(t, err, outage)
2434+ verdict := <-request.WaitForAuth()
2435+ require.ErrorIs(t, verdict.Err, outage)
2436+ require.False(t, verdict.Node.Valid())
2437+ stored, err := s.DB().GetNodeByID(id)
2438+ require.NoError(t, err)
2439+ require.Equal(t, data.TKAKey, stored.TKAKey)
2440+ require.Equal(t, data.TKASignature, stored.TKASignature)
2441+}
2442+
2443+func TestOmnetSameMachineCannotDuplicateNodeKeyAcrossUsers(t *testing.T) {
2444+ for _, interactive := range []bool{false, true} {
2445+ for _, existingTarget := range []bool{false, true} {
2446+ t.Run(fmt.Sprintf("interactive=%t/existing=%t", interactive, existingTarget), func(t *testing.T) {
2447+ _, s, id := persistTestSetup(t)
2448+ defer s.Close()
2449+ first, err := s.DB().GetNodeByID(id)
2450+ require.NoError(t, err)
2451+ first.TKAKey = key.NewNLPrivate().Public()
2452+ require.NoError(t, s.DB().DB.Save(first).Error)
2453+ s.nodeStore.PutNode(*first)
2454+ secondUser := s.CreateUserForTest("duplicate-target")
2455+ var second *types.Node
2456+ if existingTarget {
2457+ second = s.CreateRegisteredNodeForTest(secondUser, "existing-target")
2458+ second.MachineKey = first.MachineKey
2459+ second.TKAKey = key.NewNLPrivate().Public()
2460+ require.NoError(t, s.DB().DB.Save(second).Error)
2461+ s.nodeStore.PutNode(*second)
2462+ }
2463+ s.TKAReconcile = func(context.Context, types.NodeID, []byte) error {
2464+ t.Error("duplicate identity reached post-commit reconciliation")
2465+ return nil
2466+ }
2467+ if interactive {
2468+ id := types.MustAuthID()
2469+ s.SetAuthCacheEntry(id, types.NewRegisterAuthRequest(&types.RegistrationData{
2470+ MachineKey: first.MachineKey, NodeKey: first.NodeKey,
2471+ TKAKey: key.NewNLPrivate().Public(), Hostname: "duplicate-target",
2472+ Hostinfo: &tailcfg.Hostinfo{Hostname: "duplicate-target"},
2473+ }))
2474+ _, _, err = s.HandleNodeFromAuthPath(id, types.UserID(secondUser.ID), nil, "oidc")
2475+ } else {
2476+ pak, pakErr := s.CreatePreAuthKey(secondUser.TypedID(), true, false, nil, nil)
2477+ require.NoError(t, pakErr)
2478+ _, _, err = s.HandleNodeFromPreAuthKey(tailcfg.RegisterRequest{
2479+ NodeKey: first.NodeKey, NLKey: key.NewNLPrivate().Public(),
2480+ Auth: &tailcfg.RegisterResponseAuth{AuthKey: pak.Key},
2481+ Hostinfo: &tailcfg.Hostinfo{Hostname: "duplicate-target"},
2482+ }, first.MachineKey)
2483+ }
2484+ require.ErrorIs(t, err, ErrNodeKeyInUse)
2485+ s.TKAMu.Lock()
2486+ nodes, err := s.TKACommittedNodes(context.Background())
2487+ s.TKAMu.Unlock()
2488+ require.NoError(t, err, "refusal must leave a coherent unique roster")
2489+ wantCount := 1
2490+ if existingTarget {
2491+ wantCount = 2
2492+ stored, err := s.DB().GetNodeByID(second.ID)
2493+ require.NoError(t, err)
2494+ require.Equal(t, second.NodeKey, stored.NodeKey)
2495+ }
2496+ require.Len(t, nodes, wantCount)
2497+ stored, err := s.DB().GetNodeByID(first.ID)
2498+ require.NoError(t, err)
2499+ require.Equal(t, first.NodeKey, stored.NodeKey)
2500+ require.Equal(t, first.UserID, stored.UserID)
2501+ })
2502+ }
2503+ }
2504+}
2505+
2506+func TestOmnetReconcileFailureStillRefreshesCommittedPolicy(t *testing.T) {
2507+ for _, interactive := range []bool{false, true} {
2508+ t.Run(fmt.Sprintf("interactive=%t", interactive), func(t *testing.T) {
2509+ _, s, _ := persistTestSetup(t)
2510+ defer s.Close()
2511+ user := s.CreateUserForTest("outage-owner")
2512+ require.NoError(t, s.UpdatePolicyManagerUsersForTest())
2513+ _, err := s.SetPolicy([]byte(`{"grants":[{"src":["outage-owner@"],"dst":["*"],"ip":["*"]}]}`))
2514+ require.NoError(t, err)
2515+ before, _ := s.Filter()
2516+ outage := errors.New("injected post-commit outage")
2517+ var committedID types.NodeID
2518+ s.TKAReconcile = func(_ context.Context, id types.NodeID, _ []byte) error {
2519+ committedID = id
2520+ return outage
2521+ }
2522+ req := tailcfg.RegisterRequest{
2523+ NodeKey: key.NewNode().Public(), NLKey: key.NewNLPrivate().Public(),
2524+ Hostinfo: &tailcfg.Hostinfo{Hostname: "policy-outage-node"},
2525+ }
2526+ machine := key.NewMachine().Public()
2527+ if interactive {
2528+ id := types.MustAuthID()
2529+ request := types.NewRegisterAuthRequest(&types.RegistrationData{
2530+ MachineKey: machine, NodeKey: req.NodeKey, TKAKey: req.NLKey,
2531+ Hostname: req.Hostinfo.Hostname, Hostinfo: req.Hostinfo,
2532+ })
2533+ s.SetAuthCacheEntry(id, request)
2534+ _, _, err = s.HandleNodeFromAuthPath(id, types.UserID(user.ID), nil, "oidc")
2535+ require.ErrorIs(t, (<-request.WaitForAuth()).Err, outage)
2536+ } else {
2537+ pak, pakErr := s.CreatePreAuthKey(user.TypedID(), true, false, nil, nil)
2538+ require.NoError(t, pakErr)
2539+ req.Auth = &tailcfg.RegisterResponseAuth{AuthKey: pak.Key}
2540+ _, _, err = s.HandleNodeFromPreAuthKey(req, machine)
2541+ }
2542+ require.ErrorIs(t, err, outage)
2543+ stored, err := s.DB().GetNodeByID(committedID)
2544+ require.NoError(t, err)
2545+ require.Equal(t, req.NodeKey, stored.NodeKey)
2546+ after, _ := s.Filter()
2547+ require.NotEqual(t, before, after, "ACL sources must include the committed user node despite IPC failure")
2548+ usersChange, err := s.updatePolicyManagerUsers()
2549+ require.NoError(t, err)
2550+ nodesChange, err := s.updatePolicyManagerNodes()
2551+ require.NoError(t, err)
2552+ require.True(t, usersChange.IsEmpty())
2553+ require.True(t, nodesChange.IsEmpty(), "an unrelated later event must not be needed to heal policy")
2554+ })
2555+ }
2556+}
2557diff --git a/hscontrol/tkad.go b/hscontrol/tkad.go
2558new file mode 100644
2559index 0000000..16ddd4f
2560--- /dev/null
2561+++ b/hscontrol/tkad.go
2562@@ -0,0 +1,725 @@
2563+package hscontrol
2564+
2565+import (
2566+ "bytes"
2567+ "context"
2568+ "encoding/binary"
2569+ "encoding/json"
2570+ "errors"
2571+ "fmt"
2572+ "io"
2573+ "maps"
2574+ "net"
2575+ "net/http"
2576+ "os"
2577+ "path/filepath"
2578+ "slices"
2579+ "strconv"
2580+ "sync"
2581+ "time"
2582+
2583+ "github.com/go-chi/chi/v5"
2584+ "github.com/juanfont/headscale/hscontrol/types"
2585+ "github.com/juanfont/headscale/hscontrol/types/change"
2586+ "github.com/rs/zerolog/log"
2587+ "tailscale.com/tailcfg"
2588+ "tailscale.com/types/key"
2589+)
2590+
2591+const tkaBodyLimit = 65536
2592+
2593+// Reserve enough JSON space for the largest registry tuple and base64 expansion.
2594+const tkaSignatureLimit = (tkaBodyLimit - 512) / 4 * 3
2595+const tkaTimeout = 8 * time.Second
2596+
2597+// Unauthenticated Noise clients reach these paths before any identity check, so
2598+// the number of request goroutines waiting for the publication barrier is
2599+// bounded: a caller that cannot take a slot is told to retry instead of
2600+// queueing behind shared persistence work.
2601+const (
2602+ tkaRegisterSlots = 4
2603+ tkaMapSlots = 32
2604+)
2605+
2606+var errTKAUnavailable = errors.New("omnet authority unavailable or registration pending")
2607+var errTKABusy = errors.New("omnet publication busy; retry")
2608+
2609+// This is transport glue. Omega alone parses TKA RPCs, verifies signatures,
2610+// chooses authority state and decides enablement/disablement. The local socket
2611+// profile trusts the same UID; it is not a separate-UID security boundary.
2612+type tkaAdapter struct {
2613+ h *Headscale
2614+ socket string
2615+ owner uint64
2616+ revision uint64 // accessed under State.TKAMu
2617+ haveRevision bool
2618+ healthMu sync.Mutex
2619+ failed chan struct{}
2620+ healthy bool
2621+ registerSlots chan struct{}
2622+ mapSlots chan struct{}
2623+}
2624+
2625+// admit takes an admission slot without waiting. Slots bound pre-barrier work;
2626+// they are not a rate limit and do not order publication.
2627+func admit(slots chan struct{}) bool {
2628+ select {
2629+ case slots <- struct{}{}:
2630+ return true
2631+ default:
2632+ return false
2633+ }
2634+}
2635+
2636+func release(slots chan struct{}) { <-slots }
2637+
2638+type tkaRegistryNode struct {
2639+ NodeID types.NodeID
2640+ NodePublic key.NodePublic
2641+ RotationPubkey []byte
2642+ KeySignature []byte
2643+}
2644+
2645+type tkaSnapshot struct {
2646+ TKAInfo *tailcfg.TKAInfo
2647+ Revision uint64
2648+ Nodes []tkaRegistryNode
2649+}
2650+
2651+func (h *Headscale) initTKA() error {
2652+ socket, ownerText := os.Getenv("OMNET_TKAD_SOCKET"), os.Getenv("OMNET_TKAD_ADMIN_USER_ID")
2653+ if socket == "" && ownerText == "" {
2654+ // A database that already used the adapter must not start in stock
2655+ // mode: maps would carry nil TKAInfo and no signatures, which clients
2656+ // with Tailnet Lock enabled cannot recover from without local disable.
2657+ used, err := h.state.TKAAdapterInstalled(context.Background())
2658+ if err != nil {
2659+ return fmt.Errorf("omnet adapter state unreadable: %w", err)
2660+ }
2661+ if used {
2662+ return errors.New("omnet adapter state exists; OMNET_TKAD_SOCKET and OMNET_TKAD_ADMIN_USER_ID are required")
2663+ }
2664+ return nil
2665+ }
2666+ owner, err := strconv.ParseUint(ownerText, 10, 64)
2667+ if err != nil || owner == 0 || !filepath.IsAbs(socket) {
2668+ return errors.New("OMNET_TKAD_SOCKET must be absolute and OMNET_TKAD_ADMIN_USER_ID must be positive")
2669+ }
2670+ a := &tkaAdapter{
2671+ h: h,
2672+ socket: socket,
2673+ owner: owner,
2674+ failed: make(chan struct{}),
2675+ healthy: true,
2676+ registerSlots: make(chan struct{}, tkaRegisterSlots),
2677+ mapSlots: make(chan struct{}, tkaMapSlots),
2678+ }
2679+ h.tkad = a
2680+ h.state.TKAReconcile = a.reconcileRegistration
2681+ h.state.TKAMu.Lock()
2682+ defer h.state.TKAMu.Unlock()
2683+ ctx, cancel := context.WithTimeout(context.Background(), tkaTimeout)
2684+ defer cancel()
2685+ if _, err := a.readSnapshot(ctx); err != nil {
2686+ return err
2687+ }
2688+ if _, _, err := a.reconcile(ctx); err != nil {
2689+ // Keep control available for authenticated retries/admin deletion,
2690+ // but no map or TKA RPC may pass the reconciliation barrier.
2691+ log.Warn().Err(err).Msg("omnet registry pending; control publication blocked")
2692+ }
2693+ return nil
2694+}
2695+
2696+func (a *tkaAdapter) health(ok bool) {
2697+ a.healthMu.Lock()
2698+ defer a.healthMu.Unlock()
2699+ if !ok && a.healthy {
2700+ close(a.failed)
2701+ } else if ok && !a.healthy {
2702+ a.failed = make(chan struct{})
2703+ }
2704+ a.healthy = ok
2705+}
2706+
2707+func (h *Headscale) tkaFailure() <-chan struct{} {
2708+ if h.tkad == nil {
2709+ return nil
2710+ }
2711+ h.tkad.healthMu.Lock()
2712+ defer h.tkad.healthMu.Unlock()
2713+ return h.tkad.failed
2714+}
2715+
2716+// rpc exchanges one bounded, deadline-limited IPC frame. A lost reply is not
2717+// a rollback indication; durable registration outboxes are reconciled by read.
2718+func (a *tkaAdapter) rpc(ctx context.Context, route byte, admin bool, nodeID types.NodeID, body []byte) (_ int, _ []byte, retErr error) {
2719+ if len(body) > tkaBodyLimit {
2720+ return 0, nil, errors.New("omnet request too large")
2721+ }
2722+ parent := ctx
2723+ defer func() {
2724+ if retErr != nil && parent.Err() == nil {
2725+ a.health(false)
2726+ }
2727+ }()
2728+ ctx, cancel := context.WithTimeout(ctx, tkaTimeout)
2729+ defer cancel()
2730+ conn, err := (&net.Dialer{}).DialContext(ctx, "unix", a.socket)
2731+ if err != nil {
2732+ return 0, nil, errTKAUnavailable
2733+ }
2734+ defer conn.Close()
2735+ deadline, _ := ctx.Deadline()
2736+ if err := conn.SetDeadline(deadline); err != nil {
2737+ return 0, nil, errTKAUnavailable
2738+ }
2739+ var header [20]byte
2740+ copy(header[:4], "TKA\x01")
2741+ header[4] = route
2742+ if admin {
2743+ header[5] = 1
2744+ }
2745+ binary.LittleEndian.PutUint64(header[8:16], uint64(nodeID))
2746+ binary.LittleEndian.PutUint32(header[16:20], uint32(len(body)))
2747+ for _, part := range [][]byte{header[:], body} {
2748+ for len(part) > 0 {
2749+ n, err := conn.Write(part)
2750+ if err != nil || n == 0 {
2751+ return 0, nil, errTKAUnavailable
2752+ }
2753+ part = part[n:]
2754+ }
2755+ }
2756+ var response [12]byte
2757+ if _, err := io.ReadFull(conn, response[:]); err != nil {
2758+ return 0, nil, errTKAUnavailable
2759+ }
2760+ status := int(binary.LittleEndian.Uint16(response[4:6]))
2761+ length := binary.LittleEndian.Uint32(response[8:12])
2762+ if string(response[:4]) != "TKA\x01" || response[6] != 0 || response[7] != 0 ||
2763+ length > tkaBodyLimit || status < 200 || status > 599 {
2764+ return 0, nil, errTKAUnavailable
2765+ }
2766+ result := make([]byte, int(length))
2767+ if _, err := io.ReadFull(conn, result); err != nil {
2768+ return 0, nil, errTKAUnavailable
2769+ }
2770+ return status, result, nil
2771+}
2772+
2773+func (a *tkaAdapter) readSnapshot(ctx context.Context) (*tkaSnapshot, error) {
2774+ status, body, err := a.rpc(ctx, 11, true, 0, []byte("{}"))
2775+ if err != nil || status != http.StatusOK {
2776+ return nil, errTKAUnavailable
2777+ }
2778+ var wire struct {
2779+ TKAInfo json.RawMessage
2780+ Revision *uint64
2781+ Nodes *[]tkaRegistryNode
2782+ }
2783+ if err := json.Unmarshal(body, &wire); err != nil || wire.Revision == nil ||
2784+ wire.Nodes == nil || len(wire.TKAInfo) == 0 || len(*wire.Nodes) > 64 {
2785+ return nil, errTKAUnavailable
2786+ }
2787+ snap := tkaSnapshot{Revision: *wire.Revision, Nodes: *wire.Nodes}
2788+ if err := json.Unmarshal(wire.TKAInfo, &snap.TKAInfo); err != nil {
2789+ return nil, errTKAUnavailable
2790+ }
2791+ seen := make(map[types.NodeID]bool, len(snap.Nodes))
2792+ keys := make(map[key.NodePublic]bool, len(snap.Nodes))
2793+ for _, n := range snap.Nodes {
2794+ if n.NodeID == 0 || n.NodeID > 1<<63-1 || n.NodePublic.IsZero() ||
2795+ len(n.RotationPubkey) != 32 || seen[n.NodeID] || keys[n.NodePublic] {
2796+ return nil, errTKAUnavailable
2797+ }
2798+ seen[n.NodeID], keys[n.NodePublic] = true, true
2799+ }
2800+ if a.haveRevision && snap.Revision < a.revision {
2801+ return nil, errors.New("omnet authority revision regressed")
2802+ }
2803+ if err := a.h.state.TKACheckRevision(ctx, snap.Revision); err != nil {
2804+ return nil, err
2805+ }
2806+ return &snap, nil
2807+}
2808+
2809+// reconcile runs under the shared identity/publication barrier. SQL is the
2810+// desired registry; Omega is the only accepted-signature store. Exact reads
2811+// suppress unchanged writes, so adapter restart preserves pending init.
2812+func (a *tkaAdapter) reconcile(ctx context.Context) (_ *tkaSnapshot, _ []types.Node, retErr error) {
2813+ if err := ctx.Err(); err != nil {
2814+ return nil, nil, err
2815+ }
2816+ // A disconnected requester cannot cancel a shared persistence/publication
2817+ // barrier and thereby declare the daemon unhealthy for every other node.
2818+ ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), tkaTimeout)
2819+ defer cancel()
2820+ defer func() { a.health(retErr == nil) }()
2821+ nodes, err := a.h.state.TKACommittedNodes(ctx)
2822+ if err != nil {
2823+ return nil, nil, err
2824+ }
2825+ snap, err := a.readSnapshot(ctx)
2826+ if err != nil {
2827+ return nil, nil, err
2828+ }
2829+ current := make(map[types.NodeID]tkaRegistryNode, len(snap.Nodes))
2830+ desired := make(map[types.NodeID]key.NodePublic, len(nodes))
2831+ for _, n := range snap.Nodes {
2832+ current[n.NodeID] = n
2833+ }
2834+ // Adoption window: a node committed before this adapter existed has no
2835+ // NLKey. While TKAInfo is null (inactive, or pending init, which tkaRPC
2836+ // refuses to begin or finish while such a node exists) it is left out of
2837+ // the registry and served as upstream would serve it, so deploying
2838+ // over an existing database does not black out control. It joins the
2839+ // registry when it re-registers. Once the authority exists, a node without
2840+ // an NLKey still blocks publication for the whole tailnet, as before.
2841+ inactive := snap.TKAInfo == nil
2842+ registry := nodes[:0:0]
2843+ for _, n := range nodes {
2844+ if n.TKAKey.IsZero() {
2845+ if inactive {
2846+ continue
2847+ }
2848+ return nil, nil, errors.New("omnet node lacks authenticated NLKey; re-register it")
2849+ }
2850+ desired[n.ID] = n.NodeKey
2851+ registry = append(registry, n)
2852+ }
2853+ mutated := false
2854+ // Vacate all obsolete keys before claiming any desired key, including
2855+ // cycles after an outage. A changed key cannot retain its old signature.
2856+ for _, n := range snap.Nodes {
2857+ if desired[n.NodeID] == n.NodePublic {
2858+ continue
2859+ }
2860+ body, _ := json.Marshal(struct{ NodeID types.NodeID }{n.NodeID})
2861+ status, _, err := a.rpc(ctx, 10, true, 0, body)
2862+ if err != nil || status != http.StatusOK {
2863+ return nil, nil, errTKAUnavailable
2864+ }
2865+ mutated = true
2866+ delete(current, n.NodeID)
2867+ }
2868+ for _, n := range registry {
2869+ old, found := current[n.ID]
2870+ tupleMatches := found && old.NodePublic == n.NodeKey && bytes.Equal(old.RotationPubkey, n.TKAKey.Verifier())
2871+ sigMatches := len(n.TKASignature) == 0 || bytes.Equal(old.KeySignature, n.TKASignature)
2872+ if !tupleMatches || !sigMatches {
2873+ upsert := struct {
2874+ NodeID types.NodeID
2875+ NodeKey key.NodePublic
2876+ RotationPubkey []byte
2877+ Signature []byte `json:",omitempty"`
2878+ }{n.ID, n.NodeKey, n.TKAKey.Verifier(), n.TKASignature}
2879+ body, err := json.Marshal(upsert)
2880+ if err != nil {
2881+ return nil, nil, err
2882+ }
2883+ status := http.StatusRequestEntityTooLarge
2884+ if len(body) <= tkaBodyLimit {
2885+ status, _, err = a.rpc(ctx, 9, true, 0, body)
2886+ }
2887+ if err != nil {
2888+ // A lost reply may have committed. Preserve the outbox until
2889+ // accepted readback or a definitive response resolves it.
2890+ return nil, nil, err
2891+ }
2892+ if len(upsert.Signature) != 0 && (status == http.StatusBadRequest ||
2893+ status == http.StatusForbidden || status == http.StatusConflict ||
2894+ (status == http.StatusRequestEntityTooLarge && len(body) > tkaBodyLimit)) {
2895+ // These are the pinned daemon's invalid/malformed/inactive
2896+ // signature responses. Require an unsigned upsert to succeed:
2897+ // an admin/identity rejection must not be reported as success.
2898+ // Same-key omission preserves Omega's accepted signature;
2899+ // a changed key becomes unsigned, never authorized by this glue.
2900+ upsert.Signature = nil
2901+ body, err = json.Marshal(upsert)
2902+ if err != nil {
2903+ return nil, nil, err
2904+ }
2905+ status, _, err = a.rpc(ctx, 9, true, 0, body)
2906+ }
2907+ if err != nil || status != http.StatusOK {
2908+ return nil, nil, errTKAUnavailable
2909+ }
2910+ mutated = true
2911+ }
2912+ if err := a.h.state.TKAAcknowledge(ctx, n); err != nil {
2913+ return nil, nil, err
2914+ }
2915+ }
2916+ if mutated {
2917+ snap, err = a.readSnapshot(ctx)
2918+ if err != nil {
2919+ return nil, nil, err
2920+ }
2921+ }
2922+ if !a.haveRevision || snap.Revision != a.revision {
2923+ a.revision, a.haveRevision = snap.Revision, true
2924+ if a.h.mapBatcher != nil {
2925+ a.h.Change(change.FullUpdate())
2926+ }
2927+ }
2928+ return snap, nodes, nil
2929+}
2930+
2931+// Registration success must not conceal a rejected submitted signature. An
2932+// unrelated node's rejected outbox does not fail this caller or global health.
2933+func (a *tkaAdapter) reconcileRegistration(ctx context.Context, id types.NodeID, signature []byte) error {
2934+ snap, _, err := a.reconcile(ctx)
2935+ if err != nil || len(signature) == 0 {
2936+ return err
2937+ }
2938+ for _, n := range snap.Nodes {
2939+ if n.NodeID == id && bytes.Equal(n.KeySignature, signature) {
2940+ return nil
2941+ }
2942+ }
2943+ // Authentication may already have committed ownership/policy changes even
2944+ // when the same-key unsigned retry leaves Omega's revision unchanged.
2945+ if a.h.mapBatcher != nil {
2946+ a.h.Change(change.FullUpdate())
2947+ }
2948+ return errors.New("omnet rejected node key signature")
2949+}
2950+
2951+func (h *Headscale) watchTKA(ctx context.Context) {
2952+ if h.tkad == nil {
2953+ return
2954+ }
2955+ ticker := time.NewTicker(time.Second)
2956+ defer ticker.Stop()
2957+ for {
2958+ select {
2959+ case <-ctx.Done():
2960+ return
2961+ case <-ticker.C:
2962+ h.state.TKAMu.Lock()
2963+ checkCtx, cancel := context.WithTimeout(ctx, tkaTimeout)
2964+ _, _, _ = h.tkad.reconcile(checkCtx)
2965+ cancel()
2966+ h.state.TKAMu.Unlock()
2967+ }
2968+ }
2969+}
2970+
2971+func (ns *noiseServer) tkaRoutes(r chi.Router) {
2972+ for route, path := range []string{"/init/begin", "/init/finish", "/bootstrap", "/sync/offer", "/sync/send", "/disable", "/sign", "/affected-sigs"} {
2973+ r.Get("/tka"+path, func(w http.ResponseWriter, req *http.Request) { ns.tkaRPC(w, req, byte(route+1)) })
2974+ }
2975+}
2976+
2977+func (ns *noiseServer) tkaRPC(w http.ResponseWriter, req *http.Request, route byte) {
2978+ a := ns.headscale.tkad
2979+ if a == nil {
2980+ http.Error(w, "omnet not configured", http.StatusServiceUnavailable)
2981+ return
2982+ }
2983+ controller := http.NewResponseController(w)
2984+ _ = controller.SetReadDeadline(time.Now().Add(tkaTimeout))
2985+ body, err := io.ReadAll(io.LimitReader(req.Body, tkaBodyLimit+1))
2986+ _ = controller.SetReadDeadline(time.Time{})
2987+ if err != nil || len(body) > tkaBodyLimit {
2988+ http.Error(w, "invalid omnet body", http.StatusRequestEntityTooLarge)
2989+ return
2990+ }
2991+ // This decode selects an identity only. The original bytes are forwarded
2992+ // unchanged; Omega independently rejects duplicate fields and binds NodeKey.
2993+ var selector struct{ NodeKey key.NodePublic }
2994+ if json.Unmarshal(body, &selector) != nil || selector.NodeKey.IsZero() {
2995+ http.Error(w, "invalid omnet identity", http.StatusBadRequest)
2996+ return
2997+ }
2998+ // An unregistered Noise identity must not reach shared persistence work:
2999+ // committed SQL is the registry source, and the barrier repeats this check.
3000+ if _, ok, err := a.h.state.TKAAdmission(req.Context(), ns.machineKey, selector.NodeKey); err != nil {
3001+ http.Error(w, errTKAUnavailable.Error(), http.StatusServiceUnavailable)
3002+ return
3003+ } else if !ok {
3004+ http.Error(w, "unauthorized omnet identity", http.StatusUnauthorized)
3005+ return
3006+ }
3007+ status, reply, err := func() (int, []byte, error) {
3008+ a.h.state.TKAMu.Lock()
3009+ defer a.h.state.TKAMu.Unlock()
3010+ if err := req.Context().Err(); err != nil {
3011+ return http.StatusServiceUnavailable, nil, err
3012+ }
3013+ ctx, cancel := context.WithTimeout(context.WithoutCancel(req.Context()), tkaTimeout)
3014+ defer cancel()
3015+ _, nodes, err := a.reconcile(ctx)
3016+ if err != nil {
3017+ return http.StatusServiceUnavailable, nil, errTKAUnavailable
3018+ }
3019+ var caller *types.Node
3020+ for i := range nodes {
3021+ if nodes[i].NodeKey == selector.NodeKey && nodes[i].MachineKey == ns.machineKey {
3022+ caller = &nodes[i]
3023+ }
3024+ }
3025+ if caller == nil {
3026+ return http.StatusUnauthorized, nil, errors.New("unauthorized omnet identity")
3027+ }
3028+ admin := !caller.IsExpired() && !caller.IsTagged() && caller.UserID != nil && uint64(*caller.UserID) == a.owner
3029+ if (route == 1 || route == 2) && admin {
3030+ // /init/begin and /init/finish by the owner (anyone else is refused
3031+ // by the daemon and learns nothing here): a node without an NLKey cannot be
3032+ // signed in the initial roster and would be locked out (or, once
3033+ // the authority exists, block every map). Refuse until it re-registers.
3034+ missing := 0
3035+ for i := range nodes {
3036+ if nodes[i].TKAKey.IsZero() {
3037+ missing++
3038+ }
3039+ }
3040+ if missing != 0 {
3041+ return http.StatusConflict, nil, fmt.Errorf(
3042+ "%d node(s) have no tailnet-lock key yet; each must sign in again (tailscale up --force-reauth) before tailnet lock can start", missing)
3043+ }
3044+ }
3045+ status, reply, err := a.rpc(ctx, route, admin, caller.ID, body)
3046+ if err != nil {
3047+ // This is our detached IPC deadline, not caller cancellation.
3048+ // A lost mutation reply must stop publication until readback.
3049+ a.health(false)
3050+ return http.StatusServiceUnavailable, nil, errTKAUnavailable
3051+ }
3052+ // A successful mutation is not retried because notification fails.
3053+ if status == http.StatusOK && a.h.mapBatcher != nil {
3054+ a.h.Change(change.FullUpdate())
3055+ }
3056+ return status, reply, nil
3057+ }()
3058+ _ = controller.SetWriteDeadline(time.Now().Add(tkaTimeout))
3059+ defer controller.SetWriteDeadline(time.Time{})
3060+ if err != nil {
3061+ http.Error(w, err.Error(), status)
3062+ return
3063+ }
3064+ w.Header().Set("Content-Type", "application/json")
3065+ w.WriteHeader(status)
3066+ _, _ = w.Write(reply)
3067+}
3068+
3069+// registrationPrelude supplies the stock client's two-step signature challenge
3070+// before upstream authentication. Possession of the old Noise identity never
3071+// substitutes for interactive reauthentication, including for unexpired nodes.
3072+func (h *Headscale) registrationPrelude(ctx context.Context, req tailcfg.RegisterRequest, machine key.MachinePublic) (*tailcfg.RegisterResponse, error) {
3073+ if h.tkad == nil {
3074+ return nil, nil
3075+ }
3076+ if req.NodeKey.IsZero() || req.NLKey.IsZero() || len(req.NodeKeySignature) > tkaSignatureLimit {
3077+ return nil, errors.New("omnet requires nonzero NodeKey, NLKey and bounded signature")
3078+ }
3079+ if err := ctx.Err(); err != nil {
3080+ return nil, err
3081+ }
3082+ // Registration is reachable with an unknown machine key. Bound how many
3083+ // such requests can wait for the shared barrier; clients retry instead of
3084+ // queueing behind persistence work.
3085+ if !admit(h.tkad.registerSlots) {
3086+ return nil, errTKABusy
3087+ }
3088+ defer release(h.tkad.registerSlots)
3089+ h.state.TKAMu.Lock()
3090+ defer h.state.TKAMu.Unlock()
3091+ ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), tkaTimeout)
3092+ defer cancel()
3093+ snap, err := h.tkad.readSnapshot(ctx)
3094+ if err != nil {
3095+ h.tkad.health(false)
3096+ return nil, err
3097+ }
3098+ nodes, err := h.state.TKACommittedNodes(ctx)
3099+ if err != nil {
3100+ return nil, err
3101+ }
3102+ for _, n := range nodes {
3103+ if n.NodeKey != req.OldNodeKey || n.NodeKey == req.NodeKey {
3104+ continue
3105+ }
3106+ if n.MachineKey != machine {
3107+ return nil, errors.New("omnet old node belongs to another Noise identity")
3108+ }
3109+ for _, stored := range snap.Nodes {
3110+ if stored.NodeID == n.ID && stored.NodePublic == n.NodeKey &&
3111+ len(stored.KeySignature) > 0 && len(req.NodeKeySignature) == 0 {
3112+ return &tailcfg.RegisterResponse{NodeKeySignature: stored.KeySignature}, nil
3113+ }
3114+ }
3115+ }
3116+ return nil, nil
3117+}
3118+
3119+func (h *Headscale) tkaMapReady(ctx context.Context) error {
3120+ if h.tkad == nil {
3121+ return nil
3122+ }
3123+ if !admit(h.tkad.mapSlots) {
3124+ return errTKABusy
3125+ }
3126+ defer release(h.tkad.mapSlots)
3127+ h.state.TKAMu.Lock()
3128+ defer h.state.TKAMu.Unlock()
3129+ ctx, cancel := context.WithTimeout(ctx, tkaTimeout)
3130+ defer cancel()
3131+ _, _, err := h.tkad.reconcile(ctx)
3132+ return err
3133+}
3134+
3135+// encodeTKAMap is the last publication barrier, including already queued maps.
3136+// A stale key or stale authenticated session closes the stream instead of
3137+// pairing an old identity with a current signature (or publishing a fallback).
3138+func (m *mapSession) encodeTKAMap(msg *tailcfg.MapResponse) ([]byte, error) {
3139+ a := m.h.tkad
3140+ m.h.state.TKAMu.Lock()
3141+ defer m.h.state.TKAMu.Unlock()
3142+ ctx, cancel := context.WithTimeout(m.ctx, tkaTimeout)
3143+ defer cancel()
3144+ snap, nodes, err := a.reconcile(ctx)
3145+ if err != nil {
3146+ return nil, err
3147+ }
3148+ validSession := false
3149+ for _, n := range nodes {
3150+ if n.ID == m.node.ID && n.NodeKey == m.req.NodeKey && n.MachineKey == m.node.MachineKey {
3151+ validSession = true
3152+ }
3153+ }
3154+ if !validSession {
3155+ return nil, errors.New("stale omnet map session")
3156+ }
3157+ // A PeerChange cannot clear a previous signature with nil. Rebuild key
3158+ // patches as full nodes, including an unsigned rotation, before publication.
3159+ for _, patch := range msg.PeersChangedPatch {
3160+ if patch.Key != nil {
3161+ full, err := m.h.mapBatcher.FullMapResponse(m.node.ID, m.capVer)
3162+ if err != nil {
3163+ return nil, err
3164+ }
3165+ full.PingRequest = msg.PingRequest
3166+ msg = full
3167+ break
3168+ }
3169+ }
3170+ copyNode := func(n *tailcfg.Node) *tailcfg.Node {
3171+ if n == nil {
3172+ return nil
3173+ }
3174+ copied := *n
3175+ return &copied
3176+ }
3177+ out := new(tailcfg.MapResponse)
3178+ *out = *msg
3179+ out.Node = copyNode(msg.Node)
3180+ out.Peers = slices.Clone(msg.Peers)
3181+ for i, n := range out.Peers {
3182+ out.Peers[i] = copyNode(n)
3183+ }
3184+ out.PeersChanged = slices.Clone(msg.PeersChanged)
3185+ for i, n := range out.PeersChanged {
3186+ out.PeersChanged[i] = copyNode(n)
3187+ }
3188+ out.PeersChangedPatch = slices.Clone(msg.PeersChangedPatch)
3189+ for i, patch := range out.PeersChangedPatch {
3190+ copied := *patch
3191+ out.PeersChangedPatch[i] = &copied
3192+ }
3193+ out.TKAInfo = snap.TKAInfo
3194+ registry := make(map[types.NodeID]tkaRegistryNode, len(snap.Nodes))
3195+ for _, n := range snap.Nodes {
3196+ registry[n.NodeID] = n
3197+ }
3198+ // Adoption window (see reconcile): while the authority is inactive, a
3199+ // committed node without an NLKey is published unsigned, as upstream does.
3200+ legacy := make(map[types.NodeID]key.NodePublic)
3201+ if snap.TKAInfo == nil {
3202+ for _, n := range nodes {
3203+ if n.TKAKey.IsZero() {
3204+ legacy[n.ID] = n.NodeKey
3205+ }
3206+ }
3207+ }
3208+ decorate := func(n *tailcfg.Node) error {
3209+ if n == nil {
3210+ return nil
3211+ }
3212+ if k, ok := legacy[types.NodeID(n.ID)]; ok && k == n.Key {
3213+ n.KeySignature = nil
3214+ return nil
3215+ }
3216+ stored, ok := registry[types.NodeID(n.ID)]
3217+ if !ok || stored.NodePublic != n.Key {
3218+ return errors.New("stale omnet map node")
3219+ }
3220+ n.KeySignature = stored.KeySignature
3221+ return nil
3222+ }
3223+ if err := decorate(out.Node); err != nil {
3224+ return nil, err
3225+ }
3226+ if out.Node != nil {
3227+ out.Node.CapMap = maps.Clone(out.Node.CapMap)
3228+ if out.Node.CapMap == nil {
3229+ out.Node.CapMap = make(tailcfg.NodeCapMap)
3230+ }
3231+ out.Node.CapMap[tailcfg.CapabilityTailnetLock] = nil
3232+ }
3233+ for _, n := range out.Peers {
3234+ if err := decorate(n); err != nil {
3235+ return nil, err
3236+ }
3237+ }
3238+ for _, n := range out.PeersChanged {
3239+ if err := decorate(n); err != nil {
3240+ return nil, err
3241+ }
3242+ }
3243+ for _, patch := range out.PeersChangedPatch {
3244+ _, inRegistry := registry[types.NodeID(patch.NodeID)]
3245+ _, isLegacy := legacy[types.NodeID(patch.NodeID)]
3246+ if !inRegistry && !isLegacy {
3247+ return nil, errors.New("stale omnet map patch")
3248+ }
3249+ // A non-key patch may be queued behind a rotation. It cannot safely
3250+ // attach the new key's signature to the client's previous key.
3251+ patch.KeySignature = nil
3252+ }
3253+ return encodeMapResponse(m.req.Compress, out)
3254+}
3255+
3256+// Each session's poll loop is a single writer, preserving frame order. The
3257+// coherent frame is frozen under TKAMu, but no client I/O holds the barrier.
3258+func (m *mapSession) writeTKAMap(msg *tailcfg.MapResponse) error {
3259+ if m.h.tkad == nil {
3260+ return writeMapResponse(m.w, m.req.Compress, m.isStreaming(), msg)
3261+ }
3262+ frame, err := m.encodeTKAMap(msg)
3263+ if err != nil {
3264+ return err
3265+ }
3266+ m.writeDeadlineMu.Lock()
3267+ if m.cancelChClosed.Load() {
3268+ m.writeDeadlineMu.Unlock()
3269+ return errMapSessionStopped
3270+ }
3271+ if err := m.ctx.Err(); err != nil {
3272+ m.writeDeadlineMu.Unlock()
3273+ return err
3274+ }
3275+ controller := http.NewResponseController(m.w)
3276+ err = controller.SetWriteDeadline(time.Now().Add(tkaTimeout))
3277+ m.writeDeadlineMu.Unlock()
3278+ if err != nil && !errors.Is(err, http.ErrNotSupported) {
3279+ return fmt.Errorf("omnet write deadline: %w", err)
3280+ }
3281+ defer func() {
3282+ m.writeDeadlineMu.Lock()
3283+ defer m.writeDeadlineMu.Unlock()
3284+ _ = controller.SetWriteDeadline(time.Time{})
3285+ }()
3286+ return writeMapFrame(m.w, m.isStreaming(), frame)
3287+}
3288diff --git a/hscontrol/tkad_test.go b/hscontrol/tkad_test.go
3289new file mode 100644
3290index 0000000..5cfbb14
3291--- /dev/null
3292+++ b/hscontrol/tkad_test.go
3293@@ -0,0 +1,895 @@
3294+package hscontrol
3295+
3296+import (
3297+ "bytes"
3298+ "context"
3299+ "encoding/binary"
3300+ "encoding/json"
3301+ "fmt"
3302+ "io"
3303+ "net"
3304+ "net/http"
3305+ "net/http/httptest"
3306+ "os"
3307+ "path/filepath"
3308+ "slices"
3309+ "sync"
3310+ "testing"
3311+ "time"
3312+
3313+ "github.com/go-chi/chi/v5"
3314+ "github.com/juanfont/headscale/hscontrol/types"
3315+ "github.com/stretchr/testify/require"
3316+ "tailscale.com/tailcfg"
3317+ "tailscale.com/types/key"
3318+)
3319+
3320+// This fixture tests glue only. Real Omega protocol/security behavior is
3321+// exercised by Omnet's native daemon suite and stock-client E2E, not simulated.
3322+type omnetFixture struct {
3323+ mu sync.Mutex
3324+ snapshot tkaSnapshot
3325+ writes int
3326+ calls []byte
3327+ lastHeader [20]byte
3328+ badRead bool
3329+ rejectSignature int
3330+ rejectUnsigned int
3331+ dropReplyRoute byte
3332+ beforeReply func(byte)
3333+}
3334+
3335+func omnetSocket(t *testing.T, f *omnetFixture) string {
3336+ t.Helper()
3337+ // A short directory: t.TempDir() under a long TMPDIR can exceed the
3338+ // 108-byte Unix socket path limit and fail bind with EINVAL.
3339+ dir, err := os.MkdirTemp("/tmp", "omnet")
3340+ require.NoError(t, err)
3341+ t.Cleanup(func() { _ = os.RemoveAll(dir) })
3342+ path := filepath.Join(dir, "t.sock")
3343+ listener, err := net.Listen("unix", path)
3344+ require.NoError(t, err)
3345+ t.Cleanup(func() { _ = listener.Close() })
3346+ go func() {
3347+ for {
3348+ conn, err := listener.Accept()
3349+ if err != nil {
3350+ return
3351+ }
3352+ func() {
3353+ defer conn.Close()
3354+ var hdr [20]byte
3355+ if _, err := io.ReadFull(conn, hdr[:]); err != nil {
3356+ return
3357+ }
3358+ length := binary.LittleEndian.Uint32(hdr[16:20])
3359+ if length > tkaBodyLimit {
3360+ return
3361+ }
3362+ body := make([]byte, length)
3363+ if _, err := io.ReadFull(conn, body); err != nil {
3364+ return
3365+ }
3366+ f.mu.Lock()
3367+ defer f.mu.Unlock()
3368+ f.calls = append(f.calls, hdr[4])
3369+ reply := []byte("{\"opaque\":true}")
3370+ status := http.StatusOK
3371+ switch hdr[4] {
3372+ case 9:
3373+ var n struct {
3374+ NodeID types.NodeID
3375+ NodeKey key.NodePublic
3376+ RotationPubkey []byte
3377+ Signature []byte
3378+ }
3379+ if json.Unmarshal(body, &n) != nil {
3380+ return
3381+ }
3382+ if len(n.Signature) != 0 && f.rejectSignature != 0 {
3383+ status = f.rejectSignature
3384+ break
3385+ }
3386+ if len(n.Signature) == 0 && f.rejectUnsigned != 0 {
3387+ status = f.rejectUnsigned
3388+ break
3389+ }
3390+ if slices.ContainsFunc(f.snapshot.Nodes, func(x tkaRegistryNode) bool {
3391+ return x.NodeID != n.NodeID && x.NodePublic == n.NodeKey
3392+ }) {
3393+ status = http.StatusConflict
3394+ break
3395+ }
3396+ oldIndex := slices.IndexFunc(f.snapshot.Nodes, func(x tkaRegistryNode) bool { return x.NodeID == n.NodeID })
3397+ newNode := tkaRegistryNode{n.NodeID, n.NodeKey, n.RotationPubkey, n.Signature}
3398+ if oldIndex >= 0 {
3399+ old := f.snapshot.Nodes[oldIndex]
3400+ if len(n.Signature) == 0 && old.NodePublic == n.NodeKey {
3401+ newNode.KeySignature = old.KeySignature
3402+ }
3403+ f.snapshot.Nodes[oldIndex] = newNode
3404+ } else {
3405+ f.snapshot.Nodes = append(f.snapshot.Nodes, newNode)
3406+ }
3407+ f.writes++
3408+ f.snapshot.Revision++
3409+ case 10:
3410+ var n struct{ NodeID types.NodeID }
3411+ if json.Unmarshal(body, &n) != nil {
3412+ return
3413+ }
3414+ f.snapshot.Nodes = slices.DeleteFunc(f.snapshot.Nodes, func(x tkaRegistryNode) bool { return x.NodeID == n.NodeID })
3415+ f.writes++
3416+ f.snapshot.Revision++
3417+ case 11:
3418+ reply, _ = json.Marshal(f.snapshot)
3419+ if f.badRead {
3420+ reply = []byte("{}")
3421+ }
3422+ default:
3423+ f.lastHeader = hdr
3424+ if (hdr[4] == 1 || hdr[4] == 2 || hdr[4] == 6) && hdr[5] == 0 {
3425+ status = http.StatusForbidden
3426+ }
3427+ }
3428+ if f.beforeReply != nil {
3429+ f.beforeReply(hdr[4])
3430+ }
3431+ if f.dropReplyRoute == hdr[4] {
3432+ f.dropReplyRoute = 0
3433+ return
3434+ }
3435+ var response [12]byte
3436+ copy(response[:], "TKA\x01")
3437+ binary.LittleEndian.PutUint16(response[4:6], uint16(status))
3438+ binary.LittleEndian.PutUint32(response[8:], uint32(len(reply)))
3439+ _, _ = conn.Write(response[:])
3440+ _, _ = conn.Write(reply)
3441+ }()
3442+ }
3443+ }()
3444+ return path
3445+}
3446+
3447+func omnetApp(t *testing.T) (*Headscale, types.Node, *omnetFixture) {
3448+ t.Helper()
3449+ h := createTestApp(t)
3450+ user := h.state.CreateUserForTest("omnet-owner")
3451+ n := h.state.CreateRegisteredNodeForTest(user, "omnet-node")
3452+ n.TKAKey = key.NewNLPrivate().Public()
3453+ require.NoError(t, h.state.DB().DB.Save(n).Error)
3454+ h.state.PutNodeInStoreForTest(*n)
3455+ f := &omnetFixture{snapshot: tkaSnapshot{Revision: 7, Nodes: []tkaRegistryNode{{n.ID, n.NodeKey, n.TKAKey.Verifier(), []byte("accepted-signature")}}}}
3456+ a := &tkaAdapter{
3457+ h: h,
3458+ socket: omnetSocket(t, f),
3459+ owner: uint64(user.ID),
3460+ failed: make(chan struct{}),
3461+ healthy: true,
3462+ registerSlots: make(chan struct{}, tkaRegisterSlots),
3463+ mapSlots: make(chan struct{}, tkaMapSlots),
3464+ }
3465+ h.tkad = a
3466+ h.state.TKAReconcile = a.reconcileRegistration
3467+ return h, *n, f
3468+}
3469+
3470+func TestOmnetRawRoutesIdentityAndAdmin(t *testing.T) {
3471+ h, n, f := omnetApp(t)
3472+ ns := &noiseServer{headscale: h, machineKey: n.MachineKey}
3473+ router := chi.NewRouter()
3474+ ns.tkaRoutes(router)
3475+ body := []byte(fmt.Sprintf(" { \"NodeKey\": %q, \"unknown\": [1,2] }\n", n.NodeKey.String()))
3476+ w := httptest.NewRecorder()
3477+ router.ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/tka/init/begin", bytes.NewReader(body)))
3478+ require.Equal(t, http.StatusOK, w.Code)
3479+ f.mu.Lock()
3480+ require.Equal(t, byte(1), f.lastHeader[5], "current owner receives admin assertion")
3481+ f.mu.Unlock()
3482+ ns.machineKey = key.NewMachine().Public()
3483+ w = httptest.NewRecorder()
3484+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
3485+ require.Equal(t, http.StatusUnauthorized, w.Code)
3486+ ns.machineKey = n.MachineKey
3487+ h.tkad.owner++
3488+ w = httptest.NewRecorder()
3489+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
3490+ f.mu.Lock()
3491+ require.Zero(t, f.lastHeader[5], "non-owner cannot assert admin")
3492+ f.mu.Unlock()
3493+}
3494+
3495+func TestOmnetUnregisteredNoiseIdentitySkipsAuthority(t *testing.T) {
3496+ h, n, f := omnetApp(t)
3497+ ns := &noiseServer{headscale: h, machineKey: key.NewMachine().Public()}
3498+ body := []byte(fmt.Sprintf("{\"NodeKey\":%q}", n.NodeKey.String()))
3499+ w := httptest.NewRecorder()
3500+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
3501+ require.Equal(t, http.StatusUnauthorized, w.Code, "machine key must match")
3502+ // A registered machine key with an unregistered node key is also refused.
3503+ ns.machineKey = n.MachineKey
3504+ body = []byte(fmt.Sprintf("{\"NodeKey\":%q}", key.NewNode().Public().String()))
3505+ w = httptest.NewRecorder()
3506+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
3507+ require.Equal(t, http.StatusUnauthorized, w.Code, "node key must be committed")
3508+ f.mu.Lock()
3509+ defer f.mu.Unlock()
3510+ require.Empty(t, f.calls, "unregistered identities must not reach the authority")
3511+}
3512+
3513+func TestOmnetBoundedAdmissionRejectsInsteadOfQueueing(t *testing.T) {
3514+ h, n, _ := omnetApp(t)
3515+ for range tkaRegisterSlots {
3516+ require.True(t, admit(h.tkad.registerSlots))
3517+ }
3518+ _, err := h.registrationPrelude(context.Background(), tailcfg.RegisterRequest{
3519+ NodeKey: key.NewNode().Public(), NLKey: key.NewNLPrivate().Public(),
3520+ }, n.MachineKey)
3521+ require.ErrorIs(t, err, errTKABusy, "saturated registration admission must fail fast")
3522+ for range tkaRegisterSlots {
3523+ release(h.tkad.registerSlots)
3524+ }
3525+ for range tkaMapSlots {
3526+ require.True(t, admit(h.tkad.mapSlots))
3527+ }
3528+ require.ErrorIs(t, h.tkaMapReady(context.Background()), errTKABusy, "saturated map admission must fail fast")
3529+ for range tkaMapSlots {
3530+ release(h.tkad.mapSlots)
3531+ }
3532+ require.NoError(t, h.tkaMapReady(context.Background()))
3533+}
3534+
3535+func TestOmnetAdapterSettingsRequiredAfterActivation(t *testing.T) {
3536+ h := createTestApp(t)
3537+ t.Setenv("OMNET_TKAD_SOCKET", "")
3538+ t.Setenv("OMNET_TKAD_ADMIN_USER_ID", "")
3539+ require.NoError(t, h.initTKA(), "unused adapter may stay off")
3540+ user := h.state.CreateUserForTest("omnet-owner")
3541+ n := h.state.CreateRegisteredNodeForTest(user, "omnet-node")
3542+ n.TKAKey = key.NewNLPrivate().Public()
3543+ require.NoError(t, h.state.DB().DB.Save(n).Error)
3544+ require.Error(t, h.initTKA(), "adapter state must not silently fall back to stock maps")
3545+}
3546+
3547+func TestOmnetRestartDoesNotRewriteRegistry(t *testing.T) {
3548+ h, _, f := omnetApp(t)
3549+ for range 2 {
3550+ h.state.TKAMu.Lock()
3551+ snapshot, _, err := h.tkad.reconcile(context.Background())
3552+ h.state.TKAMu.Unlock()
3553+ require.NoError(t, err)
3554+ require.Equal(t, uint64(7), snapshot.Revision)
3555+ // Drop adapter-only acknowledged revision state, as on restart.
3556+ h.tkad.haveRevision = false
3557+ }
3558+ f.mu.Lock()
3559+ defer f.mu.Unlock()
3560+ require.Zero(t, f.writes, "unchanged registry must preserve a pending init")
3561+}
3562+
3563+func TestOmnetHistoricalOutboxReadbackAndOrphanRemoval(t *testing.T) {
3564+ h, n, f := omnetApp(t)
3565+ n.TKASignature = []byte("accepted-signature")
3566+ require.NoError(t, h.state.DB().DB.Save(&n).Error)
3567+ h.state.PutNodeInStoreForTest(n)
3568+ f.mu.Lock()
3569+ f.snapshot.Nodes = append(f.snapshot.Nodes, tkaRegistryNode{99, key.NewNode().Public(), key.NewNLPrivate().Public().Verifier(), nil})
3570+ f.mu.Unlock()
3571+ h.state.TKAMu.Lock()
3572+ _, _, err := h.tkad.reconcile(context.Background())
3573+ h.state.TKAMu.Unlock()
3574+ require.NoError(t, err)
3575+ stored, err := h.state.DB().GetNodeByID(n.ID)
3576+ require.NoError(t, err)
3577+ require.Empty(t, stored.TKASignature)
3578+ f.mu.Lock()
3579+ defer f.mu.Unlock()
3580+ require.Equal(t, 1, f.writes, "only orphan deletion; historical signature must not be replayed")
3581+ require.NotContains(t, f.calls, byte(9))
3582+}
3583+
3584+func TestOmnetRotationChallengePrecedesKeyChange(t *testing.T) {
3585+ h, n, _ := omnetApp(t)
3586+ req := tailcfg.RegisterRequest{NodeKey: key.NewNode().Public(), OldNodeKey: n.NodeKey, NLKey: n.TKAKey}
3587+ resp, err := h.registrationPrelude(context.Background(), req, n.MachineKey)
3588+ require.NoError(t, err)
3589+ require.Equal(t, []byte("accepted-signature"), []byte(resp.NodeKeySignature))
3590+ stored, err := h.state.DB().GetNodeByID(n.ID)
3591+ require.NoError(t, err)
3592+ require.Equal(t, n.NodeKey, stored.NodeKey)
3593+ req.NodeKeySignature = []byte("resigned")
3594+ resp, err = h.registrationPrelude(context.Background(), req, n.MachineKey)
3595+ require.NoError(t, err)
3596+ require.Nil(t, resp, "signature challenge must fall through to upstream authentication")
3597+ resp, err = h.handleRegister(context.Background(), req, n.MachineKey)
3598+ require.NoError(t, err)
3599+ require.NotEmpty(t, resp.AuthURL)
3600+ require.False(t, resp.MachineAuthorized, "a re-signed key is not user authentication")
3601+ stored, err = h.state.DB().GetNodeByID(n.ID)
3602+ require.NoError(t, err)
3603+ require.Equal(t, n.NodeKey, stored.NodeKey, "key remains unchanged until upstream auth completes")
3604+ require.Empty(t, stored.TKASignature)
3605+}
3606+
3607+func TestOmnetMapSnapshotAndOutageFailClosed(t *testing.T) {
3608+ h, n, f := omnetApp(t)
3609+ w := httptest.NewRecorder()
3610+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
3611+ msg := &tailcfg.MapResponse{Node: &tailcfg.Node{ID: n.ID.NodeID(), Key: n.NodeKey}}
3612+ require.NoError(t, m.writeTKAMap(msg))
3613+ require.Empty(t, msg.Node.KeySignature, "wire decoration must not mutate shared mapper nodes")
3614+ wire := w.Body.Bytes()
3615+ var response tailcfg.MapResponse
3616+ require.NoError(t, json.Unmarshal(wire[4:], &response))
3617+ require.Equal(t, []byte("accepted-signature"), []byte(response.Node.KeySignature))
3618+ w.Body.Reset()
3619+ msg.Node.Key = key.NewNode().Public()
3620+ require.Error(t, m.writeTKAMap(msg))
3621+ require.Zero(t, w.Body.Len())
3622+ msg.Node.Key = n.NodeKey
3623+ failure := h.tkaFailure()
3624+ f.mu.Lock()
3625+ f.badRead = true
3626+ f.mu.Unlock()
3627+ require.Error(t, m.writeTKAMap(msg))
3628+ require.Zero(t, w.Body.Len())
3629+ select {
3630+ case <-failure:
3631+ default:
3632+ t.Fatal("daemon read failure must stop existing streams")
3633+ }
3634+}
3635+
3636+func TestOmnetUnsignedKeyPatchBecomesFullPeer(t *testing.T) {
3637+ h, self, f := omnetApp(t)
3638+ peerUser := h.state.CreateUserForTest("omnet-peer")
3639+ peer := h.state.CreateRegisteredNodeForTest(peerUser, "unsigned-rotated-peer")
3640+ peer.TKAKey = key.NewNLPrivate().Public()
3641+ require.NoError(t, h.state.DB().DB.Save(peer).Error)
3642+ h.state.PutNodeInStoreForTest(*peer)
3643+ require.NoError(t, h.state.UpdatePolicyManagerUsersForTest())
3644+ require.NoError(t, h.state.UpdatePolicyManagerNodesForTest())
3645+ f.mu.Lock()
3646+ f.snapshot.Nodes = append(f.snapshot.Nodes, tkaRegistryNode{peer.ID, peer.NodeKey, peer.TKAKey.Verifier(), nil})
3647+ f.mu.Unlock()
3648+ w := httptest.NewRecorder()
3649+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: self.NodeKey}, node: &self, w: w}
3650+ msg := &tailcfg.MapResponse{PeersChangedPatch: []*tailcfg.PeerChange{{NodeID: peer.ID.NodeID(), Key: &peer.NodeKey}}}
3651+ require.NoError(t, m.writeTKAMap(msg))
3652+ var response tailcfg.MapResponse
3653+ require.NoError(t, json.Unmarshal(w.Body.Bytes()[4:], &response))
3654+ require.NotNil(t, response.Node)
3655+ require.Empty(t, response.PeersChangedPatch, "nil signature patch cannot clear prior signature")
3656+ found := false
3657+ for _, got := range response.Peers {
3658+ if got.ID == peer.ID.NodeID() {
3659+ found = true
3660+ require.Equal(t, peer.NodeKey, got.Key)
3661+ require.Empty(t, got.KeySignature)
3662+ }
3663+ }
3664+ require.True(t, found, "full unsigned node replaces prior signed peer")
3665+}
3666+
3667+func TestOmnetDeletedNoiseIdentityCannotReachAuthority(t *testing.T) {
3668+ h, n, f := omnetApp(t)
3669+ node, ok := h.state.GetNodeByID(n.ID)
3670+ require.True(t, ok)
3671+ _, err := h.state.DeleteNode(node)
3672+ require.NoError(t, err)
3673+ ns := &noiseServer{headscale: h, machineKey: n.MachineKey}
3674+ body := []byte(fmt.Sprintf("{\"NodeKey\":%q}", n.NodeKey.String()))
3675+ w := httptest.NewRecorder()
3676+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
3677+ require.Equal(t, http.StatusUnauthorized, w.Code)
3678+ f.mu.Lock()
3679+ require.NotContains(t, f.calls, byte(1))
3680+ f.mu.Unlock()
3681+ // A rejected identity no longer performs shared persistence work; orphan
3682+ // removal is the watcher's job, which the fixture drives directly.
3683+ h.state.TKAMu.Lock()
3684+ _, _, err = h.tkad.reconcile(context.Background())
3685+ h.state.TKAMu.Unlock()
3686+ require.NoError(t, err)
3687+ f.mu.Lock()
3688+ defer f.mu.Unlock()
3689+ require.Empty(t, f.snapshot.Nodes, "deleted registry identity must be reconciled")
3690+}
3691+
3692+func TestOmnetRegistrationRejectsInvalidEnvelopeBeforePersistence(t *testing.T) {
3693+ for _, test := range []struct {
3694+ name string
3695+ zeroKey bool
3696+ signatureSize int
3697+ }{
3698+ {"zero-node-key", true, 1},
3699+ {"base64-overflow", false, tkaSignatureLimit + 1},
3700+ } {
3701+ t.Run(test.name, func(t *testing.T) {
3702+ h, n, f := omnetApp(t)
3703+ req := tailcfg.RegisterRequest{
3704+ OldNodeKey: n.NodeKey, NodeKey: key.NewNode().Public(), NLKey: n.TKAKey,
3705+ NodeKeySignature: make([]byte, test.signatureSize),
3706+ }
3707+ if test.zeroKey {
3708+ req.NodeKey = key.NodePublic{}
3709+ }
3710+ resp, err := h.registrationPrelude(context.Background(), req, n.MachineKey)
3711+ require.Error(t, err)
3712+ require.Nil(t, resp)
3713+ stored, err := h.state.DB().GetNodeByID(n.ID)
3714+ require.NoError(t, err)
3715+ require.Equal(t, n.NodeKey, stored.NodeKey)
3716+ require.Empty(t, stored.TKASignature)
3717+ f.mu.Lock()
3718+ require.Empty(t, f.calls, "invalid input is refused before IPC or SQL mutation")
3719+ f.mu.Unlock()
3720+ })
3721+ }
3722+}
3723+
3724+func TestOmnetExpiredOwnerCannotAdminister(t *testing.T) {
3725+ h, n, f := omnetApp(t)
3726+ expiry := time.Now().Add(-time.Minute)
3727+ n.Expiry = &expiry
3728+ require.NoError(t, h.state.DB().DB.Save(&n).Error)
3729+ h.state.PutNodeInStoreForTest(n)
3730+ ns := &noiseServer{headscale: h, machineKey: n.MachineKey}
3731+ body := []byte(fmt.Sprintf("{\"NodeKey\":%q}", n.NodeKey.String()))
3732+ for _, route := range []byte{1, 2, 6} {
3733+ w := httptest.NewRecorder()
3734+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), route)
3735+ require.Equal(t, http.StatusForbidden, w.Code)
3736+ f.mu.Lock()
3737+ require.Zero(t, f.lastHeader[5], "expired owner must not assert admin")
3738+ f.mu.Unlock()
3739+ }
3740+}
3741+
3742+func TestOmnetDefinitiveRejectedOutboxIsLocal(t *testing.T) {
3743+ for _, status := range []int{http.StatusBadRequest, http.StatusForbidden, http.StatusConflict, http.StatusRequestEntityTooLarge} {
3744+ for _, rotated := range []bool{false, true} {
3745+ t.Run(fmt.Sprintf("%d/rotated=%t", status, rotated), func(t *testing.T) {
3746+ h, n, f := omnetApp(t)
3747+ if rotated {
3748+ n.NodeKey = key.NewNode().Public()
3749+ }
3750+ n.TKASignature = []byte("rejected-pending-signature")
3751+ if status == http.StatusRequestEntityTooLarge {
3752+ // Legacy persisted data from before encoded-envelope validation.
3753+ n.TKASignature = make([]byte, tkaBodyLimit)
3754+ }
3755+ require.NoError(t, h.state.DB().DB.Save(&n).Error)
3756+ h.state.PutNodeInStoreForTest(n)
3757+ f.mu.Lock()
3758+ f.rejectSignature = status
3759+ f.mu.Unlock()
3760+ failure := h.tkaFailure()
3761+ h.state.TKAMu.Lock()
3762+ err := h.tkad.reconcileRegistration(context.Background(), n.ID, n.TKASignature)
3763+ h.state.TKAMu.Unlock()
3764+ require.ErrorContains(t, err, "rejected node key signature")
3765+ stored, err := h.state.DB().GetNodeByID(n.ID)
3766+ require.NoError(t, err)
3767+ require.Empty(t, stored.TKASignature, "clear only the rejected forwarding outbox")
3768+ cached, ok := h.state.GetNodeByID(n.ID)
3769+ require.True(t, ok)
3770+ require.Empty(t, cached.AsStruct().TKASignature)
3771+ require.NoError(t, h.tkaMapReady(context.Background()))
3772+ select {
3773+ case <-failure:
3774+ t.Fatal("a rejected node signature stopped unrelated streams")
3775+ default:
3776+ }
3777+ f.mu.Lock()
3778+ require.Len(t, f.snapshot.Nodes, 1)
3779+ require.Equal(t, n.NodeKey, f.snapshot.Nodes[0].NodePublic)
3780+ if rotated {
3781+ require.Empty(t, f.snapshot.Nodes[0].KeySignature)
3782+ } else {
3783+ require.Equal(t, []byte("accepted-signature"), f.snapshot.Nodes[0].KeySignature)
3784+ }
3785+ f.mu.Unlock()
3786+ w := httptest.NewRecorder()
3787+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
3788+ require.NoError(t, m.writeTKAMap(&tailcfg.MapResponse{Node: &tailcfg.Node{ID: n.ID.NodeID(), Key: n.NodeKey}}))
3789+ })
3790+ }
3791+ }
3792+}
3793+
3794+func TestOmnetRejectedRegistrationReportsErrorWithoutPoisoningPeers(t *testing.T) {
3795+ h, n, f := omnetApp(t)
3796+ peerUser := h.state.CreateUserForTest("unaffected-peer")
3797+ peer := h.state.CreateRegisteredNodeForTest(peerUser, "unaffected-peer")
3798+ peer.TKAKey = key.NewNLPrivate().Public()
3799+ require.NoError(t, h.state.DB().DB.Save(peer).Error)
3800+ h.state.PutNodeInStoreForTest(*peer)
3801+ f.mu.Lock()
3802+ f.rejectSignature = http.StatusForbidden
3803+ f.snapshot.Nodes = append(f.snapshot.Nodes, tkaRegistryNode{peer.ID, peer.NodeKey, peer.TKAKey.Verifier(), []byte("peer-accepted")})
3804+ f.mu.Unlock()
3805+ req := tailcfg.RegisterRequest{NodeKey: n.NodeKey, NLKey: n.TKAKey, NodeKeySignature: []byte("bad-signature")}
3806+ err := h.state.TKARegisterCurrent(context.Background(), req, n.MachineKey)
3807+ require.ErrorContains(t, err, "rejected node key signature")
3808+ require.NoError(t, h.tkaMapReady(context.Background()))
3809+ req.NodeKeySignature = nil
3810+ require.NoError(t, h.state.TKARegisterCurrent(context.Background(), req, n.MachineKey))
3811+ require.NoError(t, h.state.TKARegisterCurrent(context.Background(), tailcfg.RegisterRequest{
3812+ NodeKey: peer.NodeKey, NLKey: peer.TKAKey,
3813+ }, peer.MachineKey))
3814+ w := httptest.NewRecorder()
3815+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: peer.NodeKey}, node: peer, w: w}
3816+ require.NoError(t, m.writeTKAMap(&tailcfg.MapResponse{Node: &tailcfg.Node{ID: peer.ID.NodeID(), Key: peer.NodeKey}}))
3817+ var response tailcfg.MapResponse
3818+ require.NoError(t, json.Unmarshal(w.Body.Bytes()[4:], &response))
3819+ require.Equal(t, []byte("peer-accepted"), []byte(response.Node.KeySignature))
3820+}
3821+
3822+func TestOmnetAmbiguousAndUnauthorizedOutboxesRemainFailClosed(t *testing.T) {
3823+ for _, test := range []struct {
3824+ name string
3825+ signedStatus int
3826+ unsignedStatus int
3827+ drop bool
3828+ }{
3829+ {"lost-accepted-reply", 0, 0, true},
3830+ {"server-error", http.StatusInternalServerError, 0, false},
3831+ {"unauthenticated-ipc", http.StatusUnauthorized, 0, false},
3832+ {"admin-denied-even-unsigned", http.StatusForbidden, http.StatusForbidden, false},
3833+ } {
3834+ t.Run(test.name, func(t *testing.T) {
3835+ h, n, f := omnetApp(t)
3836+ n.TKASignature = []byte("pending")
3837+ require.NoError(t, h.state.DB().DB.Save(&n).Error)
3838+ h.state.PutNodeInStoreForTest(n)
3839+ f.mu.Lock()
3840+ f.rejectSignature, f.rejectUnsigned = test.signedStatus, test.unsignedStatus
3841+ if test.drop {
3842+ f.dropReplyRoute = 9
3843+ }
3844+ f.mu.Unlock()
3845+ failure := h.tkaFailure()
3846+ require.Error(t, h.tkaMapReady(context.Background()))
3847+ stored, err := h.state.DB().GetNodeByID(n.ID)
3848+ require.NoError(t, err)
3849+ require.Equal(t, n.TKASignature, stored.TKASignature)
3850+ select {
3851+ case <-failure:
3852+ default:
3853+ t.Fatal("unresolved transport/auth failure must block publication")
3854+ }
3855+ if test.drop {
3856+ require.NoError(t, h.tkaMapReady(context.Background()), "readback resolves a lost successful reply")
3857+ stored, err = h.state.DB().GetNodeByID(n.ID)
3858+ require.NoError(t, err)
3859+ require.Empty(t, stored.TKASignature)
3860+ f.mu.Lock()
3861+ require.Equal(t, 1, f.writes, "accepted readback must not replay")
3862+ f.mu.Unlock()
3863+ }
3864+ })
3865+ }
3866+}
3867+
3868+func TestOmnetCancelledClientDoesNotFailGlobalHealth(t *testing.T) {
3869+ h, n, f := omnetApp(t)
3870+ failure := h.tkaFailure()
3871+ ctx, cancel := context.WithCancel(context.Background())
3872+ cancel()
3873+ w := httptest.NewRecorder()
3874+ m := &mapSession{h: h, ctx: ctx, req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
3875+ require.ErrorIs(t, m.writeTKAMap(&tailcfg.MapResponse{KeepAlive: true}), context.Canceled)
3876+ require.ErrorIs(t, h.tkaMapReady(ctx), context.Canceled)
3877+ _, _, err := h.tkad.rpc(ctx, 11, true, 0, []byte("{}"))
3878+ require.Error(t, err)
3879+ // Also disconnect after reconciliation has started a live daemon read.
3880+ ctx, cancel = context.WithCancel(context.Background())
3881+ m.ctx = ctx
3882+ started, release := make(chan struct{}), make(chan struct{})
3883+ var once sync.Once
3884+ f.mu.Lock()
3885+ f.beforeReply = func(route byte) {
3886+ if route == 11 {
3887+ once.Do(func() { close(started); <-release })
3888+ }
3889+ }
3890+ f.mu.Unlock()
3891+ done := make(chan error, 1)
3892+ go func() { done <- m.writeTKAMap(&tailcfg.MapResponse{KeepAlive: true}) }()
3893+ <-started
3894+ cancel()
3895+ close(release)
3896+ require.ErrorIs(t, <-done, context.Canceled)
3897+ require.Empty(t, w.Body.Bytes())
3898+ select {
3899+ case <-failure:
3900+ t.Fatal("client cancellation closed another client's failure channel")
3901+ default:
3902+ }
3903+ require.NoError(t, h.tkaMapReady(context.Background()))
3904+}
3905+
3906+func TestOmnetNonKeyPatchNeverCarriesCurrentSignature(t *testing.T) {
3907+ h, n, f := omnetApp(t)
3908+ f.mu.Lock()
3909+ f.snapshot.Nodes[0].KeySignature = []byte("new-key-signature")
3910+ f.mu.Unlock()
3911+ w := httptest.NewRecorder()
3912+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
3913+ msg := &tailcfg.MapResponse{PeersChangedPatch: []*tailcfg.PeerChange{{
3914+ NodeID: n.ID.NodeID(), KeySignature: []byte("queued-old-signature"),
3915+ }}}
3916+ require.NoError(t, m.writeTKAMap(msg))
3917+ var response tailcfg.MapResponse
3918+ require.NoError(t, json.Unmarshal(w.Body.Bytes()[4:], &response))
3919+ require.Len(t, response.PeersChangedPatch, 1)
3920+ require.Empty(t, response.PeersChangedPatch[0].KeySignature)
3921+ require.Equal(t, []byte("queued-old-signature"), []byte(msg.PeersChangedPatch[0].KeySignature))
3922+}
3923+
3924+type omnetBlockedWriter struct {
3925+ *httptest.ResponseRecorder
3926+ started chan struct{}
3927+ release chan struct{}
3928+ once sync.Once
3929+ mu sync.Mutex
3930+ deadlines []time.Time
3931+}
3932+
3933+func (w *omnetBlockedWriter) Write(p []byte) (int, error) {
3934+ w.once.Do(func() { close(w.started); <-w.release })
3935+ return w.ResponseRecorder.Write(p)
3936+}
3937+
3938+func (w *omnetBlockedWriter) SetWriteDeadline(deadline time.Time) error {
3939+ w.mu.Lock()
3940+ defer w.mu.Unlock()
3941+ w.deadlines = append(w.deadlines, deadline)
3942+ return nil
3943+}
3944+
3945+func TestOmnetSlowWriterReleasesBarrierAndKeepsFrameOrder(t *testing.T) {
3946+ h, n, f := omnetApp(t)
3947+ w := &omnetBlockedWriter{ResponseRecorder: httptest.NewRecorder(), started: make(chan struct{}), release: make(chan struct{})}
3948+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
3949+ msg := &tailcfg.MapResponse{Node: &tailcfg.Node{ID: n.ID.NodeID(), Key: n.NodeKey}}
3950+ done := make(chan error, 1)
3951+ go func() { done <- m.writeTKAMap(msg) }()
3952+ <-w.started
3953+ locked := h.state.TKAMu.TryLock()
3954+ if !locked {
3955+ close(w.release)
3956+ <-done
3957+ t.Fatal("client write holds the global publication barrier")
3958+ }
3959+ f.mu.Lock()
3960+ f.snapshot.Nodes[0].KeySignature = []byte("new-snapshot")
3961+ f.snapshot.Revision++
3962+ f.mu.Unlock()
3963+ h.state.TKAMu.Unlock()
3964+ other := httptest.NewRecorder()
3965+ peer := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: other}
3966+ err := peer.writeTKAMap(msg)
3967+ close(w.release)
3968+ require.NoError(t, <-done)
3969+ require.NoError(t, err, "another client's write must complete while the first is blocked")
3970+ require.NoError(t, m.writeTKAMap(msg))
3971+ wire := w.Body.Bytes()
3972+ for _, signature := range []string{"accepted-signature", "new-snapshot"} {
3973+ require.GreaterOrEqual(t, len(wire), 4)
3974+ size := int(binary.LittleEndian.Uint32(wire[:4]))
3975+ require.GreaterOrEqual(t, len(wire), 4+size)
3976+ var response tailcfg.MapResponse
3977+ require.NoError(t, json.Unmarshal(wire[4:4+size], &response))
3978+ require.Equal(t, []byte(signature), []byte(response.Node.KeySignature))
3979+ wire = wire[4+size:]
3980+ }
3981+ require.Empty(t, wire)
3982+}
3983+
3984+func TestOmnetStoppedQueuedWriteCannotExtendStopDeadline(t *testing.T) {
3985+ h, n, _ := omnetApp(t)
3986+ w := &omnetBlockedWriter{ResponseRecorder: httptest.NewRecorder(), started: make(chan struct{}), release: make(chan struct{})}
3987+ close(w.release)
3988+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w, cancelCh: make(chan struct{})}
3989+ h.state.TKAMu.Lock()
3990+ done := make(chan error, 1)
3991+ go func() { done <- m.writeMap(&tailcfg.MapResponse{KeepAlive: true}) }()
3992+ require.Eventually(t, m.writing.Load, time.Second, time.Millisecond)
3993+ m.stopFromBatcher()
3994+ h.state.TKAMu.Unlock()
3995+ require.ErrorIs(t, <-done, errMapSessionStopped)
3996+ w.mu.Lock()
3997+ defer w.mu.Unlock()
3998+ require.Len(t, w.deadlines, 1, "no later write may replace the stop deadline")
3999+ require.Empty(t, w.Body.Bytes())
4000+}
4001+
4002+func TestOmnetKeyReuseRecoveryVacatesAllKeysFirst(t *testing.T) {
4003+ for _, lostRemovalReply := range []bool{false, true} {
4004+ t.Run(fmt.Sprintf("lost-removal=%t", lostRemovalReply), func(t *testing.T) {
4005+ h, first, f := omnetApp(t)
4006+ otherUser := h.state.CreateUserForTest("reuse-peer")
4007+ second := h.state.CreateRegisteredNodeForTest(otherUser, "reuse-peer")
4008+ second.TKAKey = key.NewNLPrivate().Public()
4009+ oldFirst, oldSecond := first.NodeKey, second.NodeKey
4010+ f.mu.Lock()
4011+ f.snapshot.Nodes = append(f.snapshot.Nodes, tkaRegistryNode{second.ID, oldSecond, second.TKAKey.Verifier(), nil})
4012+ if lostRemovalReply {
4013+ f.dropReplyRoute = 10
4014+ }
4015+ f.mu.Unlock()
4016+ // A cycle is stronger than row ordering: neither key can be claimed
4017+ // until both old holders have been removed.
4018+ first.NodeKey, second.NodeKey = oldSecond, oldFirst
4019+ first.TKASignature, second.TKASignature = []byte("first-new"), []byte("second-new")
4020+ require.NoError(t, h.state.DB().DB.Save(&first).Error)
4021+ require.NoError(t, h.state.DB().DB.Save(second).Error)
4022+ h.state.PutNodeInStoreForTest(first)
4023+ h.state.PutNodeInStoreForTest(*second)
4024+ if lostRemovalReply {
4025+ require.Error(t, h.tkaMapReady(context.Background()))
4026+ stored, err := h.state.DB().GetNodeByID(first.ID)
4027+ require.NoError(t, err)
4028+ require.Equal(t, first.TKASignature, stored.TKASignature)
4029+ }
4030+ require.NoError(t, h.tkaMapReady(context.Background()))
4031+ f.mu.Lock()
4032+ require.Len(t, f.snapshot.Nodes, 2)
4033+ for _, got := range f.snapshot.Nodes {
4034+ want := first
4035+ if got.NodeID == second.ID {
4036+ want = *second
4037+ }
4038+ require.Equal(t, want.NodeKey, got.NodePublic)
4039+ require.Equal(t, want.TKASignature, got.KeySignature)
4040+ }
4041+ mutations := slices.DeleteFunc(slices.Clone(f.calls), func(route byte) bool { return route == 11 })
4042+ require.Equal(t, []byte{10, 10, 9, 9}, mutations, "vacate before claim, even after an ambiguous removal")
4043+ f.mu.Unlock()
4044+ })
4045+ }
4046+}
4047+
4048+func TestOmnetFollowupReturnsAuthenticationFailure(t *testing.T) {
4049+ h, n, _ := omnetApp(t)
4050+ id := types.MustAuthID()
4051+ request := types.NewRegisterAuthRequest(&types.RegistrationData{MachineKey: n.MachineKey, NodeKey: n.NodeKey})
4052+ h.state.SetAuthCacheEntry(id, request)
4053+ rejection := fmt.Errorf("omnet rejected node key signature")
4054+ request.FinishAuth(types.AuthVerdict{Err: rejection})
4055+ resp, err := h.waitForFollowup(context.Background(), tailcfg.RegisterRequest{
4056+ NodeKey: n.NodeKey, Followup: "http://localhost/register/" + id.String(),
4057+ }, n.MachineKey)
4058+ require.ErrorIs(t, err, rejection)
4059+ require.Nil(t, resp, "rejection must not become a fresh login or authorized response")
4060+}
4061+
4062+func TestOmnetRPCWritesOutsidePublicationBarrier(t *testing.T) {
4063+ for _, authorized := range []bool{false, true} {
4064+ t.Run(fmt.Sprintf("authorized=%t", authorized), func(t *testing.T) {
4065+ h, n, _ := omnetApp(t)
4066+ machine := n.MachineKey
4067+ if !authorized {
4068+ machine = key.NewMachine().Public()
4069+ }
4070+ ns := &noiseServer{headscale: h, machineKey: machine}
4071+ w := &omnetBlockedWriter{ResponseRecorder: httptest.NewRecorder(), started: make(chan struct{}), release: make(chan struct{})}
4072+ body := []byte(fmt.Sprintf("{\"NodeKey\":%q}", n.NodeKey.String()))
4073+ done := make(chan struct{})
4074+ go func() {
4075+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
4076+ close(done)
4077+ }()
4078+ <-w.started
4079+ locked := h.state.TKAMu.TryLock()
4080+ if locked {
4081+ h.state.TKAMu.Unlock()
4082+ }
4083+ close(w.release)
4084+ <-done
4085+ require.True(t, locked, "both success and error writes must release the barrier")
4086+ want := http.StatusUnauthorized
4087+ if authorized {
4088+ want = http.StatusOK
4089+ }
4090+ require.Equal(t, want, w.Code)
4091+ })
4092+ }
4093+}
4094+
4095+// A node committed before the adapter existed has no NLKey. While the
4096+// authority is inactive it must not black out control: it is left out of the
4097+// registry, its own map is served, and init refuses until it re-registers.
4098+func TestOmnetLegacyNodeAdoptionWindow(t *testing.T) {
4099+ h, n, f := omnetApp(t)
4100+ legacy := h.state.CreateRegisteredNodeForTest(h.state.CreateUserForTest("omnet-legacy"), "omnet-legacy")
4101+ h.state.PutNodeInStoreForTest(*legacy)
4102+ require.True(t, legacy.TKAKey.IsZero())
4103+
4104+ // Inactive authority (TKAInfo null): reconcile succeeds without touching it.
4105+ h.state.TKAMu.Lock()
4106+ snap, nodes, err := h.tkad.reconcile(context.Background())
4107+ h.state.TKAMu.Unlock()
4108+ require.NoError(t, err, "legacy node must not block an inactive authority")
4109+ require.Len(t, snap.Nodes, 1, "legacy node is not added to the registry")
4110+ require.True(t, slices.ContainsFunc(nodes, func(x types.Node) bool { return x.ID == legacy.ID }),
4111+ "legacy node stays a valid map session")
4112+ f.mu.Lock()
4113+ require.Zero(t, f.writes, "no registry write for the legacy node")
4114+ f.mu.Unlock()
4115+
4116+ w := httptest.NewRecorder()
4117+ lm := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: legacy.NodeKey}, node: legacy, w: w}
4118+ require.NoError(t, lm.writeTKAMap(&tailcfg.MapResponse{Node: &tailcfg.Node{ID: legacy.ID.NodeID(), Key: legacy.NodeKey}}))
4119+ require.NotZero(t, w.Body.Len(), "legacy node receives its map while the authority is inactive")
4120+ w = httptest.NewRecorder()
4121+ lm.w = w
4122+ require.Error(t, lm.writeTKAMap(&tailcfg.MapResponse{Node: &tailcfg.Node{ID: legacy.ID.NodeID(), Key: key.NewNode().Public()}}),
4123+ "a legacy node with a key other than its committed one is still a stale map node")
4124+ require.Zero(t, w.Body.Len())
4125+ lm.w = httptest.NewRecorder()
4126+
4127+ // A non-key patch about the legacy peer reaches the registered node's
4128+ // stream; a patch about a node in neither set still closes it.
4129+ w = httptest.NewRecorder()
4130+ m := &mapSession{h: h, ctx: context.Background(), req: tailcfg.MapRequest{NodeKey: n.NodeKey}, node: &n, w: w}
4131+ online := true
4132+ require.NoError(t, m.writeTKAMap(&tailcfg.MapResponse{
4133+ Node: &tailcfg.Node{ID: n.ID.NodeID(), Key: n.NodeKey},
4134+ PeersChangedPatch: []*tailcfg.PeerChange{{NodeID: legacy.ID.NodeID(), Online: &online}},
4135+ }), "patch about a legacy peer is published during the adoption window")
4136+ require.Error(t, m.writeTKAMap(&tailcfg.MapResponse{
4137+ Node: &tailcfg.Node{ID: n.ID.NodeID(), Key: n.NodeKey},
4138+ PeersChangedPatch: []*tailcfg.PeerChange{{NodeID: legacy.ID.NodeID() + 1000, Online: &online}},
4139+ }), "patch about an unknown node is still refused")
4140+
4141+ // init/begin and init/finish are refused while any node lacks an NLKey.
4142+ ns := &noiseServer{headscale: h, machineKey: n.MachineKey}
4143+ body := []byte(fmt.Sprintf("{\"NodeKey\": %q}", n.NodeKey.String()))
4144+ for _, route := range []byte{1, 2} {
4145+ f.mu.Lock()
4146+ f.lastHeader = [20]byte{}
4147+ f.mu.Unlock()
4148+ w = httptest.NewRecorder()
4149+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), route)
4150+ require.Equal(t, http.StatusConflict, w.Code, "route %d", route)
4151+ require.Contains(t, w.Body.String(), "1 node(s) have no tailnet-lock key yet")
4152+ f.mu.Lock()
4153+ require.Zero(t, f.lastHeader[4], "refused init never reaches the daemon")
4154+ f.mu.Unlock()
4155+ }
4156+
4157+ // A non-owner learns nothing from the 409 check; the daemon refuses it.
4158+ h.tkad.owner++
4159+ w = httptest.NewRecorder()
4160+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
4161+ require.Equal(t, http.StatusForbidden, w.Code)
4162+ require.NotContains(t, w.Body.String(), "node(s)")
4163+ h.tkad.owner--
4164+
4165+ // Once the authority exists, a node without an NLKey still fails closed.
4166+ f.mu.Lock()
4167+ f.snapshot.TKAInfo = &tailcfg.TKAInfo{Head: "head"}
4168+ f.mu.Unlock()
4169+ h.state.TKAMu.Lock()
4170+ _, _, err = h.tkad.reconcile(context.Background())
4171+ h.state.TKAMu.Unlock()
4172+ require.ErrorContains(t, err, "lacks authenticated NLKey")
4173+ w = httptest.NewRecorder()
4174+ require.Error(t, lm.writeTKAMap(&tailcfg.MapResponse{Node: &tailcfg.Node{ID: legacy.ID.NodeID(), Key: legacy.NodeKey}}),
4175+ "no map is published, signed or unsigned, once the authority exists")
4176+ require.Zero(t, w.Body.Len())
4177+
4178+ // After it re-registers with an NLKey, init is no longer refused.
4179+ f.mu.Lock()
4180+ f.snapshot.TKAInfo = nil
4181+ f.mu.Unlock()
4182+ legacy.TKAKey = key.NewNLPrivate().Public()
4183+ require.NoError(t, h.state.DB().DB.Save(legacy).Error)
4184+ h.state.PutNodeInStoreForTest(*legacy)
4185+ w = httptest.NewRecorder()
4186+ ns.tkaRPC(w, httptest.NewRequest(http.MethodGet, "/", bytes.NewReader(body)), 1)
4187+ require.Equal(t, http.StatusOK, w.Code)
4188+}
4189diff --git a/hscontrol/types/config.go b/hscontrol/types/config.go
4190index b02c161..e69b6a4 100644
4191--- a/hscontrol/types/config.go
4192+++ b/hscontrol/types/config.go
4193@@ -237,7 +237,7 @@ type OIDCConfig struct {
4194 type DERPConfig struct {
4195 ServerEnabled bool
4196 AutomaticallyAddEmbeddedDerpRegion bool
4197- ServerRegionID int
4198+ ServerRegionID tailcfg.DERPRegionID
4199 ServerRegionCode string
4200 ServerRegionName string
4201 ServerPrivateKeyPath string
4202@@ -726,7 +726,7 @@ func tlsConfig() TLSConfig {
4203
4204 func derpConfig() DERPConfig {
4205 serverEnabled := viper.GetBool("derp.server.enabled")
4206- serverRegionID := viper.GetInt("derp.server.region_id")
4207+ serverRegionID := viper.GetInt64("derp.server.region_id")
4208 serverRegionCode := viper.GetString("derp.server.region_code")
4209 serverRegionName := viper.GetString("derp.server.region_name")
4210 serverVerifyClients := viper.GetBool("derp.server.verify_clients")
4211@@ -775,7 +775,7 @@ func derpConfig() DERPConfig {
4212
4213 return DERPConfig{
4214 ServerEnabled: serverEnabled,
4215- ServerRegionID: serverRegionID,
4216+ ServerRegionID: tailcfg.DERPRegionID(serverRegionID),
4217 ServerRegionCode: serverRegionCode,
4218 ServerRegionName: serverRegionName,
4219 ServerVerifyClients: serverVerifyClients,
4220diff --git a/hscontrol/types/node.go b/hscontrol/types/node.go
4221index 4d65e4b..b47a511 100644
4222--- a/hscontrol/types/node.go
4223+++ b/hscontrol/types/node.go
4224@@ -121,6 +121,11 @@ type Node struct {
4225 NodeKey key.NodePublic `gorm:"serializer:text"`
4226 DiscoKey key.DiscoPublic `gorm:"serializer:text"`
4227
4228+ // TKAKey is authenticated registration metadata, not a trusted authority key.
4229+ // TKASignature is a durable forwarding outbox, never a map-ready signature.
4230+ TKAKey key.NLPublic `gorm:"serializer:text"`
4231+ TKASignature []byte
4232+
4233 Endpoints AddrPorts `gorm:"serializer:json"`
4234
4235 Hostinfo *tailcfg.Hostinfo `gorm:"column:host_info;serializer:json"`
4236@@ -1296,7 +1301,7 @@ func (nv NodeView) TailNode(
4237 return nil, err
4238 }
4239
4240- var derp int
4241+ var derp tailcfg.DERPRegionID
4242 if nv.Hostinfo().Valid() && nv.Hostinfo().NetInfo().Valid() {
4243 derp = nv.Hostinfo().NetInfo().PreferredDERP()
4244 }
4245diff --git a/hscontrol/types/registration.go b/hscontrol/types/registration.go
4246index 669114d..839620f 100644
4247--- a/hscontrol/types/registration.go
4248+++ b/hscontrol/types/registration.go
4249@@ -25,7 +25,9 @@ type RegistrationData struct {
4250
4251 // NodeKey is the cryptographic identity of the node session.
4252 // Required.
4253- NodeKey key.NodePublic
4254+ NodeKey key.NodePublic
4255+ TKAKey key.NLPublic
4256+ TKASignature []byte
4257
4258 // DiscoKey is the disco public key for peer-to-peer connections.
4259 DiscoKey key.DiscoPublic
4260diff --git a/hscontrol/types/tka.go b/hscontrol/types/tka.go
4261new file mode 100644
4262index 0000000..5eda25e
4263--- /dev/null
4264+++ b/hscontrol/types/tka.go
4265@@ -0,0 +1,9 @@
4266+package types
4267+
4268+// OmnetCheckpoint prevents a restarted adapter from silently accepting an older
4269+// or empty daemon snapshot. Headscale and tkad must be backed up as one pair.
4270+// This is an observed transport revision, not replicated authority state.
4271+type OmnetCheckpoint struct {
4272+ ID uint `gorm:"primary_key"`
4273+ Revision uint64
4274+}
4275diff --git a/hscontrol/types/types_clone.go b/hscontrol/types/types_clone.go
4276index 315cabf..6696770 100644
4277--- a/hscontrol/types/types_clone.go
4278+++ b/hscontrol/types/types_clone.go
4279@@ -45,6 +45,7 @@ func (src *Node) Clone() *Node {
4280 }
4281 dst := new(Node)
4282 *dst = *src
4283+ dst.TKASignature = append(src.TKASignature[:0:0], src.TKASignature...)
4284 dst.Endpoints = append(src.Endpoints[:0:0], src.Endpoints...)
4285 dst.Hostinfo = src.Hostinfo.Clone()
4286 if dst.IPv4 != nil {
4287@@ -86,6 +87,8 @@ var _NodeCloneNeedsRegeneration = Node(struct {
4288 MachineKey key.MachinePublic
4289 NodeKey key.NodePublic
4290 DiscoKey key.DiscoPublic
4291+ TKAKey key.NLPublic
4292+ TKASignature []byte
4293 Endpoints AddrPorts
4294 Hostinfo *tailcfg.Hostinfo
4295 IPv4 *netip.Addr
4296diff --git a/hscontrol/types/types_view.go b/hscontrol/types/types_view.go
4297index 35fffee..9e8c6a4 100644
4298--- a/hscontrol/types/types_view.go
4299+++ b/hscontrol/types/types_view.go
4300@@ -193,10 +193,15 @@ func (v *NodeView) UnmarshalJSONFrom(dec *jsontext.Decoder) error {
4301 return nil
4302 }
4303
4304-func (v NodeView) ID() NodeID { return v.ж.ID }
4305-func (v NodeView) MachineKey() key.MachinePublic { return v.ж.MachineKey }
4306-func (v NodeView) NodeKey() key.NodePublic { return v.ж.NodeKey }
4307-func (v NodeView) DiscoKey() key.DiscoPublic { return v.ж.DiscoKey }
4308+func (v NodeView) ID() NodeID { return v.ж.ID }
4309+func (v NodeView) MachineKey() key.MachinePublic { return v.ж.MachineKey }
4310+func (v NodeView) NodeKey() key.NodePublic { return v.ж.NodeKey }
4311+func (v NodeView) DiscoKey() key.DiscoPublic { return v.ж.DiscoKey }
4312+
4313+// TKAKey is authenticated registration metadata, not a trusted authority key.
4314+// TKASignature is a durable forwarding outbox, never a map-ready signature.
4315+func (v NodeView) TKAKey() key.NLPublic { return v.ж.TKAKey }
4316+func (v NodeView) TKASignature() views.ByteSlice[[]byte] { return views.ByteSliceOf(v.ж.TKASignature) }
4317 func (v NodeView) Endpoints() views.Slice[netip.AddrPort] { return views.SliceOf(v.ж.Endpoints) }
4318 func (v NodeView) Hostinfo() tailcfg.HostinfoView { return v.ж.Hostinfo.View() }
4319 func (v NodeView) IPv4() views.ValuePointer[netip.Addr] { return views.ValuePointerOf(v.ж.IPv4) }
4320@@ -287,6 +292,8 @@ var _NodeViewNeedsRegeneration = Node(struct {
4321 MachineKey key.MachinePublic
4322 NodeKey key.NodePublic
4323 DiscoKey key.DiscoPublic
4324+ TKAKey key.NLPublic
4325+ TKASignature []byte
4326 Endpoints AddrPorts
4327 Hostinfo *tailcfg.Hostinfo
4328 IPv4 *netip.Addr
4329diff --git a/hscontrol/util/zlog/hostinfo.go b/hscontrol/util/zlog/hostinfo.go
4330index c8d74db..9342b65 100644
4331--- a/hscontrol/util/zlog/hostinfo.go
4332+++ b/hscontrol/util/zlog/hostinfo.go
4333@@ -48,7 +48,7 @@ func (s SafeHostinfo) MarshalZerologObject(e *zerolog.Event) {
4334 }
4335
4336 if s.hi.NetInfo != nil && s.hi.NetInfo.PreferredDERP != 0 {
4337- e.Int(zf.DERP, s.hi.NetInfo.PreferredDERP)
4338+ e.Int64(zf.DERP, s.hi.NetInfo.PreferredDERP.Int64())
4339 }
4340
4341 // SECURITY: The following fields are intentionally NOT logged:
4342diff --git a/integration/derp_verify_endpoint_test.go b/integration/derp_verify_endpoint_test.go
4343index 8581891..4ed9333 100644
4344--- a/integration/derp_verify_endpoint_test.go
4345+++ b/integration/derp_verify_endpoint_test.go
4346@@ -67,7 +67,7 @@ func TestDERPVerifyEndpoint(t *testing.T) {
4347 },
4348 }
4349 derpMap := tailcfg.DERPMap{
4350- Regions: map[int]*tailcfg.DERPRegion{
4351+ Regions: map[tailcfg.DERPRegionID]*tailcfg.DERPRegion{
4352 900: &derpRegion,
4353 },
4354 }