Skip to content

Commit 0b2a2ea

Browse files
committed
Add Secure Boot change announcement and instructions
Signed-off-by: Tu Dinh <[email protected]>
1 parent 15c80a8 commit 0b2a2ea

File tree

1 file changed

+94
-23
lines changed

1 file changed

+94
-23
lines changed

docs/guides/guest-UEFI-Secure-Boot.md

Lines changed: 94 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,60 @@ How to configure UEFI Secure boot?
44

55
Enabling UEFI Secure Boot for guests ensures that XCP-ng VMs will only execute trusted binaries at boot. In practice, these are the binaries released by the operating system (OS) vendor for the OS running in the VM (Microsoft Windows, Debian, RHEL, Alpine, etc.).
66

7+
## Upcoming changes in Secure Boot
8+
9+
The default Secure Boot keys in XCP-ng are changing.
10+
11+
Previously, XCP-ng only shipped with the PK included by default; Secure Boot variables had to be installed using `secureboot-certs`.
12+
New versions of XCP-ng's `varstored` (from version 1.2.0-2.4 and newer) now come with a complete set of Secure Boot variables (PK/KEK/db/dbx) by default, meaning that guest Secure Boot will now work for new VMs without needing further pool configuration.
13+
14+
Our defaults now include the 2023 Microsoft KEK and db certificates, ensuring Secure Boot updates beyond 2026 (which is when the previous 2011 certificates expire). These defaults will also be automatically kept up-to-date as XCP-ng is updated.
15+
16+
### What this change means for you
17+
18+
You will not be affected in most cases.
19+
20+
* Existing VMs will not be affected unless you use the [Propagate certificates](#propagate-pool-certificates-to-a-vm) feature in Xen Orchestra (which has always had the effect of resetting VM Secure Boot variables to that of the pool).
21+
* If you followed our previous guides and used `secureboot-certs install` to install the default Secure Boot variables into your pool, these variables will not be changed.
22+
23+
Here are the changes in detail:
24+
25+
* If you haven't manually configured Secure Boot variables on your pool, your pool now supports guest Secure Boot by default.
26+
* From now on, we recommend keeping the pool Secure Boot variables default so that XCP-ng updates could keep them up-to-date.
27+
* If you have installed your pool SB variables using `secureboot-certs install`, use `secureboot-certs clear` to reset them.
28+
* Existing VMs will not be affected.
29+
* We now include the 2023 Microsoft KEK certificate for guest-initiated security updates to the db and dbx variables.
30+
* After updating the pool variables, you can add this certificate to existing VMs using the [Propagate certificates](#propagate-pool-certificates-to-a-vm) procedure.
31+
32+
:warning: **Danger**, risk of data loss: Propagating certificates to an existing VM will change its Secure Boot vTPM measurements. If you depend on these measurements (e.g. BitLocker with TPM protector), you must carefully read the [Preparing for Secure Boot Variable Changes](#preparing-for-secure-boot-variable-changes) procedure.
33+
734
## Requirements
835

936
* XCP-ng >= 8.2.1.
1037
* UEFI Secure Boot Certificates installed on the pool (this is detailed below).
1138
* A UEFI guest VM.
12-
* For Windows, ensure the VM has at least 2 vCPUs.
1339

1440
:::warning
1541
Until we can re-sign XCP-ng's PV drivers for Windows, you will need the PV drivers from XenServer before enabling Secure Boot for a Windows VM. See [Setup Secure Boot for Windows VMs](#setup-secure-boot-for-windows-vms).
1642
:::
1743

1844
Note: it's not necessary that the XCP-ng host boots in UEFI mode for Secure Boot to be enabled on VMs.
1945

20-
## Quick Start
46+
## 8.3 with varstored >= 1.2.0-2.4
47+
48+
Secure Boot is ready to use on new VMs without extra configuration. Simply activate Secure Boot on your VMs, and they will be provided with an appropriate set of default Secure Boot variables.
49+
50+
We will keep updating the default Secure Boot variables with future updates from Microsoft. If you don't want this behavior, you can lock in these variables by using the [Manually Install the Default UEFI Certificates](#manually-install-the-default-uefi-certificates) procedure.
51+
52+
## 8.2.1 and 8.3 with varstored < 1.2.0-2.4
53+
54+
These versions of XCP-ng require manual configuration to enable Secure Boot.
2155

2256
We believe that reading this guide will provide you with useful knowledge about the way Guest Secure Boot is handled in XCP-ng, and let you avoid mistakes.
2357

24-
However, for those who would like to take a shorcut, here's how to set it up on a new pool.
58+
However, for those who would like to take a shortcut, here's how to set it up on a new pool.
2559

26-
* Run `secureboot-certs install` to [install the default UEFI certificates to your pool](#install-the-default-uefi-certificates).
60+
* Run `secureboot-certs install` to [install the default UEFI certificates to your pool](#manually-install-the-default-uefi-certificates).
2761
* From now on, any new UEFI VM will be initialized with these certificates, the first time it boots.
2862
* For any VM which was already initialized before the operation (booted at least once before):
2963
* If it was started before UEFI certificates were installed on the pool, manually [trigger the certificate propagation](#propagate-pool-certificates-to-a-vm).
@@ -63,6 +97,7 @@ In this guide, we often refer to those 4 UEFI variables as **the Secure Boot cer
6397
:::
6498

6599
The certificates are stored at several levels:
100+
* **bundled** in the varstored package and managed by XCP-ng updates,
66101
* **pool** level (in the XAPI database),
67102
* host **disk** (it basically mirrors the certificates in the XAPI database),
68103
* **VM** level (in the VM's UEFI variable store).
@@ -83,37 +118,60 @@ At the VM level:
83118

84119
## Configure the Pool
85120

86-
The first thing we need to do, before enabling UEFI Secure Boot for guest VMs, is to install a set of certificates to the pool using the `secureboot-certs` script on the pool master. This tool downloads, formats, and installs UEFI certificates for the `PK`, `KEK`, `db`, and `dbx` certificates in the XCP-ng pool.
121+
For pools with varstored version >= 1.2.0-2.4, no action is required.
87122

88-
To download and install XCP-ng's default certificates (what almost all users will want), see [Install the Default UEFI Certificates](#install-the-default-uefi-certificates).
123+
For pools with varstored < 1.2.0-2.4, before enabling UEFI Secure Boot for guest VMs, you need to install a set of certificates to the pool using the `secureboot-certs` script on the pool master. This tool downloads, formats, and installs UEFI certificates for the `PK`, `KEK`, `db`, and `dbx` certificates in the XCP-ng pool.
124+
125+
To download and install XCP-ng's default certificates (what almost all users will want), see [Manually Install the Default UEFI Certificates](#manually-install-the-default-uefi-certificates).
89126

90127
For custom certificates (advanced use), see [Install Custom UEFI Certificates](#install-custom-uefi-certificates)
91128

92-
### Install the Default UEFI Certificates
129+
### Manually Install the Default UEFI Certificates
130+
131+
:::info
132+
This procedure is not necessary if you're using varstored 1.2.0-2.4 and newer. However, you can use the procedure anyway to lock in the default variables per pool and avoid further default changes.
133+
:::
93134

94135
`secureboot-certs` supports installing a default set of certificates across the pool.
95136

96137
Except the `PK` key which is already provided by XCP-ng, all certificates are downloaded from official sources (`microsoft.com` and `uefi.org`).
97138

98139
The default certificates are sourced as follows:
99140

141+
**With varstored < 1.2.0-2.4:**
142+
100143
| Certificate | Source | CLI Arg |
101144
|-------------|-------------------------------------------------------------------------------------------------------------------|-----------|
102145
| PK | Provided by XCP-ng, already present on disk. | `default` |
103-
| KEK | [Microsoft Corporation UEFI KEK CA 2011](https://www.microsoft.com/pkiops/certs/MicCorKEKCA2011_2011-06-24.crt) | `default` |
146+
| KEK | [Microsoft Corporation KEK CA 2011](https://www.microsoft.com/pkiops/certs/MicCorKEKCA2011_2011-06-24.crt) | `default` |
104147
| db | [Microsoft Corporation UEFI CA 2011](https://www.microsoft.com/pkiops/certs/MicCorUEFCA2011_2011-06-27.crt) and [Microsoft Windows Production PCA 2011](https://www.microsoft.com/pkiops/certs/MicWinProPCA2011_2011-10-19.crt) | `default` |
105148
| dbx | [UEFI Revocation List](https://uefi.org/sites/default/files/resources/dbxupdate_x64.bin) | `latest` |
106149

107-
To install these certificates from the command line interface:
150+
**With varstored >= 1.2.0-2.4:**
151+
152+
All keys are built into varstored-tools and present on disk. There's no need to configure them except for custom Secure Boot scenarios.
153+
154+
Certificate and revocation lists provided by [microsoft/secureboot_objects](https://github.com/microsoft/secureboot_objects).
155+
156+
| Certificate | Source | CLI Arg |
157+
|-------------|-------------------------------------------------------------------------------------------------------------------|-----------|
158+
| PK | Provided by XCP-ng. | `default` |
159+
| KEK | Microsoft Corporation KEK CA 2011 and Microsoft Corporation KEK 2K CA 2023 | `default` |
160+
| db | Microsoft Windows Production PCA 2011, Windows UEFI CA 2023, Microsoft Corporation UEFI CA 2011, Microsoft UEFI CA 2023 and Microsoft Option ROM UEFI CA 2023 | `default` |
161+
| dbx | Image hashes provided by microsoft/secureboot_objects (can specify `latest` to download latest dbx instead) | `default` |
162+
163+
To install these variables from the command line interface:
108164

109165
```
110-
# Download and install PK/KEK/db/dbx certificates
166+
# Download and install PK/KEK/db/dbx certificates (varstored < 1.2.0-2.4)
111167
secureboot-certs install default default default latest
112-
```
168+
# or simply: secureboot-certs install
113169
114-
This can be shortened to:
115-
```
170+
# Reinstall and lock built-in PK/KEK/db/dbx variables (varstored >= 1.2.0-2.4)
116171
secureboot-certs install
172+
173+
# Go back to XCP-ng-managed defaults (varstored >= 1.2.0-2.4)
174+
secureboot-certs clear
117175
```
118176

119177
If `secureboot-certs` fails to download the certificates from Microsoft due to microsoft.com deciding to forbid downloads from the user agent declared by the script, you may try to download with a different user agent (for example your current browser's user agent):
@@ -124,7 +182,7 @@ secureboot-certs install --user-agent="Mozilla/5.0 My custom user agent"
124182

125183
If this still fails, check the next section which explains how to install them manually.
126184

127-
### Install the Default UEFI Certificates Manually
185+
### Install the Default UEFI Certificates Manually (varstored < 1.2.0-2.4)
128186

129187
* Using your web browser, download the certificates listed in the table above (`KEK`, CA and PCA which will allow us to build `db`, and `dbx`).
130188
* Transfer the files to your master host.
@@ -162,25 +220,38 @@ Advanced use, not needed by most users.
162220
For example, to install a custom PK you may do the following:
163221
164222
```
165-
# Enroll it, along with the default certificates, with secureboot-certs
166-
secureboot-certs install PK.cer default default latest
223+
# Enroll a custom PK along with the default KEK/db/dbx
224+
secureboot-certs install PK.cer
167225
```
168226
169-
The same procedure may be used to install custom KEK, db, or dbx certs.
227+
The same procedure may be used to install custom KEK, db, or dbx variables.
170228
171229
To use multiple certificates in one variable (that is, have multiple certificates stored as a single KEK, db, or dbx), the certs must be packaged together into a .auth file, see [Use two or more certificates for a Secure Boot variable](#use-two-or-more-certificates-for-a-secure-boot-variable). Note that multiple certificates in the PK is not supported. If an auth file with multiple certs is loaded as the PK, only the first one found will be used.
172230
173231
Note that the virtual firmware, as is allowed by the specification, does not mandate that these default certificates be signed by their parent (i.e., the KEK doesn't need to be signed by PK) if they're installed via `secureboot-certs`. This verification *does* occur, however, when trying to enroll new certificates from inside the guest after boot. This is designed to give the host administrator full control over the certificates from the control domain.
174232
175-
If necessary for your use case you may omit the `dbx` entirely. Note that this basically **renders secure boot useless** from a security perspective, as any binary signed with a revoked certificate will still pass Secure Boot checks! This may be done by using the following command:
233+
You can also omit the dbx variable entirely.
234+
This is the most compatible option for old installation media that may not include the newest Secure Boot fixes.
235+
Once installed, the guest can still update the dbx variable on its own to revoke vulnerable bootloaders as long as the default KEK is included.
236+
Omitting the dbx variable can be done using the following command:
176237
177238
```
178-
# Download and install PK/KEK/db certificates, omit the dbx
239+
# Install default PK/KEK/db variables, omit the dbx
179240
secureboot-certs install default default default none
180241
```
181242
182243
For help with the tool's install functionality, call `secureboot-certs install -h`.
183244
245+
### Resetting Pool UEFI Certificates (varstored >= 1.2.0-2.4)
246+
247+
If you want to revert to the XCP-ng pool Secure Boot defaults, simply issue the following command:
248+
249+
```
250+
secureboot-certs clear
251+
```
252+
253+
Existing VMs will not be affected.
254+
184255
## Enable Secure Boot for a Guest VM
185256
186257
### Enable Secure Boot at VM creation
@@ -299,11 +370,11 @@ When there are security concerns related to some of the certificates involved in
299370
300371
On actual hardware, this `dbx` update would be propagated to you through a firmware update, or be coming from your OS itself. For example, Microsoft updates the `dbx` database of the computer as part of some of its security updates.
301372
302-
In a virtualization environment like XCP-ng, **we recommend that you use the latest `dbx` and update it regularly**.
303-
* Follow the [installation instructions](#configure-the-pool) again to update the certificates at the pool level.
373+
**We recommend that you use the default Secure Boot variables provided by XCP-ng**.
374+
* These variables are automatically updated by varstored updates.
304375
* Any new VM will use the updated certificate databases the first time it starts.
305376
* Existing VMs won't be affected (unless they've never been booted after the first time you installed certificates to the pool).
306-
* Either let the OS update the dbx in your existing VMs (Windows does that), or [update manually](#change-the-certificates-already-installed-on-a-vm).
377+
* For existing VMs, either let them update the variables on their own (Windows does that), or [update manually](#change-the-certificates-already-installed-on-a-vm).
307378
308379
### VMs that won't boot due to a revoked certificate
309380
@@ -511,7 +582,7 @@ Advanced use, not needed by most users.
511582
512583
To create a Secure Boot variable (PK, KEK, db, or dbx) with multiple certificates, it is required to use the `create-auth` tool to bundle the certificates into a single .auth file.
513584
514-
From command line, to create a KEK with certifcates `cert1.crt` and `cert2.crt`:
585+
From command line, to create a KEK with certificates `cert1.crt` and `cert2.crt`:
515586
```
516587
/opt/xensource/libexec/create-auth KEK KEK.auth cert1.crt cert2.crt
517588
```

0 commit comments

Comments
 (0)