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

Support Secure Boot in OVMF Environment #8131

Closed
la7eralus opened this issue Jan 4, 2024 · 18 comments · Fixed by #8359
Closed

Support Secure Boot in OVMF Environment #8131

la7eralus opened this issue Jan 4, 2024 · 18 comments · Fixed by #8359

Comments

@la7eralus
Copy link

la7eralus commented Jan 4, 2024

Feature Request

Support Secure Boot in OVMF Environment

Description

I'm running Talos in Proxmox (QEMU), and want to enable Secure Boot and TPM Encryption. Unfortunately the Keys cant be enrolled automatically:
image

So I tried to import the keys manually (loader/keys/auto/*.auth):
image
image

It seems like OVMF only supports Keys in der format (and not pem).

@frezbo
Copy link
Member

frezbo commented Jan 5, 2024

from the error it seems it failed to write the EFI variables, seems the firmware is passed in as readonly as opposed to read/write.

Talosctl supports generating keys in DER format talosctl gen secureboot

@la7eralus
Copy link
Author

I created the UEFI disk without pre enrolled Keys, so I think it should be in setup mode?

Are you sure, that the default keys (the one that ship with the talks secure boot iso) are in DER format?

@frezbo
Copy link
Member

frezbo commented Jan 5, 2024

Are you sure, that the default keys (the one that ship with the talks secure boot iso) are in DER format?

probably not the ones in the iso, but you can always generate your own keys

@la7eralus
Copy link
Author

la7eralus commented Jan 5, 2024

Yes, this seems doable, but it's ultimately forcing me to operate or provide a private registry for the custom built talos image. Is there a chance to provide the official secure iso with keys, that work with OVMF?

@frezbo
Copy link
Member

frezbo commented Jan 5, 2024

Yeh, i think we can fix that

@la7eralus
Copy link
Author

Awesome, thank you 😁

@la7eralus
Copy link
Author

la7eralus commented Jan 18, 2024

@frezbo This should be fixed with 1.6.2 right? -> 3576d113c

Edit: Nope, I think this fix is not related to this issue. I tested it, and got the same errors.

@frezbo
Copy link
Member

frezbo commented Jan 21, 2024

yeh, the fix was not correct, will get it fixed

@frezbo
Copy link
Member

frezbo commented Jan 21, 2024

We still need to inlcude those files in the iso, I'll take care of that

@frezbo
Copy link
Member

frezbo commented Jan 24, 2024

@5olu7ion I took a look at the issue again, from the image it seems it reported a security violation
image

I wonder if even manually enrolling would even fail with the same error 🤔 , could you confirm you can manually enroll any random key from a usb stick?

@la7eralus
Copy link
Author

la7eralus commented Jan 24, 2024

Yeah, you are right, I also stumbled over this particular message. I tried importing it manually (screenshots 2/3). There I got the DER compatibility issue. I will try importing a random Key.

Edit: I remember, that importing the db.auth worked fine

@frezbo
Copy link
Member

frezbo commented Jan 24, 2024

Edit: I remember, that importing the db.auth worked fine

did that enroll the key?

@la7eralus
Copy link
Author

la7eralus commented Jan 24, 2024

Nope, it still threw the security violation. I checked it again, and I see, that enrolling the the db.auth, also enrolls the kek.auth, but not the PK.auth. When enrolling the *.auth files in OVMF, you have to switch to custom mode, but this seems to reset to standard after an unsuccessful (security violation) boot. I set up OVMF without default keys. Maybe I'm doing something fundamentally wrong, but the fact, that OVMF complains about PEM format, and you currently don't ship DER certificates led me to create this issue.

I also opened a discussion for PEM Support in OVMF, but there is no activity ;-)
tianocore/edk2#5227

@frezbo
Copy link
Member

frezbo commented Jan 25, 2024

We'll add the der certs to the iso, do you if there's some standard path where it should exist, or will just put it under something like keys/secureboot

@la7eralus
Copy link
Author

I'm sorry, there is no hint in the whitepaper: https://www.linux-kvm.org/downloads/lersek/ovmf-whitepaper-c770f8c.txt
If you want, you can send me a prebuilt iso, and I can test it on my end.

@frezbo
Copy link
Member

frezbo commented Feb 22, 2024

@la7eralus could you test a custom iso? I can share on the talos slack

@la7eralus
Copy link
Author

la7eralus commented Feb 22, 2024

Yeah sure, I will sign up

frezbo added a commit to frezbo/talos that referenced this issue Feb 23, 2024
Add the uki signing cert into iso.

Fixes: siderolabs#8131

Signed-off-by: Noel Georgi <git@frezbo.dev>
dsseng pushed a commit to dsseng/talos that referenced this issue Mar 7, 2024
Add the uki signing cert into iso.

Fixes: siderolabs#8131

Signed-off-by: Noel Georgi <git@frezbo.dev>
@la7eralus
Copy link
Author

If someone stumbles over this issue: The signing cert is located under EFI/keys/uki-signing-cert.der in all secureboot iso's since 1.7.0.

Big shoutout to Siderolabs and especially frezbo for making this work :-)

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 a pull request may close this issue.

2 participants