-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agenix symlinks incorrectly when using agenix secrets as initrd secrets #193
Comments
There might be a good solution for this problem:
Unfortunately this doesn't work because agenix sets up secrets during system activation stage but initrd is being built before that:
Maybe agenix should use Currently, as a dirty workaround, I deploy two times, first with @ryantm : do you think it may be possible to set up secrets BEFORE initrd is being built?.. |
I have my secret set up the same way you have @pshirshov. However, I never needed to deploy twice. I am currently using nixos-anywhere to provision servers and things have just worked (after modifying the secren setup like you have). From a cursory glance, nixos-anywhere doesn't appear to do any double activation (especially not with different configs!) so I don't know why this would work for me and not for you, unfortunately. |
Maybe the initrd builder just reuses the file which persists between builds? Obviously, if the hostkey persists between builds and reboots, you have to deploy twice only the first time and when the key changes. That's acceptable but impure and fragile. |
When it fails, the log looks like
I'm using |
I have encountered that error as well. However that was only when I set up the key that agenix uses for decryption incorrectly. Ever since I fixed that error things have been working fine. nixos-anywhere builds the system closure and then simply calls into nixos-install with the provided closure. |
I'm currently attempting to setup a new server with NixOS. As part of my config, I have the following:
This results in the following scenario: secrets now exist at
/run/agenix/$generation/secret
rather than/run/agenix/secret
. I assume this is because the way initrd secrets are handled causes/run/agenix/initrd_host_ed25519_key
to be created before agenix runs. Thus, when the symlink is created at age.nix Line 105, it is not created at${cfg.secretsDir}
, but rather inside that folder since it already exists.I have worked around this problem by specifying a path outside
/run/agenix
for my hostkey only, but I believe it may be desirable to also include aif [ -L ${cfg.secretsDir} ]; then rm -rf ${cfg.secretsDir}; fi
or similar instead of relying only onln -f
.The text was updated successfully, but these errors were encountered: