Skip to content

Commit 63d75da

Browse files
committed
docs
1 parent b060971 commit 63d75da

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ qemu-system-x86_64 \
6969

7070
_Note:_ If you are not running Fedora, your distribution may put the UEFI OVMF image in a different location. You may need to update this before the command will work.
7171

72-
### Testing: Local (With Secure Boot)
72+
### Testing: Local (With Secure Boot and traditional UEFI VARS store)
7373
See the "Generating Secure Boot / Measured Boot keys" section further down if you want to make use of this approach.
7474

7575
Install `virt-firmware`:
@@ -89,7 +89,7 @@ virt-fw-vars \
8989
--secure-boot
9090
```
9191

92-
Note that we use `OVMF_VARS_4M.qcow2` as the source for the VARS file in the command above. This is a default (empty) VARS store, unlike `OVMF_VARS_4M.secboot.qcow2` which already has a number of Microsoft, Red Hat, etc keys enrolled in it. Using the blank store and the `none` arguments for the Microsoft keys means we can be sure that only **our** key is being used to validate the signed OS image.
92+
Note that we use `OVMF_VARS_4M.qcow2` as the source for the VARS file in the command above. This is a default (empty) VARS store, unlike `OVMF_VARS_4M.secboot.qcow2` which already has a number of Microsoft, Red Hat, etc keys enrolled in it. Using the blank store and the `none` arguments for the Microsoft keys means we can be sure that only **our** key is being used to validate the signed OS image. This means we don't need to worry about maintaining up-to-date DBX (revocation) lists.
9393

9494
Boot the image directly like this:
9595
```sh
@@ -103,6 +103,35 @@ qemu-system-x86_64 \
103103
-kernel images/<imagename>.efi.img
104104
```
105105

106+
### Testing: Local (With Secure Boot and JSON-based UEFI VARS store)
107+
> [!WARNING]
108+
> This is an experimental feature that was introduced in QEMU 10.0. The OVMF_CODE build being used must be built with `QEMU_PV_VARS=TRUE` otherwise it will just hang. The current Fedora builds of `OVMF_CODE_4M.secboot.qcow2` are built to expect a pflash-backed variable store rather than a JSON-backed one.
109+
110+
This method makes use of the [Host UEFI variable service](https://www.qemu.org/docs/master/devel/uefi-vars.html#host-uefi-variable-service) available in more recent versions of QEMU to provide the Secure Boot keys to the VM as a JSON object.
111+
112+
Generate the JSON-based UEFI VARS store:
113+
```sh
114+
virt-fw-vars \
115+
--output-json /tmp/vars.json \
116+
--set-pk-cert $(uuidgen) keys/pk-cert.pem \
117+
--add-db-cert $(uuidgen) keys/db-cert.pem \
118+
--microsoft-db none \
119+
--microsoft-kek none \
120+
--secure-boot
121+
```
122+
123+
Boot the VM using the JSON VARS store:
124+
```sh
125+
qemu-system-x86_64 \
126+
-name pinewall \
127+
-machine q35,smm=off,vmport=off,accel=kvm \
128+
-m 2G \
129+
-nographic \
130+
-drive if=pflash,format=qcow2,unit=0,file=YOUR_OVMF_CODE.qcow2,readonly=on \
131+
-device uefi-vars-x64,jsonfile=/tmp/vars.json \
132+
-kernel images/<imagename>.efi.img
133+
```
134+
106135
### Testing: Proxmox
107136
If you want to test on Proxmox, you can do much the same as the above, though you will need to create the VM with the `qm create` command.
108137

@@ -183,4 +212,4 @@ We can validate that Secure Boot is working in our installed environment, and in
183212
mokutil --sb-state && echo 'PK Keys:' && mokutil --pk | grep "Issuer:" && echo 'DB Keys:' && mokutil --db | grep "Issuer:"
184213
```
185214

186-
(Yes, there are private keys already in the `keys/` directory in this repo. Maybe you're here because your repo scanning tool found them. No, they're never used for any prod systems. They're mostly just here as an example so the scheduled GitHub Actions pipeline.)
215+
(Yes, there are private keys already in the `keys/` directory in this repo. Maybe you're here because your repo scanning tool found them. No, they're never used for any prod systems. They're mostly just here as an example so the scheduled GitHub Actions pipeline actually works.)

0 commit comments

Comments
 (0)