I’ve been using /dev/zero to provide 0x00 as the keyfile for luks. I saw it in a blog post somewhere and thought it was clever. Well here we are today with a breaking 26.05 update - d’oh. What is the most painless way to handle this? I have about 20 or so machines I’ll need to update (via colmena / flake setup). Some over remote ssh and most production.
Currently this is in my config:
Though, frankly, I would probably recommend just not using /dev/zero, since you can just give the LUKS device an empty passphrase instead of a null byte passphrase and then just enable boot.initrd.luks.devices.<name>.tryEmptyPassphrase (which is just the try-empty-password option from crypttab).
I thought it was clever because you could remove the key and have data be inaccessible but it didn’t rely on any outside input. It seemed smart at the time but it turns out to not be ha. It got baked into my default boot and nuke installer config and didn’t think about it again until today.
I’m not sure I get it: to make the data inaccessible you can just remove all key slots, or even simplier, overwrite the LUKS header with something like dd if=/dev/zero of=/dev/sda bs=10M count=1.
Why should the actual value of the key/passphrase matter? An empty passphrase just means anyone can unlock the disk (if the header is still in place).
No, I don’t think it’s a bad idea. The idea is just that a null passphrase doesn’t buy you any security right now, but as long as you’re confident you haven’t leaked the header, it can turn the whole disk into a securely encrypted one later with just a change to the header. That’s useful if you either change your mind about your FS being encrypted later, or if you just want to wipe all the information on the drive without literally wiping the whole thing (just wipe the header). Apple actually does this: FileVault is never really disabled on new Macs; it’s just using a builtin hardware key with no protection, and it changes the key to a hardware+password based one when you enable FileVault rather than having to reencrypt the whole drive. For NixOS this would be more akin to having a TPM2-encrypted slot that isn’t bound to any meaningful security policy, but frankly this is effectively equivalent to just a null passphrase. The only threat model additionally protected against with a policy-less TPM2 slot is one where the drive is separated from the system / TPM2.
As an alternative to the udev rule, you can create a new keyfile with echo -en “\x00” > keyfile, add this to some place visible from stage 1 and replace /dev/zero with the path to this file.