Skip to content

Add Windows Secure Boot key upgrade tests #277

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

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

Conversation

dinhngtu
Copy link
Member

As we're including more Secure Boot keys by default in varstored, add tests for upgrading guest keys from the old defaults to the new ones, using certificates provided by microsoft/secureboot_objects. Additionally, disable tests that aren't applicable any more with the variable changes.

Since the new SB variables each include multiple certificates, refactor the Certificate and EFIAuth classes to support them.

Finally, add some tweaks for running tests with VM UUIDs.

Copy link
Contributor

@ydirson ydirson left a comment

Choose a reason for hiding this comment

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

I have very mixed feelings about this large "Rework Certificate and EFIAuth" commit. There seem to be many things inside (type hints additions, API changes, API extension....). This is already a part of the tests (and a feature set) I suspect few of us are familiar with. We surely want to improve on the situation. As it is, I cannot really give an opinion on this and that disturbs me.

@dinhngtu
Copy link
Member Author

dinhngtu commented Apr 1, 2025

I have very mixed feelings about this large "Rework Certificate and EFIAuth" commit. There seem to be many things inside (type hints additions, API changes, API extension....). This is already a part of the tests (and a feature set) I suspect few of us are familiar with. We surely want to improve on the situation. As it is, I cannot really give an opinion on this and that disturbs me.

The main goal of the efi.py changes is to support multi-cert variables, where one is an owner cert (i.e. contains a private key) and the others (e.g. MS-distributed ones) are not.

@dinhngtu dinhngtu force-pushed the sb-windows branch 2 times, most recently from 94d620d to b898476 Compare April 1, 2025 15:03
@dinhngtu
Copy link
Member Author

dinhngtu commented Apr 1, 2025

I've tried to break up the refactor into several commits.

@dinhngtu dinhngtu force-pushed the sb-windows branch 3 times, most recently from 51b1db6 to 887b5ce Compare April 4, 2025 08:15
Since UEFI vars can contain multiple certs (and even non-certs), rename
the method to is_uefi_var_present.

Signed-off-by: Tu Dinh <[email protected]>
We don't want users to grab these variables directly from EFIAuth before
they're ever generated by sign_auth.

Protect these two variables with an assertion.

Signed-off-by: Tu Dinh <[email protected]>
We want to remove the generated temporary directory even if the auth
file installation fails.

Signed-off-by: Tu Dinh <[email protected]>
Since EFIAuth depends on Certificate, reorder them to prevent typecheck
issues later.

Signed-off-by: Tu Dinh <[email protected]>
Separate a variable's owner key and non-owner certs.
This allows creating Secure Boot variables with multiple certificates.
Also make self-signed cert/key initialization explicit.

Signed-off-by: Tu Dinh <[email protected]>
We're now shipping more Secure Boot variables with varstored.
As such, the following tests have changed:

- test_start_vm_without_uefi_vars_on_pool_with_only_pk: No longer
  applicable.
- test_clear_custom_pool_certificates: Only check for symlink when
  clearing certs, as the condition that hosts only have PK after
  `secureboot-certs clear` is no longer true.

Signed-off-by: Tu Dinh <[email protected]>
@stormi
Copy link
Member

stormi commented Apr 10, 2025

The PR looks good to me. We'll have to run the related jobs in Jenkins to make sure all is still good, and this also depends on having varstored with the certs available in the ci RPM repository (PR xcp-ng-rpms/varstored#5)

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.

3 participants