-
Notifications
You must be signed in to change notification settings - Fork 6
Arch Linux LUKS configuration
So you want to have a second factor protecting your disk encryption key. Cool! I do that and it's great. It's also relatively easy to set up.
-
Backup your LUKS header. Right now. Go on, I'll wait. Seriously, this step is important.
-
Install the
khefinAUR package, or runmake release mkinitcpio && sudo make installto installkhefinand the initcpio hooks. -
Enrol your primary authenticator device:
khefin enrol -d /dev/hidraw0 -f /tmp/0-primary-authenticator. -
Enrol your secondary authenticator device:
khefin enrol -d /dev/hidraw0 -f /tmp/1-secondary-authenticator. You have a secondary device, right? -
Make backups of those files. That should be easy, given you just made a backup of your LUKS header.
-
Run
khefin-add-luks-key /tmp/0-primary-authenticator /dev/your-encrypted-disk -vand thenkhefin-add-luks-key /tmp/1-secondary-authenticator /dev/your-encrypted-disk -vto add new keyslots for your authenticator-protected files. -
Copy the files created in steps 3 and 4 to
/boot/keyfiles, or some other static location. They need to be in their own directory. I'd recommend changing their owner to root, and setting permissions to 400. -
In
/etc/mkinitcpio.conf:- add
khefintoHOOKS, noting that this must be beforeencryptand afterudev; and - optionally, set
keyfiles_source_dirto the directory containing your keyfiles (this defaults tokeyfiles_source_dir=/boot/keyfiles).
- add
-
Run
mkinitcpio -c /etc/mkinitcpio.conf -g /tmp/initcpioto make sure your initcpio was can be generated successfully. Runlsinitcpio /tmp/initcpioand make sure that your keyfiles,khefinandlibfido2are included. -
Run
sudo mkinitcpio -Pto regenerate your initcpio.
That's it!
There are a few other options you can set - see mkinitcpio -H khefin for more information.
You can optionally remove your existing keyslot, so you can't use your regular passphrase anymore. I'd recommend having at least one passphrase-only keyslot, with a very long passphrase written down somewhere. This is a good backup in case your authenticators are damaged. Definitely test your primary and backup before killing any keyslot.