vars: fix using vars module with multiple machines #1891

Merged
kenji merged 1 commits from kenji/clan-core:fix-vars-multiple-machines into main 2024-08-17 14:00:57 +00:00
Owner

This filters the secrets to only include the secrets managed under per-machine and shared,
otherwise new deployments will fail, when using the vars module for multiple machines:

[vyr] /nix/store/[…]sops-install-secrets: failed to decrypt '/nix/store/[…]/sops/vars/per-machine/draper/garage/admin_token/secret': Error getting data key: 0 successful groups required, got 0

This doesn't fix all the edge cases with this approach.
We get a similar error if we deploy shared vars that are not
encrypted for our machine key. This needs to be addressed when
implementing the shared vars functionality.

Fixes #1892

This filters the secrets to only include the secrets managed under `per-machine` and `shared`, otherwise new deployments will fail, when using the vars module for multiple machines: ``` [vyr] /nix/store/[…]sops-install-secrets: failed to decrypt '/nix/store/[…]/sops/vars/per-machine/draper/garage/admin_token/secret': Error getting data key: 0 successful groups required, got 0 ``` This doesn't fix all the edge cases with this approach. We get a similar error if we deploy shared vars that are not encrypted for our machine key. This needs to be addressed when implementing the shared vars functionality. Fixes #1892
kenji added the
needs-review
label 2024-08-14 21:15:16 +00:00
DavHau was assigned by kenji 2024-08-14 21:15:16 +00:00
kenji added 1 commit 2024-08-14 21:15:16 +00:00
vars: fix using vars module with multiple machines
All checks were successful
buildbot/nix-build .#checks.x86_64-linux.package-clan-cli Build done.
buildbot/nix-build .#checks.x86_64-linux.package-inventory-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.package-moonlight-sunshine-accept Build done.
buildbot/nix-build .#checks.x86_64-linux.package-pending-reviews Build done.
buildbot/nix-build .#checks.x86_64-linux.package-tea-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-webview-ui Build done.
buildbot/nix-build .#checks.x86_64-linux.package-yagna Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotier-members Build done.
buildbot/nix-build .#checks.x86_64-linux.package-merge-after-ci Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotierone Build done.
buildbot/nix-build .#checks.x86_64-linux.package-inventory-schema-pretty Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.renderClanOptions Build done.
buildbot/nix-build .#checks.x86_64-linux.mumble Build done.
buildbot/nix-build .#checks.x86_64-linux.postgresql Build done.
buildbot/nix-build .#checks.x86_64-linux.package-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-deploy-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-function-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.secrets Build done.
buildbot/nix-build .#checks.x86_64-linux.template-minimal Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.test-backups Build done.
buildbot/nix-build .#checks.x86_64-linux.zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.syncthing Build done.
buildbot/nix-build .#checks.x86_64-linux.wayland-proxy-virtwl Build done.
buildbot/nix-build .#checks.x86_64-linux.test-installation Build done.
buildbot/nix-eval Build done.
a6d797cdc6
This filters the secrets to only include the secrets managed under `per-machine` and `shared`,
otherwise new deployments will fail, when using the vars module for multiple machines:

```
[vyr] /nix/store/[…]sops-install-secrets: failed to decrypt '/nix/store/[…]/sops/vars/per-machine/draper/garage/admin_token/secret': Error getting data key: 0 successful groups required, got 0
```

This doesn't fix all the edge cases with this approach.
We get a similar error if we deploy shared vars that are not
encrypted for our machine key. This needs to be addressed when
implementing the shared vars functionality.
kenji requested review from DavHau 2024-08-14 21:15:21 +00:00
kenji reviewed 2024-08-14 21:17:45 +00:00
@ -17,0 +18,4 @@
vars:
builtins.elem vars.machine [
config.clan.core.machineName
"shared"
Author
Owner

Not sure, if this is correct.
Are the shared variables also encrypted under shared/machine?
Should I remove this for now?

Not sure, if this is correct. Are the shared variables also encrypted under `shared/machine`? Should I remove this for now?
kenji merged commit d0d95d0189 into main 2024-08-17 14:00:57 +00:00
kenji deleted branch fix-vars-multiple-machines 2024-08-17 14:00:57 +00:00
DavHau removed the
needs-review
label 2024-08-21 12:30:25 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: clan/clan-core#1891
No description provided.