-
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
home-manager: create a prototype module for user secret decryption #58
Conversation
This is also a problem with the existing |
Indeed, maybe, the solution could be shared and provide a flag to help reuse passwords if this is wanted at all. |
Is there any use-case for changing the owner of a file to someone other than At the very least, I do not see any point in separating the secrets according to which is root-owned or not. This is only relevant in the NixOS case where one needs users to actually exist on the system before trying to |
Really, I don't know, but I know I do not have this usecase indeed.
+1 |
@ryantm @RaitoBezarius what is needed to merge this PR? I assume we need to address:
|
I can do those in the next minutes easily. (EDIT: done.)
I would prefer to let someone else do it, and I do not think this is a critical feature for this PR.
Indeed. What is left is:
For now, I have moved to a system home-manager, so I disabled my version of this module, I will get back to it soon to rework it a bit, notably to address the last two points. |
This is also a problem for the NixOS module, I think it is out of scope for this PR |
Sure. |
Hey, quick question: What is the state of this PR? I'd love to see support for home-manager for agenix. :) |
That's a prototype which worked more or less fine for me, except the painful process where you retype all your passwords when you're iterating on your own configuration, quite quickly. So I'd be looking for something that's able to reuse passwords, for this, I'd look for the plugin API of (r)age to add some kernel keyring support and reuse it here. |
Is it possible to get this merged, and improve it later @RaitoBezarius @ryantm? I feel like the password-reuse issue is cross-cutting (it's useful for re-keying secrets, etc...) but not quite solvable at the moment. However having this module merged avoids having to copy-paste it and keep up with potential updates in the future. |
@ambroisie Ryan tagged it as a merge conflict so I assume that we are only a rebase away from this to get merged 😄 |
@ratsclub 😄, probably not! I looked into the whole home-manager situation with @Kranzes kind of recently and it seems like some home-manager work needs to happen. One problem I remember is that home-manager doesn't run its activation scripts when a user logs in, so I'm pretty sure the way this PR defaults to decrypting the secrets to a temp directory (/run) isn't going to be very user friendly. |
From my testing it does run activation script on login, the issue is that /run/users/$UID does not yet get created by the time it needs to to decrypt the keys there. |
Can we just |
I use home-manager standalone (not incorporated as a NixOS module) and I added {
home.activation.test = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD touch ~/test-home-manager.txt
'';
} which created the file when I ran |
Hmm so I guess it only works as a nixos module. Maybe there's a way to add that functionality to standalone home-manager. We will have to ask @rycee for that. |
Instead of using It still wouldn't work on MacOS, but at least it would work on stand-alone home-manager on Linux. |
FWIW, I put the PR into a draft as it has too much diverged from a WIP which could be used, feel free to close it / re-open a new one on the top of it (or if anyone wants commit bits, no problem) :). To be honest, user secret decryption is useful for me only if we do solve the issue of multiple passphrases, as I have a lot of synchronized machines and typing 5+ passphrases is annoying to rebuild. So I will only revisit this once (r)age gets agent support which I'm looking in. |
This is to update and fix the issues I saw in [1] and [2]. Using a service definition instead of an activation script should resolve the issue about the secrets disappearing after rebooting. Removed the `user` and `group` option as they do not make sense to me for a home-manager module, which should target a single user. They can always be added back if somebody comes screaming. This is somewhat modeled after sops-nix's own module [3]. [1]: ryantm#58 [2]: ryantm#109 [3]: https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
This is a prototype module for user decryption with home-manager.
Some stuff might not be absolutely in line with the quality standards of the project, e.g.
[]
and let rage find out the proper key?)cc #50
I can confirm this code provides me with HM-integration of agenix, as seen on https://github.com/RaitoBezarius/nixos-home