Skip to content

Enhancement: fail boot if users expect SecureBoot and there's an issue with certificates #16

@stormi

Description

@stormi

A difference between uefistored and varstored was a change we made on purpose to avoid giving users a false sense of security.

If varstored is told to enforce SecureBoot, it will silently decide not to enforce it if there's any issue with the certificates in the VM's NVRAM. Missing certificates, broken chain of trust...

Example as seen in daemon.log. Nothing tells that secure boot was actually disabled at the last minute:

Oct 26 16:59:28 r620-x2 varstored-132[9782]: varstored_initialize: 1 vCPU(s)
Oct 26 16:59:28 r620-x2 varstored-132[9782]: varstored_initialize: ioservid = 0
Oct 26 16:59:28 r620-x2 varstored-132[9782]: varstored_initialize: iopage = 0x7f6bc35b4000
Oct 26 16:59:28 r620-x2 varstored-132[9782]: varstored_initialize: VCPU0: 4 -> 194
Oct 26 16:59:28 r620-x2 varstored-132[9782]: initialize_settings: Secure boot enable: true
Oct 26 16:59:28 r620-x2 varstored-132[9782]: initialize_settings: Authenticated variables: enforcing
Oct 26 16:59:28 r620-x2 varstored-132[9782]: IO request not ready

It may be consistent with the UEFI specifications, and may make sense for hardware. But in the context of a hypervisor, for users who probably don't understand how exactly the certificates are handled and how all this works, this is confusing: they ask for SecureBoot and the VM boots, so the logical assumption is: nothing went wrong and SecureBoot is enforced. The only way to be sure that it's true is by checking from within the VM.

In uefistored, without a proper means to give feedback to XAPI, we simply made uefistored kill itself with an error log, after sending a VM_SECURE_BOOT_FAILED message to XAPI. It's not perfect, but at least a VM with missing or broken certificates would not boot if users asked for SecureBoot and we can't give it to them. It's not exactly a SecureBoot failure, but it was close enough for us to reuse the VM_SECURE_BOOT_FAILED. We could also have created a different error but it would have been hard to contribute to XAPI at the time.

Could we improve this in varstored and/or XAPI?

  • Simple case: missing certs (PK, KEK or db. dbx is optional): this could be detected by XAPI directly before even starting the VM
  • More complex case: certs are present but there's an issue with them. Malformed, not signed properly or not with the right keys, etc. A first sight, looks like something varstored already checks and could act upon. The minimum would be to log an error, useful for anyone checking the logs but not enough to give the right feedback to users. The ugly way would be simply killing itself with a meaningful error message. A probably better way would be communicating back with XAPI to let it know there's a problem, and abort the boot process.

We can certainly contribute the changes if we agree on a design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions