Skip to content

add optional clevis-based unlock support in initrd#55

Merged
legionus merged 2 commits intoosboot:masterfrom
romenskiy2012:master
Mar 30, 2026
Merged

add optional clevis-based unlock support in initrd#55
legionus merged 2 commits intoosboot:masterfrom
romenskiy2012:master

Conversation

@romenskiy2012
Copy link
Copy Markdown
Contributor

This PR adds optional clevis support for TPM2-backed LUKS unlock in initrd.

The series introduces a clevis feature and updates the luks handler to try
clevis unlock before falling back to the existing interactive password prompt.

If clevis is not present or unlock fails, the current behavior is preserved.

@legionus
Copy link
Copy Markdown
Collaborator

legionus commented Mar 28, 2026

@romenskiy2012 Please, add features/clevis/README.md file describing the feature and how to use it, and include a link to the clevis project.

Upstream is https://github.com/latchset/clevis ?

@romenskiy2012
Copy link
Copy Markdown
Contributor Author

Yes of course.

@legionus
Copy link
Copy Markdown
Collaborator

@romenskiy2012 Why do I need to add /usr/lib64/libtss2-tcti-device.so.0 separately?
Doesn't anyone link to this library?

This code is very sensitive. If the soname changes, it will simply stop working. Libraries are usually copied via binary dependencies or through PUT_FEATURE_LIBS because they may not necessarily be located in /usr/lib64.

@romenskiy2012
Copy link
Copy Markdown
Contributor Author

I completely agree with you, I suggest such a less fragile option.

@legionus
Copy link
Copy Markdown
Collaborator

@romenskiy2012 Again, why not PUT_FEATURE_LIBS or PUT_FEATURE_OPTIONAL_LIBS ?

Something like that (not tested!):

PUT_FEATURE_LIBS += libtss2-tcti-device.so.0

Your manual path traversal will not work on ubuntu.

$ grep ^ID= /etc/os-release 
ID=ubuntu

$ ls -lad /usr/lib/x86_64-linux-gnu /usr/lib64/ld-linux-x86-64.so.2 
drwxr-xr-x 8 root root 4096 Jan 13 02:11 /usr/lib/x86_64-linux-gnu
lrwxrwxrwx 1 root root   44 Sep 17  2025 /usr/lib64/ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2

Add a new clevis feature that installs the tools and files
required for TPM2-backed LUKS unlock in initrd.

The feature is optional and is enabled explicitly through
FEATURES.

Signed-off-by: Arseniy Romenskiy <romenskiy@altlinux.org>
When no keyfile is available and the volume is not activated,
try clevis-based unlock before falling back to interactive
passphrase entry.

If clevis is unavailable or unlock fails, keep the existing
password prompt logic unchanged.

Signed-off-by: Arseniy Romenskiy <romenskiy@altlinux.org>
@romenskiy2012
Copy link
Copy Markdown
Contributor Author

Thanks for PUT_FEATURE_LIBS
I couldn't find it in the documentation.
I've checked and it works fine.

@legionus
Copy link
Copy Markdown
Collaborator

@romenskiy2012 Thanks! Everything looks good now.

But for the record, PUT_FEATURE_LIBS is documented here:

https://github.com/osboot/make-initrd/wiki/NewFeature#rulesmk

and in the Documentation/NewFeature.md

@legionus legionus merged commit 6ed5d80 into osboot:master Mar 30, 2026
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