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

Handle TPM2 + passphrase #198

Open
codicodi opened this issue Dec 6, 2022 · 5 comments
Open

Handle TPM2 + passphrase #198

codicodi opened this issue Dec 6, 2022 · 5 comments

Comments

@codicodi
Copy link
Contributor

codicodi commented Dec 6, 2022

A while ago systemd got support for TPM2 + passphrase setup:
systemd/systemd#22563

It would be nice if booster supported unlocking such volumes as well

anatol added a commit that referenced this issue Dec 12, 2022
Counterpart implementation of
systemd/systemd#22563

Implements #198
@anatol
Copy link
Owner

anatol commented Dec 14, 2022

I added booster boilerplate to handle PIN. Now I need to use the pincode to unseal the value.

I am looking for help from someone who understands the tpm2-tss API and can translate the systemd's change into go-tpm equivalent. See booster's tpm2Unseal() function and its new parameter password that is sha256 hashed content on PIN.

@anatol anatol added the help wanted Extra attention is needed label Dec 14, 2022
anatol added a commit that referenced this issue Dec 14, 2022
Counterpart implementation of
systemd/systemd#22563

Implements #198
@anatol anatol removed the help wanted Extra attention is needed label Dec 14, 2022
@anatol
Copy link
Owner

anatol commented Dec 14, 2022

Alright, I think I figured out the logic. I improved booster code and the test shows it is able to unlock a drive locked with systems tpm+pin.

Please pull the changes from wip branch and test it with your setup.

@codicodi
Copy link
Contributor Author

Thanks for looking into this.
Unlocking does indeed work, but the whole procedure appears a bit messy.
First, booster asks for a passphrase which I guess refers to a recovery key also enrolled on this drive. I entered it incorrectly and booster asked for a PIN next. I entered the PIN (correctly) and booster once again showed the passphrase prompt, but the system booted after a short while anyway without me entering anything.

Interestingly the log complains about no tpm devices being found just before obtaining password for the tpm2 token

20221214_222225
booster.log

@anatol
Copy link
Owner

anatol commented Dec 16, 2022

Booster tries to unlock all possible LUKS slots in parallel. Such an algorithm would work well if slots are non-interactive (non-PIN tpm, clevis, ...). The first valid slot unlocks the partition, and other slots processors get canceled.

In your case, you have 2 interactive slots that require some sort of pin/password. So the prompts you see are interleaved.

My guess you expected to see only 1 interactive slot processed at a time. But which one should be processed/prompted first? And why?

@codicodi
Copy link
Contributor Author

A TPM2 PIN is supposed to be safe, yet convenient (lowish entropy; easy to type). If a user went to trouble of enrolling it, it's probably the preferable way of unlocking.
Regular passphrases (including recovery key) could be tried next. Correct me if I'm wrong, but I think the order no longer matters since booster can just keep asking until given passphrase matches one of the slots.

anatol added a commit that referenced this issue Dec 22, 2022
Counterpart implementation of
systemd/systemd#22563

Implements #198
anatol added a commit that referenced this issue Dec 24, 2022
Counterpart implementation of
systemd/systemd#22563

Implements #198
anatol added a commit that referenced this issue Feb 28, 2023
Counterpart implementation of
systemd/systemd#22563

Implements #198
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

2 participants