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

Test for valid LUKS device #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

metalsp0rk
Copy link

As is, the luks enroll and luks-open script ask for passwords before determining if the device is even valid. cryptsetup provides a method for testing if a partition is valid LUKS. This patch adds that functionality to the yubikey-luks-open and yubikey-luks-enroll scripts.

@Vincent43
Copy link
Contributor

Among other things which can be checked are: existence of luks device, valid yubikey slot, etc.

@metalsp0rk
Copy link
Author

metalsp0rk commented Nov 30, 2021

As is, this patch will return 1 for an existing device with no luks header and 4 on a non-existing device. I suppose I could flesh out the check to differentiate between those checks.

Regarding yubikey slot, are you talking about a simple bounds check? My understanding is that checking yubikey configuration can only say if the slot is configured or not.

I'm happy to flesh this PR out as much as possible.


One other thing I've considered adding to this patch is an exit on invalid option. (around line 43 of yubikey-luks-enroll) As of right now, when an invalid flag is passed, the command continues to run as if everything was normal. I'm not confident that's a safe behavior, especially considering the enroll script has the ability to kill a LUKS slot.

@Vincent43
Copy link
Contributor

You may take a look how I handled various errors here.

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

Successfully merging this pull request may close these issues.

2 participants