I am trying to set up a Xen Host in a way that every step until booting the Dom0 Linux kernel is Secure Boot verified.
Without Xen, this could be achieved by signing an unified kernel image containing the kernel, initrd and kernel command-line parameters in a single EFI binary.
Signing only the Xen EFI binary is useless because the kernel, initrd and Xen configuration file could be modified without affecting Secure Boot.
When booted via Shim, Xen verifies the Dom0 kernel and initrd using the Shim protocol, but the Xen configuration file containing the kernel command-line parameters is not verified, so an attacker could still modify these parameters.
tklengyel/xen-uefi patches the Xen source code to measure the Xen configuration file into a PCR register. This would not be necessary if the signed kernel binary booted by Xen included the initrd and kernel command-line parameters and all other parameters specified in the Xen configuration file were ignored.
Is there any way to achieve this?
There is no support for it in the mainline Xen tree as of 4.15, although there are preliminary patches to support building a "unified Xen": https://github.com/osresearch/xen/tree/secureboot
This borrows the technique from systemd-boot
to create the single unified Xen executable with xen.cfg
, bzImage
, initrd.img
and an optional XSM file, each in their own named PE section. This executable can then be signed with sbsign
and validated by UEFI Secure Boot using the Platform Key or key database. A UEFI boot manager entry can be created for this unified Xen so that grub
is not required.
It's been tested in qemu with the OVMF Secure Boot enabled, as well as Thinkpad hardware. Further cleanup is necessary before it is ready for submission to xen-devel.