-
Notifications
You must be signed in to change notification settings - Fork 594
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
tests: rebuild OVMF and use generated keys #14960
base: master
Are you sure you want to change the base?
tests: rebuild OVMF and use generated keys #14960
Conversation
ca6ff95
to
a01e5da
Compare
Wed Feb 5 09:06:50 UTC 2025 Failures:Preparing:
Executing:
Restoring:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #14960 +/- ##
=========================================
Coverage ? 78.22%
=========================================
Files ? 1164
Lines ? 154351
Branches ? 0
=========================================
Hits ? 120739
Misses ? 26171
Partials ? 7441
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
- nasm | ||
- acpica-tools | ||
plugin: nil | ||
source: https://github.com/tianocore/edk2.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we use ovmf and efi-shell from 24.04 instead?
a01e5da
to
8cce59c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remaining open question is whether we should have a tests which uses ovmf packages from the repo to run the VM like the docs page at https://ubuntu.com/core/docs/testing-with-qemu state. Or perhaps that's a job to be run in some other repository (core-base?)
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
@@ -0,0 +1,140 @@ | |||
name: ovmf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can name it test-snapd-ovmf, update description to mention that that it's ovmf binaries with some testing keys enrolled used for snapd CI and push it to the store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a name request for test-snapd-ovmf
. Can move the snap files to tests/lib/snaps/store/test-snapd-ovmf
?
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
install -Dm644 -t "${CRAFT_PART_INSTALL}/secboot" \ | ||
LockDown.efi {PK,KEK,DB}.{key,crt} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will generate new keys each time during the build which isn't obvious. Probably not a problem but users need to be aware of it. Or we can drop pre-generated keys into the snap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point here is people not to test explicitly a key. They have to test if a key matches specifically DB or KEK. And not just a constant hash in some test.
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
-drive "if=pflash,file=${OVMF}_VARS.fd,format=raw" \ | ||
-drive "if=virtio,file=${CRAFT_STAGE}/lockdown.img,format=raw" >qemu.out 2>qemu.err </dev/null | ||
install -Dm644 "${OVMF}_VARS.fd" "${CRAFT_PART_INSTALL}/fw/${OVMF}_VARS.secboot.fd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install -Dm644 "${OVMF}_VARS.fd" "${CRAFT_PART_INSTALL}/fw/${OVMF}_VARS.secboot.fd" | |
install -Dm644 "${OVMF}_VARS.fd" "${CRAFT_PART_INSTALL}/fw/${OVMF}_VARS.secboot-testkeys.fd" |
tests/lib/nested.sh
Outdated
return | ||
fi | ||
if ! [ -f "${NESTED_ASSETS_DIR}/ovmf.snap" ]; then | ||
(cd "${TESTSLIB}/snaps/ovmf"; run_snapcraft --use-lxd --verbosity quiet --output="${NESTED_ASSETS_DIR}/ovmf.snap") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd rather download the snap from store rather than build it, or even fail explicitly and expect run-spread
to do the download.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I will keep it in the draft for now. When the tests seem to work, I will add some CI step that uploads it.
We have |
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
@@ -0,0 +1,140 @@ | |||
name: ovmf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a name request for test-snapd-ovmf
. Can move the snap files to tests/lib/snaps/store/test-snapd-ovmf
?
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
summary: EDK2 | ||
description: EDK2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary: EDK2 | |
description: EDK2 | |
summary: Pre-built OVMF blobs with test keys for snapd CI | |
description: | | |
Pre-built OVMF blobs with enrolled test keys for use in snapd CI loop. | |
The following known keys are enrolled: | |
- snakeoil - ## ref? | |
- kernel PPA | |
<whichever we key we add> |
19ba700
to
81ccf1d
Compare
tests/lib/snaps/ovmf/snapcraft.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename the directory to tests/lib/snaps/store/test-snapd-ovmf?
5bfbbd3
to
028fefe
Compare
d509075
to
74459a7
Compare
74459a7
to
d547746
Compare
tests/lib/nested.sh
Outdated
fi | ||
PARAM_BIOS="-drive file=${OVMF_CODE},if=pflash,format=raw,readonly=on -drive file=${OVMF_VARS},if=pflash,format=raw" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we got a new copy of the vars blob for each run, and optionally, only in the fde branch, the state file could be kept around. however, with the changes right now we'll reuse the vars blob file each time. IMO it'd be better to keep the old behavior of starting with a clean copy.
PARAM_BIOS="-drive file=${OVMF_CODE},if=pflash,format=raw,readonly=on -drive file=${OVMF_VARS},if=pflash,format=raw" | |
OVMF_VARS_TMP="${OVMF_VARS}.tmp" | |
# make a copy of the original VARS blob, so that we start with a clean slate | |
cp -fv "$OVMF_VARS" "$OVMF_VARS_TMP" | |
PARAM_BIOS="-drive file=${OVMF_CODE},if=pflash,format=raw,readonly=on -drive file=${OVMF_VARS_TMP},if=pflash,format=raw" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose I should reset unless NESTED_KEEP_FIRMWARE_STATE
is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I realize we are missing stuff from the FDE branch. For example d016c59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine, we can either cherry pick it or simply add it in the fde branch during rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cherry picked the commits needed and fixed the commit.
…are-state When restarting a nested VM, we reset the EFI variables and the TPM. It was possible to keep the state of the TPM, but it makes little sense to keep the TPM but not the EFI variables. With the new secboot, both resetting EFI and resetting the TPM will potentially cause recovery key to be needed. This fixes the case where an installer image would create a sbatlevel revocation, and get a different one after reset and boot with the gadget snap.
Some tests like `tests/nested/manual/core20-install-mode-shutdown-via-hook` source this script with `-u` set. So `NESTED_KEEP_FIRMWARE_STATE` which is potentially unbound has to be used as such.
d547746
to
0864abd
Compare
0864abd
to
753794f
Compare
Depends on #14959
The generated OVMF_VARS also contains microsoft "other" db cert. And also the certs for the pc-kernel edge. As well as the now deprecated snakeoil cert.