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

Do not merge (depends on storage-ng) - Supporting LUKS2 encryption by TPM2 device (jsc#PED-10703) #713

Open
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

schubi2
Copy link
Member

@schubi2 schubi2 commented Mar 18, 2025

Problem

We would like to give the user an easy way to use TPM2 devices for LUKS2 encrypted
partitions. (jsc#PED-10703)

The user can select TPM2 support for encryption in yast-storage-ng:
yast/yast-storage-ng#1406

Solution

Enrolling TPM2 with the given password, if the user has selected it.
Proposal: Selecting yast2-bls bootloader which supports TPM2.

Testing

  • Added a new unit test
  • Tested manually

Screenshots

tpm2_3

@schubi2 schubi2 changed the title Supporting LUKS2 encryption by TPM2 device (jsc#PED-10703) Do not merge (depends on storage-ng) - Supporting LUKS2 encryption by TPM2 device (jsc#PED-10703) Mar 20, 2025
output.strip
end

# Enabe TPM2, if it is required
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo Enabe


begin
Yast::Execute.on_target!("keyctl", "padd", "user", "cryptenroll", "@u",
stdout: :capture,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why stdout is captured, when it is not used?

if entry.empty?
""
else
entry.first["title"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks strange as you basically search for first entry, so it should look like

entry = @data.find { |d| d["id"] == @default }
entry ? entry["title"] : ""

log.warn "Invalid value #{value} trying to set as default. Fallback to default"
value = ""
entry = @data.select { |d| d["title"] == value }
if entry.empty?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. The used method should not be select, but find that return first entry or nil.

@@ -155,7 +157,7 @@ def packages
res = super
res << ("grub2-" + grub2bls_architecture + "-efi-bls")
res << "sdbootutil"
res << "shim" if secure_boot
res << "shim"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change is needed? I think there are architectures where shim is no available, but as it is grub2-bls architectures are already limited, os not sure.

def check_tpm2
return true unless Y2Storage::StorageManager.instance.encryption_use_tpm2

add_new_problem(_("This bootloader cannot handle encryption supported by a TPM2 device. "))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so even our patched grub2 cannot handle tpm2 device?

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