Skip to content
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

How to add a backup key? #9

Open
Janik-Haag opened this issue Jul 8, 2023 · 5 comments
Open

How to add a backup key? #9

Janik-Haag opened this issue Jul 8, 2023 · 5 comments

Comments

@Janik-Haag
Copy link

Can you add a section explaining how one would add a second yubikey as a backup device?

@Janik-Haag Janik-Haag changed the title Add a backup key. How to add a backup key? Jul 8, 2023
@ElnuDev
Copy link

ElnuDev commented Sep 22, 2023

Wondering this as well. I'm taking a look at the options available under boot.initrd.luks.devices.*.yubikey and it really just seems like only a single yubikey is supported, unfortunately.

@Deep-Six
Copy link

Deep-Six commented May 3, 2024

Can you advise how to add at least a backup passphrase, for when your yubikey is lost?

@sgillespie
Copy link
Owner

Yeah, sorry, I think I can probably come up with something.

@Deep-Six
Copy link

Deep-Six commented May 3, 2024

Sorry @sgillespie I managed to find something in the official NixOS docs, this worked for me.

 # Be sure to delete luks.key afterwards
KEY_LENGTH=512
ITERATIONS=1000000
read -s k_user
challenge=$(head -n1 /boot/crypt-storage/default | tr -d '\n' | openssl dgst -binary -sha512 | rbtohex)
response="$(ykchalresp -2 -x $challenge 2>/dev/null)"
echo -n $k_user | pbkdf2-sha512 $(($KEY_LENGTH / 8)) $ITERATIONS $response > luks.key
# Now, you can pass the luks.key to any cryptsetup command. For instance,
# if you want to add another key to your setup.
cryptsetup luksAddKey /dev/nvme0n1p2 luks.key
rm luks.key

@sgillespie
Copy link
Owner

@Deep-Six That's awesome! Feel free to add that to the README somewhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants