You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/guest-UEFI-Secure-Boot.md
+94-23Lines changed: 94 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,56 @@ How to configure UEFI Secure boot?
4
4
5
5
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.).
6
6
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
+
7
34
## Requirements
8
35
9
36
* XCP-ng >= 8.2.1.
10
37
* UEFI Secure Boot Certificates installed on the pool (this is detailed below).
11
38
* A UEFI guest VM.
12
-
* For Windows, ensure the VM has at least 2 vCPUs.
13
39
14
40
Note: it's not necessary that the XCP-ng host boots in UEFI mode for Secure Boot to be enabled on VMs.
15
41
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.
17
51
18
52
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.
19
53
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.
21
55
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).
23
57
* From now on, any new UEFI VM will be initialized with these certificates, the first time it boots.
24
58
* For any VM which was already initialized before the operation (booted at least once before):
25
59
* 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
59
93
:::
60
94
61
95
The certificates are stored at several levels:
96
+
***bundled** in the varstored package and managed by XCP-ng updates,
62
97
***pool** level (in the XAPI database),
63
98
* host **disk** (it basically mirrors the certificates in the XAPI database),
64
99
***VM** level (in the VM's UEFI variable store).
@@ -79,37 +114,60 @@ At the VM level:
79
114
80
115
## Configure the Pool
81
116
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.
83
118
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).
85
122
86
123
For custom certificates (advanced use), see [Install Custom UEFI Certificates](#install-custom-uefi-certificates)
87
124
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
+
:::
89
130
90
131
`secureboot-certs` supports installing a default set of certificates across the pool.
91
132
92
133
Except the `PK` key which is already provided by XCP-ng, all certificates are downloaded from official sources (`microsoft.com` and `uefi.org`).
| 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`|
100
143
| 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`|
| 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:
104
160
105
161
```
106
-
# Download and install PK/KEK/db/dbx certificates
162
+
# Download and install PK/KEK/db/dbx certificates (varstored < 1.2.0-2.4)
# Reinstall and lock built-in PK/KEK/db/dbx variables (varstored >= 1.2.0-2.4)
112
167
secureboot-certs install
168
+
169
+
# Go back to XCP-ng-managed defaults (varstored >= 1.2.0-2.4)
170
+
secureboot-certs clear
113
171
```
114
172
115
173
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"
120
178
121
179
If this still fails, check the next section which explains how to install them manually.
122
180
123
-
### Install the Default UEFI Certificates Manually
181
+
### Install the Default UEFI Certificates Manually (varstored < 1.2.0-2.4)
124
182
125
183
* 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`).
126
184
* Transfer the files to your master host.
@@ -158,25 +216,38 @@ Advanced use, not needed by most users.
158
216
For example, to install a custom PK you may do the following:
159
217
160
218
```
161
-
# Enroll it, along with the default certificates, with secureboot-certs
# Enroll a custom PK along with the default KEK/db/dbx
220
+
secureboot-certs install PK.cer
163
221
```
164
222
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.
166
224
167
225
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.
168
226
169
227
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.
170
228
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:
172
233
173
234
```
174
-
# Download and install PK/KEK/db certificates, omit the dbx
235
+
# Install default PK/KEK/db variables, omit the dbx
For help with the tool's install functionality, call `secureboot-certs install -h`.
179
240
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
+
180
251
## Enable Secure Boot for a Guest VM
181
252
182
253
### Enable Secure Boot at VM creation
@@ -295,11 +366,11 @@ When there are security concerns related to some of the certificates involved in
295
366
296
367
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.
297
368
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.
300
371
* Any new VM will use the updated certificate databases the first time it starts.
301
372
* 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).
303
374
304
375
### VMs that won't boot due to a revoked certificate
305
376
@@ -507,7 +578,7 @@ Advanced use, not needed by most users.
507
578
508
579
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.
509
580
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`:
0 commit comments