Skip to content

Merge feature/uefi_expiry to master#7073

Merged
changlei-li merged 18 commits into
masterfrom
feature/uefi_expiry
May 18, 2026
Merged

Merge feature/uefi_expiry to master#7073
changlei-li merged 18 commits into
masterfrom
feature/uefi_expiry

Conversation

@chunjiez
Copy link
Copy Markdown
Collaborator

This feature does,

  1. detect whether a VM, snapshot, or template still uses the Microsoft 2011 UEFI certificates
  2. expose a simple state that admins can use in XenCenter, CLI, and API to identify affected objects
  3. allow admins to mark eligible VMs so XenServer updates their certificates automatically on the next boot
  4. allow admins to unmark a pending update before the VM is rebooted
  5. support Windows and Linux UEFI VMs (irrespective if VM has he secure boot function enabled or not) that still carry the affected Microsoft 2011 certificates

Stephen Cheng and others added 18 commits April 16, 2026 10:09
Add a new DynamicRO field to track Secure Boot certificate status per VM.
The field indicates whether UEFI Secure Boot certificates need updating.

- Define enum (ok, update_available, update_on_boot) and field in datamodel
- Check certificate state via varstore-nvram-certcheck on import and
  DB upgrade for UEFI Secure Boot VMs
- Skip control domains, default templates, and non-Secure Boot VMs
  in the DB upgrade rule

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
…eter

Add a new versioned parameter 'update' to VM.set_NVRAM_EFI_variables,
allowing varstored to indicate whether Secure Boot certificates were
changed during an NVRAM write. This enables xapi to maintain the
VM.secureboot_certificates_state field accurately.

The 'update' parameter is an enum with three values:
- 'yes': certificates were updated, set state to 'ok'
- 'no': certificates unchanged, keep current state as-is
- 'unspecified': (default for v1 callers) run certcheck to determine state

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Also fix other comments during review

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
…ing (#7015)

## Background

Microsoft Secure Boot certificates from 2011 are reaching end-of-life,
and legacy VMs may still contain only the old certificate set. This PR
implements the xapi side of the out-of-band mechanism to track and
update per-VM UEFI Secure Boot variables safely, as described in the
[design doc](#7006).

## Changes

Sorry for the large PR, but the changes form a single feature.
The two main commits are:

### 1. CP-311907: Add `VM.secureboot_certificates_state` field

Add a new `DynamicRO` field to track Secure Boot certificate status per
VM. The field indicates whether UEFI Secure Boot certificates need
updating.

- Invoke `varstore-nvram-certcheck` to determine certificate state from
the NVRAM EFI-variables blob
- On DB upgrade: compute state for existing UEFI Secure Boot VMs,
skipping control domains and default templates
- On import: compute state for VMs imported
- On clone/snapshot: copy the state to the new VM

### 2. CP-311908: Add versioned `update` parameter to
`VM.set_NVRAM_EFI_variables`

Add a versioned `update` parameter (enum: `yes`/`no`/`unspecified`) so
varstored can report whether certificates were changed during an NVRAM
write. This avoids invoking the certcheck binary on every NVRAM write.

- `update=yes`: certificates were updated → set state to `ok`
- `update=no`: certificates not changed → preserve current state
- `update=unspecified` (default for legacy v1 callers): run certcheck to
determine state
- Register `set_NVRAM_v2` RPC in xapi-guard, mapping the string
parameter to the enum


## Testing

Tested the following scenarios with the updated varstored:

- State transitions: `ok` → `update_available` → `update_on_boot` → `ok`
verified correct
- VM reboot with certificate update: varstored sends `update=yes`, state
transitions to `ok`
- VM reboot without certificate update: varstored sends `update=no`,
state is preserved
- Cross-host live migration (old host → new host, new host → new host):
`secureboot_certificates_state` is correctly preserved
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
Admin marks a VM for update: update_available -> update_on_boot

tgroup.opam update is to fix "make test" failure
Signed-off-by: Chunjie Zhu <chunjie.zhu@citrix.com>
According to design doc, we treat non-secure-boot VM same as secure-boot
VM, that is to say, the certificate and certificate state should be
updated for non-secure-boot VM.
Signed-off-by: Chunjie Zhu <chunjie.zhu@citrix.com>
@changlei-li changlei-li added this pull request to the merge queue May 18, 2026
Merged via the queue into master with commit 7420c67 May 18, 2026
28 checks passed
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.

5 participants