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
nixos/luksroot: Add option to save passphrases. #64374
base: master
Are you sure you want to change the base?
Conversation
I thought #29441 did this already, or am I misunderstanding what this patch does? |
That one temporarily saves the passphrase and automatically tries to reuse it for the next LUKS device opened from the initrd. That allows opening multiple LUKS devices in the initrd while typing only one passphrase. What I need is to open just one device in the initrd (where the root filesystem is), and open another device automatically during the systemd boot. That other device does not need to be opened in the initrd; configuring it to be opened in the initrd would prevent me from booting if the device does not work, would also increase the boot time a little (since it is not done in parallel). This patch makes it possible for the initrd to save the passphrase so that it can be used later (after the initrd is done) to open another device. To do that I added a systemd service like this:
|
another option would be to have a regular keyfile on the encrypted rootfs, and then always use that to open the 2nd luks device |
This is true but I'm not fond of keeping encryption keys on the disk and it's also manual work. |
Thank you for your contributions.
|
I know this is stale, but I find myself with a bit of time to try and work through the oldest, non-conflicting issues. For clarity, why can't you mount this in the initrd phase? Won't putting the key in Is it just another way of doing things that doesn't require a benefit? / What's the benefit? |
Motivation for this change
I needed that another LUKS device gets unlocked automatically using the same passphrase that was used to unlock the LUKS device containing the root file system. This adds an option to the initrd which if enabled will save passphrases to
/run/initrd-saved-passphrases
so that they can be used after the initrd to unlock other devices.Maybe using
/run/keys
(which is already a thing and gets mounted automatically, but not in the initrd) would be more appropriate? Not sure where would be the right place to put the code for doing that, and if it could somehow conflict with the fstab entry.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)