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,26 +4,60 @@ 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 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
+
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
:::warning
15
41
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).
16
42
:::
17
43
18
44
Note: it's not necessary that the XCP-ng host boots in UEFI mode for Secure Boot to be enabled on VMs.
19
45
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.
21
55
22
56
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.
23
57
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.
25
59
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).
27
61
* From now on, any new UEFI VM will be initialized with these certificates, the first time it boots.
28
62
* For any VM which was already initialized before the operation (booted at least once before):
29
63
* 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
63
97
:::
64
98
65
99
The certificates are stored at several levels:
100
+
***bundled** in the varstored package and managed by XCP-ng updates,
66
101
***pool** level (in the XAPI database),
67
102
* host **disk** (it basically mirrors the certificates in the XAPI database),
68
103
***VM** level (in the VM's UEFI variable store).
@@ -83,37 +118,60 @@ At the VM level:
83
118
84
119
## Configure the Pool
85
120
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.
87
122
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).
89
126
90
127
For custom certificates (advanced use), see [Install Custom UEFI Certificates](#install-custom-uefi-certificates)
91
128
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
+
:::
93
134
94
135
`secureboot-certs` supports installing a default set of certificates across the pool.
95
136
96
137
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`|
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`|
104
147
| 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`|
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:
108
164
109
165
```
110
-
# Download and install PK/KEK/db/dbx certificates
166
+
# 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)
116
171
secureboot-certs install
172
+
173
+
# Go back to XCP-ng-managed defaults (varstored >= 1.2.0-2.4)
174
+
secureboot-certs clear
117
175
```
118
176
119
177
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"
124
182
125
183
If this still fails, check the next section which explains how to install them manually.
126
184
127
-
### Install the Default UEFI Certificates Manually
185
+
### Install the Default UEFI Certificates Manually (varstored < 1.2.0-2.4)
128
186
129
187
* 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`).
130
188
* Transfer the files to your master host.
@@ -162,25 +220,38 @@ Advanced use, not needed by most users.
162
220
For example, to install a custom PK you may do the following:
163
221
164
222
```
165
-
# Enroll it, along with the default certificates, with secureboot-certs
# Enroll a custom PK along with the default KEK/db/dbx
224
+
secureboot-certs install PK.cer
167
225
```
168
226
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.
170
228
171
229
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.
172
230
173
231
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.
174
232
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:
176
237
177
238
```
178
-
# Download and install PK/KEK/db certificates, omit the dbx
239
+
# Install default PK/KEK/db variables, omit the dbx
For help with the tool's install functionality, call `secureboot-certs install -h`.
183
244
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
+
184
255
## Enable Secure Boot for a Guest VM
185
256
186
257
### Enable Secure Boot at VM creation
@@ -299,11 +370,11 @@ When there are security concerns related to some of the certificates involved in
299
370
300
371
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.
301
372
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.
304
375
* Any new VM will use the updated certificate databases the first time it starts.
305
376
* 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).
307
378
308
379
### VMs that won't boot due to a revoked certificate
309
380
@@ -511,7 +582,7 @@ Advanced use, not needed by most users.
511
582
512
583
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.
513
584
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`:
0 commit comments