cmd/tailscaled,ipn/{ipnlocal,store/kubestore}: don't create attestation keys for stores that are not bound to a node (#18322)

Ensure that hardware attestation keys are not added to tailscaled
state stores that are Kubernetes Secrets or AWS SSM as those Tailscale
devices should be able to be recreated on different nodes, for example,
when moving Pods between nodes.

Updates tailscale/tailscale#18302

Signed-off-by: Irbe Krumina <irbekrm@gmail.com>
This commit is contained in:
Irbe Krumina
2026-01-06 12:29:46 +01:00
committed by GitHub
parent 68617bb82e
commit 8ea90ba80d
4 changed files with 251 additions and 15 deletions
+53
View File
@@ -88,3 +88,56 @@ func TestStateStoreError(t *testing.T) {
}
})
}
func TestIsPortableStore(t *testing.T) {
tests := []struct {
name string
path string
want bool
}{
{
name: "kube_store",
path: "kube:my-secret",
want: true,
},
{
name: "aws_arn_store",
path: "arn:aws:ssm:us-east-1:123456789012:parameter/tailscale/state",
want: true,
},
{
name: "tpm_store",
path: "tpmseal:/var/lib/tailscale/tailscaled.state",
want: false,
},
{
name: "local_file_store",
path: "/var/lib/tailscale/tailscaled.state",
want: false,
},
{
name: "empty_path",
path: "",
want: false,
},
{
name: "mem_store",
path: "mem:",
want: true,
},
{
name: "windows_file_store",
path: `C:\ProgramData\Tailscale\server-state.conf`,
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := isPortableStore(tt.path)
if got != tt.want {
t.Errorf("isPortableStore(%q) = %v, want %v", tt.path, got, tt.want)
}
})
}
}