Skip to content

Commit aedaf3a

Browse files
authored
Merge pull request #328 from xcp-ng/secureboot-changes
Announce Secure Boot changes
2 parents 79b14b1 + 6328ae3 commit aedaf3a

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,22 +4,56 @@ 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 guest Secure Boot
8+
9+
The default guest 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
Note: it's not necessary that the XCP-ng host boots in UEFI mode for Secure Boot to be enabled on VMs.
1541

16-
## Quick Start
42+
## 8.3 with varstored >= 1.2.0-2.4
43+
44+
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.
45+
46+
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.
47+
48+
## 8.2.1 and 8.3 with varstored < 1.2.0-2.4
49+
50+
These versions of XCP-ng require manual configuration to enable Secure Boot.
1751

1852
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.
1953

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

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

6195
The certificates are stored at several levels:
96+
* **bundled** in the varstored package and managed by XCP-ng updates,
6297
* **pool** level (in the XAPI database),
6398
* host **disk** (it basically mirrors the certificates in the XAPI database),
6499
* **VM** level (in the VM's UEFI variable store).
@@ -79,37 +114,60 @@ At the VM level:
79114

80115
## Configure the Pool
81116

82-
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.
117+
For pools with varstored version >= 1.2.0-2.4, no action is required.
83118

84-
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).
119+
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.
120+
121+
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).
85122

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

88-
### Install the Default UEFI Certificates
125+
### Manually Install the Default UEFI Certificates
126+
127+
:::info
128+
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.
129+
:::
89130

90131
`secureboot-certs` supports installing a default set of certificates across the pool.
91132

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

94135
The default certificates are sourced as follows:
95136

137+
**With varstored < 1.2.0-2.4:**
138+
96139
| Certificate | Source | CLI Arg |
97140
|-------------|-------------------------------------------------------------------------------------------------------------------|-----------|
98141
| PK | Provided by XCP-ng, already present on disk. | `default` |
99-
| KEK | [Microsoft Corporation UEFI KEK CA 2011](https://www.microsoft.com/pkiops/certs/MicCorKEKCA2011_2011-06-24.crt) | `default` |
142+
| KEK | [Microsoft Corporation KEK CA 2011](https://www.microsoft.com/pkiops/certs/MicCorKEKCA2011_2011-06-24.crt) | `default` |
100143
| 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` |
101144
| dbx | [UEFI Revocation List](https://uefi.org/sites/default/files/resources/dbxupdate_x64.bin) | `latest` |
102145

103-
To install these certificates from the command line interface:
146+
**With varstored >= 1.2.0-2.4:**
147+
148+
All keys are built into varstored-tools and present on disk. There's no need to configure them except for custom Secure Boot scenarios.
149+
150+
Certificate and revocation lists provided by [microsoft/secureboot_objects](https://github.com/microsoft/secureboot_objects).
151+
152+
| Certificate | Source | CLI Arg |
153+
|-------------|-------------------------------------------------------------------------------------------------------------------|-----------|
154+
| PK | Provided by XCP-ng. | `default` |
155+
| KEK | Microsoft Corporation KEK CA 2011 and Microsoft Corporation KEK 2K CA 2023 | `default` |
156+
| 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` |
157+
| dbx | Image hashes provided by microsoft/secureboot_objects (can specify `latest` to download latest dbx instead) | `default` |
158+
159+
To install these variables from the command line interface:
104160

105161
```
106-
# Download and install PK/KEK/db/dbx certificates
162+
# Download and install PK/KEK/db/dbx certificates (varstored < 1.2.0-2.4)
107163
secureboot-certs install default default default latest
108-
```
164+
# or simply: secureboot-certs install
109165
110-
This can be shortened to:
111-
```
166+
# Reinstall and lock built-in PK/KEK/db/dbx variables (varstored >= 1.2.0-2.4)
112167
secureboot-certs install
168+
169+
# Go back to XCP-ng-managed defaults (varstored >= 1.2.0-2.4)
170+
secureboot-certs clear
113171
```
114172

115173
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):
@@ -120,7 +178,7 @@ secureboot-certs install --user-agent="Mozilla/5.0 My custom user agent"
120178

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

123-
### Install the Default UEFI Certificates Manually
181+
### Install the Default UEFI Certificates Manually (varstored < 1.2.0-2.4)
124182

125183
* 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`).
126184
* Transfer the files to your master host.
@@ -158,25 +216,38 @@ Advanced use, not needed by most users.
158216
For example, to install a custom PK you may do the following:
159217
160218
```
161-
# Enroll it, along with the default certificates, with secureboot-certs
162-
secureboot-certs install PK.cer default default latest
219+
# Enroll a custom PK along with the default KEK/db/dbx
220+
secureboot-certs install PK.cer
163221
```
164222
165-
The same procedure may be used to install custom KEK, db, or dbx certs.
223+
The same procedure may be used to install custom KEK, db, or dbx variables.
166224
167225
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.
168226
169227
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.
170228
171-
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:
229+
You can also omit the dbx variable entirely.
230+
This is the most compatible option for old installation media that may not include the newest Secure Boot fixes.
231+
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.
232+
Omitting the dbx variable can be done using the following command:
172233
173234
```
174-
# Download and install PK/KEK/db certificates, omit the dbx
235+
# Install default PK/KEK/db variables, omit the dbx
175236
secureboot-certs install default default default none
176237
```
177238
178239
For help with the tool's install functionality, call `secureboot-certs install -h`.
179240
241+
### Resetting Pool UEFI Certificates (varstored >= 1.2.0-2.4)
242+
243+
If you want to revert to the XCP-ng pool Secure Boot defaults, simply issue the following command:
244+
245+
```
246+
secureboot-certs clear
247+
```
248+
249+
Existing VMs will not be affected.
250+
180251
## Enable Secure Boot for a Guest VM
181252
182253
### Enable Secure Boot at VM creation
@@ -295,11 +366,11 @@ When there are security concerns related to some of the certificates involved in
295366
296367
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.
297368
298-
In a virtualization environment like XCP-ng, **we recommend that you use the latest `dbx` and update it regularly**.
299-
* Follow the [installation instructions](#configure-the-pool) again to update the certificates at the pool level.
369+
**We recommend that you use the default Secure Boot variables provided by XCP-ng**.
370+
* These variables are automatically updated by varstored updates.
300371
* Any new VM will use the updated certificate databases the first time it starts.
301372
* Existing VMs won't be affected (unless they've never been booted after the first time you installed certificates to the pool).
302-
* 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).
373+
* 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).
303374
304375
### VMs that won't boot due to a revoked certificate
305376
@@ -507,7 +578,7 @@ Advanced use, not needed by most users.
507578
508579
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.
509580
510-
From command line, to create a KEK with certifcates `cert1.crt` and `cert2.crt`:
581+
From command line, to create a KEK with certificates `cert1.crt` and `cert2.crt`:
511582
```
512583
/opt/xensource/libexec/create-auth KEK KEK.auth cert1.crt cert2.crt
513584
```

0 commit comments

Comments
 (0)