diff options
author | Lans Zhang <jia.zhang@windriver.com> | 2017-07-13 14:06:28 +0800 |
---|---|---|
committer | Lans Zhang <jia.zhang@windriver.com> | 2017-07-13 15:28:43 +0800 |
commit | e203bcf9a126e6e52556edbb0773b541607ecfda (patch) | |
tree | aa46768bc58027b69df5bb8b98a2f6886ff07c35 | |
parent | a93ddfe82d7c2f8383fe51018f6e6ece72094186 (diff) | |
download | meta-secure-core-e203bcf9a126e6e52556edbb0773b541607ecfda.tar.gz |
meta-efi-secure-boot/README.md: update
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
-rw-r--r-- | meta-efi-secure-boot/README.md | 296 |
1 files changed, 162 insertions, 134 deletions
diff --git a/meta-efi-secure-boot/README.md b/meta-efi-secure-boot/README.md index 12a0c3d..50f78ff 100644 --- a/meta-efi-secure-boot/README.md +++ b/meta-efi-secure-boot/README.md | |||
@@ -1,36 +1,35 @@ | |||
1 | ### EFI secure boot feature | 1 | ### Overview |
2 | This feature consists of two widely used secure boot technologies: UEFI Secure | 2 | This layer consists of two widely used secure boot technologies: UEFI Secure |
3 | Boot and MOK Secure Boot. | 3 | Boot and MOK (Machine Owner Key) Secure Boot. |
4 | 4 | ||
5 | - UEFI Secure Boot is the industry standard defined in the UEFI spec, allowing the | 5 | - UEFI Secure Boot is the industry standard defined in the UEFI spec, allowing |
6 | images loaded by UEFI BIOS to be verified with the certificates corresponding to | 6 | the images loaded by UEFI firmware to be verified with the certificates |
7 | the trusted keys. | 7 | corresponding to the trusted keys. |
8 | - MOK (Machine Owner Key) Secure Boot is based on UEFI Secure Boot, adding | 8 | - MOK Secure Boot is based on UEFI Secure Boot, adding the shim bootloader to |
9 | the shim bootloader to chainloader the next stage bootloader with the integrity | 9 | chainloader the next stage bootloader with the integrity check using the |
10 | check using the shim-managed certificates corresponding to another set of | 10 | shim-managed certificates corresponding to another set of trusted keys, which |
11 | trusted keys which may be different than the trusted keys used by UEFI Secure | 11 | may be different than the trusted keys used by UEFI Secure Boot. |
12 | Boot. | 12 | |
13 | 13 | In addition, this layer introduces the SELoader as the second-stage bootloader | |
14 | In addition, this feature introduces the SELoader as the second-stage bootloader | ||
15 | and eventually chainliader to the third-stage bootloader "grub". With the | 14 | and eventually chainliader to the third-stage bootloader "grub". With the |
16 | extension provided by SELoader, grub configuration files, kernel (even without | 15 | extension provided by SELoader, grub configuration files, kernel (even without |
17 | EFI stub support) and initrd can be authenticated. This capability is not | 16 | EFI stub support) and initrd can be authenticated. This capability is not |
18 | available in the shim bootloader. | 17 | available in the shim bootloader. |
19 | 18 | ||
20 | Grub bootloader is enhanced to support lockdown mode. In this mode, the | 19 | Grub bootloader is also enhanced to support lockdown mode. In this mode, the |
21 | edit, rescue and command line are protected in order to prevent from | 20 | edit, rescue and command line are protected in order to prevent from |
22 | tampering the kernel commandline or loading an unsigned boot component. Hence, | 21 | tampering the kernel command line or loading an unsigned boot component. Hence, |
23 | this lockdown protection can effectively defeat the attempts to disable the | 22 | this lockdown protection can effectively defeat the attempts to disable the |
24 | kernel security mechanisms. The flexibility is also provided if the user | 23 | kernel security mechanisms, e.g, globally disable SELinux or IMA. The |
25 | authentication is enabled. The user authenticated by a password check can enter | 24 | flexibility is also provided with the user authentication in grub. The user |
26 | into edit and command line. | 25 | authenticated by a password check can enter into edit and command line. |
27 | 26 | ||
28 | Therefore, using UEFI Secure Boot, SELoader, and grub lockdown together, the | 27 | Therefore, using UEFI Secure Boot, shim, SELoader, and grub lockdown together, |
29 | boot process is completely trustworthy. | 28 | the boot process is completely trustworthy. |
30 | 29 | ||
31 | A complete boot flow with this feature is: | 30 | A complete boot flow looks like as following: |
32 | 31 | ||
33 | - UEFI BIOS boot manager (UEFI Secure Boot enabled) -> | 32 | - UEFI firmware boot manager (UEFI Secure Boot enabled) -> |
34 | - shim (verified by a DB certificate) -> | 33 | - shim (verified by a DB certificate) -> |
35 | - SELoader (verified by a shim-managed certificate) -> | 34 | - SELoader (verified by a shim-managed certificate) -> |
36 | - grub (verified by a shim-managed certificate) -> | 35 | - grub (verified by a shim-managed certificate) -> |
@@ -38,38 +37,39 @@ A complete boot flow with this feature is: | |||
38 | - kernel (verified by a shim-managed certificate) | 37 | - kernel (verified by a shim-managed certificate) |
39 | - initramfs (verified by a shim-managed certificate) | 38 | - initramfs (verified by a shim-managed certificate) |
40 | 39 | ||
41 | ### Quick start for the first boot | 40 | ### Quick Start For The First Boot |
42 | - Deploy the rootfs | 41 | - Deploy the rootfs |
43 | 42 | ||
44 | - Boot up the target board | 43 | - Power up the system |
45 | 44 | ||
46 | - Enter to BIOS setup and remove the enrolled certificates | 45 | - Enter to BIOS setup and remove the enrolled certificates |
47 | * It is recommended to still turn on UEFI Secure Boot option if allowed. | 46 | * It is recommended to still turn on UEFI Secure Boot option if allowed. |
48 | 47 | ||
49 | - Exit BIOS setup and automatically reboot | 48 | - Exit BIOS setup |
50 | 49 | ||
51 | - Manually launch a reboot via ctrl + alt + del again | 50 | - Manually launch a reboot immediately via Ctrl + Alt + Del |
52 | * Otherwise, a misleading error message about the verification failure | 51 | * Otherwise, a misleading error message about the verification failure |
53 | will be displayed. | 52 | will be displayed. |
54 | 53 | ||
55 | - Automatically boot to the boot option "Automatic Certificate Provision" in | 54 | - Automatically boot to the boot option "Automatic Certificate Provision" in |
56 | grub boot menu. | 55 | grub boot menu. |
57 | 56 | ||
58 | - (Optional) Enter into BIOS setup to turn on UEFI Secure Boot option | 57 | - (Optional) Enter to BIOS setup to turn on UEFI Secure Boot option and then |
58 | exit BIOS setup | ||
59 | 59 | ||
60 | - Boot to the system with the protection provided by UEFI and MOK Secure Boot | 60 | - Boot to the system with the protection provided by UEFI and MOK Secure Boot |
61 | 61 | ||
62 | ### Key Management | 62 | ### Key Management |
63 | Refer to meta-signing-key/README.md for the initial cognition about key | 63 | Refer to meta-signing-key/README.md for the initial cognition about key |
64 | management for UEFI Secure Boot. | 64 | management. |
65 | 65 | ||
66 | Note that the sample key and user key are the concepts in the key signing | 66 | Note that the sample key and user key are the concepts in the key signing |
67 | model according to the ownership and secrecy. In UEFI Secure Boot, a policy | 67 | model according to the ownership and secrecy. In UEFI Secure Boot, a policy |
68 | object such as PK, KEK, DB and DBX is mapped to a key managed by the key | 68 | object such as PK, KEK, DB and DBX is always mapped to a key useed by the |
69 | signing model. | 69 | key signing model. |
70 | 70 | ||
71 | #### Sample Keys | 71 | #### Sample Keys |
72 | This feature, by default, use **the sample keys** to sign and verify images for | 72 | This layer, by default, use **the sample keys** to sign and verify images for |
73 | the purpose of development and demonstration. **Please ensure you know what your | 73 | the purpose of development and demonstration. **Please ensure you know what your |
74 | risk is to use the sample keys in your product, because they are completely | 74 | risk is to use the sample keys in your product, because they are completely |
75 | public.** | 75 | public.** |
@@ -78,14 +78,14 @@ The sample keys used for UEFI Secure Boot are centrally placed under | |||
78 | meta-signing-key/files/uefi_sb_keys/. | 78 | meta-signing-key/files/uefi_sb_keys/. |
79 | 79 | ||
80 | - PK.crt | 80 | - PK.crt |
81 | The X509 certificate enrolled to UEFI BIOS, used to update/delete PK/KEK. | 81 | The X509 certificate enrolled to UEFI firmware, used to update/delete PK/KEK. |
82 | 82 | ||
83 | - PK.key | 83 | - PK.key |
84 | The private key corresponding to PK.crt, used to sign the EFI signature | 84 | The private key corresponding to PK.crt, used to sign the EFI signature |
85 | list for PK/KEK enrollment. | 85 | list for PK/KEK enrollment. |
86 | 86 | ||
87 | - KEK.crt | 87 | - KEK.crt |
88 | The X509 certificate enrolled to UEFI BIOS, used to update/delete | 88 | The X509 certificate enrolled to UEFI firmware, used to update/delete |
89 | DB/DBX. | 89 | DB/DBX. |
90 | 90 | ||
91 | - KEK.key | 91 | - KEK.key |
@@ -93,17 +93,17 @@ meta-signing-key/files/uefi_sb_keys/. | |||
93 | list for DB/DBX enrollment. | 93 | list for DB/DBX enrollment. |
94 | 94 | ||
95 | - DB.crt | 95 | - DB.crt |
96 | The X509 certificate enrolled to UEFI BIOS, used to verify the images | 96 | The X509 certificate enrolled to UEFI firmware, used to verify the images |
97 | directly loaded by UEFI BIOS. | 97 | directly loaded by UEFI firmware. |
98 | 98 | ||
99 | - DB.key | 99 | - DB.key |
100 | The private key corresponding to DB.crt, used to sign the images directly | 100 | The private key corresponding to DB.crt, used to sign the images directly |
101 | loaded by UEFI BIOS. | 101 | loaded by UEFI firmware. |
102 | 102 | ||
103 | - DBX | 103 | - DBX |
104 | This directory contains any number of X509 certificate enrolled to UEFI | 104 | This directory contains any number of X509 certificate enrolled to UEFI |
105 | BIOS, used to blacklist the revoked certificates. The revoked certificates | 105 | firmware, used to blacklist the revoked certificates. Note the revoked |
106 | must be PEM-formatted. | 106 | certificates must be PEM-formatted. |
107 | 107 | ||
108 | The sample keys used for MOK Secure Boot are centrally placed under | 108 | The sample keys used for MOK Secure Boot are centrally placed under |
109 | `meta-signing-key/files/mok_sb_keys/`. | 109 | `meta-signing-key/files/mok_sb_keys/`. |
@@ -117,13 +117,13 @@ The sample keys used for MOK Secure Boot are centrally placed under | |||
117 | either directly or indirectly loaded by shim. | 117 | either directly or indirectly loaded by shim. |
118 | 118 | ||
119 | - vendor_cert.crt | 119 | - vendor_cert.crt |
120 | Used in the same way as shim_cert.crt. In addition, vendor certificate | 120 | Act as the same way as shim_cert.crt. In addition, vendor certificate |
121 | is the switch to enable shim verification protocol, which facilitates | 121 | is the switch to enable MOK Verify Protocol, which facilitates the |
122 | the verification for the SELoader. | 122 | verification for the SELoader and MOK Manager. |
123 | 123 | ||
124 | - vendor_cert.key | 124 | - vendor_cert.key |
125 | The private key corresponding to vendor_cert.crt, Same fuction as | 125 | The private key corresponding to vendor_cert.crt, acting as the same fuction |
126 | shim_cert.key. | 126 | as shim_cert.key. |
127 | 127 | ||
128 | - vendor_dbx | 128 | - vendor_dbx |
129 | This directory contains any number of X509 certificate embedded in shim, | 129 | This directory contains any number of X509 certificate embedded in shim, |
@@ -135,139 +135,160 @@ the keys owned by the end user. | |||
135 | 135 | ||
136 | #### Automatic Certificate Provision | 136 | #### Automatic Certificate Provision |
137 | The certificate provision is required to enable UEFI Secure Boot. By default, | 137 | The certificate provision is required to enable UEFI Secure Boot. By default, |
138 | the target may be provisioned with the default certificates enrolled during the | 138 | the system may be already provisioned with default certificates enrolled during |
139 | manufacture. | 139 | the manufacture. |
140 | 140 | ||
141 | In order to use the bootloader and kernel signed by the sample or self-owned | 141 | In order to use the bootloader and kernel signed by the sample or self-owned |
142 | key to boot up the system, this feature provides a process of autmatic | 142 | key to boot up the system, this layer provides a process of automatic |
143 | certificate provison for the convenience. Refer to the instructions listed in | 143 | certificate provison for the convenience. The detailed descriptions are |
144 | the section "Work Flow For The First Boot". The detailed descriptions are | ||
145 | given below. | 144 | given below. |
146 | 145 | ||
147 | ##### Remove the enrolled certificates in BIOS setup | 146 | ##### Remove the enrolled certificates in BIOS setup |
148 | The LockDown.efi application is used to run the provision. However, | 147 | The EFI/BOOT/LockDown.efi is used to run the automatic certificate provision. |
149 | LockDown.efi cannot be launched if UEFI Secure Boot is already enabled. In | 148 | However, LockDown.efi cannot be launched if UEFI Secure Boot is already |
150 | addition, the enrolled certificates may be not the ones the user hopes to use. | 149 | enabled. In addition, the enrolled certificates may be not the ones the user |
150 | hopes to use. | ||
151 | 151 | ||
152 | The provisioned certificates can be removed in BIOS setup. The detailed steps | 152 | The provisioned certificates can be removed through BIOS setup. The detailed |
153 | may vary between the boards. Refer to BIOS manual for the details. | 153 | steps may vary between the systems. Refer to the corresponding BIOS manual for |
154 | the instructions. | ||
154 | 155 | ||
155 | ##### Launch the automatic provision | 156 | ##### Launch the automatic certificate provision |
156 | Lockdown.efi will automatically provision UEFI Secure Boot after removing the | 157 | The Lockdown.efi will automatically provision UEFI Secure Boot after removing |
157 | the provisioned certificates in BIOS setup. More specifically, the PK, KEK, | 158 | the enrolled certificates in BIOS setup. More specifically, the new PK, KEK, DB |
158 | DB and DBX (if any) will be enrolled and begin to take affect after a reboot. | 159 | and DBX (if any) will be enrolled and begin to take affect after a reboot. |
160 | |||
161 | The new PK, KEK, DB and DBX (if any) were built into LockDown.efi during the | ||
162 | build. | ||
159 | 163 | ||
160 | ##### Turn on UEFI Secure Boot option | 164 | ##### Turn on UEFI Secure Boot option |
161 | If UEFI Secure Boot option is turned off, the user has to enter into BIOS setup | 165 | If UEFI Secure Boot option was turned off, the user has to enter to BIOS setup |
162 | after provision to manually turn on the option. | 166 | again after the automatic certificate provision in order to manually turn on |
167 | this option. | ||
163 | 168 | ||
164 | If the option is already enabled when removing the enrolled certificates in | 169 | If this option was not turned off when removing the enrolled certificates in |
165 | BIOS setup, this step can be ignored. | 170 | BIOS setup, this step is skippable. |
166 | 171 | ||
167 | ##### Re-trigger automatic provision | 172 | ##### Re-trigger automatic certificate provision |
168 | By default, the "Automatic Certificate Provision" option is hidden in boot | 173 | The boot option "Automatic Certificate Provision" is hidden in grub boot menu |
169 | menu for the first boot. If the user would like to clear the certificates | 174 | for the first boot. If the user would like to clear the certificates |
170 | provisioned by the "Automatic Certificate Provision" option in BIOS setup, this | 175 | provisioned by the option "Automatic Certificate Provision" in BIOS setup, this |
171 | hidden boot option will be shown in boot menu, allowing to re-trigger it when | 176 | hidden boot option will be shown, allowing to re-trigger it if necessary. |
172 | necessary. | ||
173 | 177 | ||
174 | ### Signing | 178 | ### Signing |
175 | By default, the build system uses DB.key to sign shim, and uses vendor_cert.key | 179 | By default, the build system uses DB.key to sign shim, and uses vendor_cert.key |
176 | to sign SELoader, grub, grub configuration file, kernel and initramfs image | 180 | to sign SELoader, grub, grub configuration file, kernel and initramfs image |
177 | during the build. | 181 | during the build. |
178 | 182 | ||
179 | ### Verficiation | 183 | ### Verification |
180 | 184 | ||
181 | #### UEFI Secure Boot Verification | 185 | #### UEFI firmware verification |
182 | UEFI BIOS will validate the integrity of shim bootloader with a certificate in | 186 | UEFI firmware will validate the integrity of shim bootloader with a certificate |
183 | DB before running it. | 187 | in DB before launching it. |
184 | 188 | ||
185 | #### Bootloader Verification | 189 | #### Bootloader verification |
186 | When the shim loads SELoader and SELoader loads grub, if both UEFI Secure Boot | 190 | This layer employs 3-level bootloader for secure boot process. Each former |
187 | and MOK Secure Boot are already enabled, the upper bootloader uses a list of | 191 | bootloader must check the integrity e.g, when the |
188 | certificate to check the integrity of lower bootloader. | 192 | SELoader loads grub, if both UEFI Secure Boot and MOK Secure Boot are already |
193 | enabled, the former bootloader uses a list of certificate to check the | ||
194 | integrity of the later bootloader. | ||
189 | 195 | ||
190 | - Blacklist check | 196 | - Blacklist check |
191 | If the lower bootloader is signed with a key corresponding to a certificate | 197 | If the later bootloader is signed with a key corresponding to a certificate |
192 | within any of a policy object below, the boot failure will occur. | 198 | within any of a policy object below, the later bootloader is denied to |
199 | launch immediately, without the necessity to go through the following | ||
200 | processes. | ||
193 | 201 | ||
194 | * Vendor DBX | 202 | * Vendor DBX |
195 | * DBX | 203 | * DBX |
196 | * MokListX (MOK certificate blacklist) | 204 | * MokListX (the blacklist of MOK certificate) |
197 | 205 | ||
198 | - Whitelist check | 206 | - Whitelist check |
199 | If the lower bootloader is signed with a key corresponding to a certificate | 207 | If the later bootloader is signed with a key corresponding to a certificate |
200 | within any of a policy object below, the boot success will occur. | 208 | within any of a policy object below, the later bootloader is granted to |
209 | launch. | ||
201 | 210 | ||
202 | * DB | 211 | * DB |
203 | * MokList (MOK certificate whitelist) | 212 | * MokList (the whitelist of MOK certificate) |
204 | * Shim certificate (only for PE image) | 213 | * Shim certificate (only for PE image) |
205 | * Vendor certificate | 214 | * Vendor certificate |
206 | 215 | ||
207 | If the lower bootloader is not signed or signed by a key not corresponding to | 216 | If the later bootloader is not signed or signed by a key not corresponding to |
208 | any policy objects mentioned above, the boot failure will occur. | 217 | any policy objects mentioned above, the later bootloader is denied to launch. |
209 | 218 | ||
210 | The benefit of these behaviors allow the end user to regulate the secure boot | 219 | The benefit of showing this checklist allows the end user to use an |
211 | even without the ownership of DB on Microsoft certificated hardware. | 220 | appropriater way to manage the key and boot up the system, even without the |
221 | ownership of a signing key, such as the DB key widely used on Microsoft | ||
222 | certificated hardware. | ||
212 | 223 | ||
213 | ##### SELoader Verification | 224 | ##### SELoader verification |
214 | The SELoader is designed to authenticate the non-PE files, such as grub.cfg, | 225 | The SELoader is designed to authenticate the non-PE files, such as grub.cfg, |
215 | kernel (without EFI stub support) and initrd, which cannot be verified by | 226 | kernel (without EFI stub support) and initramfs, which cannot be verified by |
216 | the verification protocol registered by the shim loader. | 227 | the MOK Verify Protocol registered by the shim loader. |
217 | 228 | ||
218 | In order to conveniently authenticate the PE file with gBS->LoadImage() | 229 | In order to conveniently authenticate the PE file with gBS->LoadImage() |
219 | and gBS->StartImage(), the SELoader hooks EFI Security2 Architectural | 230 | and gBS->StartImage(), the SELoader hooks EFI Security2 Architectural |
220 | Protocol and employs verification protocol provided by the shim loader to | 231 | Protocol and employs MOK Verify Protocol to verify the PE file. If only |
221 | verify the PE file. If only UEFI Secure Boot is enabled, the SELoader just | 232 | UEFI Secure Boot is configured and enabled, the SELoader just simplily calls |
222 | simplily calls gBS->LoadImage() and gBS->StartImage() to allow UEFI BIOS | 233 | gBS->LoadImage() and gBS->StartImage() to allow UEFI firmware to verify the |
223 | to verify the PE file. | 234 | PE file. |
224 | 235 | ||
225 | The SELoader publishes MOK2 verification protocol which provides a flexible | 236 | The SELoader publishes MOK2 Verify Protocol which provides a flexible interface |
226 | interface to allow the bootloader to verify the file, file buffer or | 237 | to allow the bootloader to verify the file, file buffer or memory buffer |
227 | memory buffer without knowing the file format. | 238 | without knowing the file format. This design allows the non-PE files to be |
239 | verified by the same certificate used for authenticating PE files. | ||
228 | 240 | ||
229 | In order to establish the chain of trust, the SELoader is required to be | 241 | In order to establish the chain of trust, the SELoader is required to be |
230 | signed by a private key corresponding to a DB certificate, the shim | 242 | signed by a private key corresponding to a DB certificate, the shim |
231 | certificate, the vendor certificate or a MOK certificate. The specific | 243 | certificate, the vendor certificate or a MOK certificate mentioned above. |
232 | key is determined by the secure boot scheme you will use. | 244 | The specific key used is determined by the secure boot scheme you will use. |
233 | 245 | ||
234 | See more details about the SELoader in its README file. | 246 | See more details about README in SELoader. |
235 | 247 | ||
236 | #### Grub Configuration File Verification | 248 | #### Grub configuration file verification |
237 | Grub can call the MOK2 verification protocol registered by the SELoader | 249 | Grub is enhanced to have the capability of calling MOK2 Verify Protocol |
238 | to validate the integrity of grub configuration file before parsing it. | 250 | registered by the SELoader to validate the integrity of grub configuration |
251 | file before parsing it. | ||
239 | 252 | ||
240 | This protection prevents from tampering the grub configuration file from | 253 | This protection prevents from tampering the grub configuration file from |
241 | disabling certains kernel security mechanism such as selinux, IMA and so on. | 254 | globally disabling certains kernel security mechanism such as SELinux and IMA |
255 | which are activated in kernel command line. | ||
242 | 256 | ||
243 | #### Kernel Verification | 257 | #### Kernel verification |
244 | When SELoader loads the kernel image with the linux command, if both UEFI | 258 | When grub loads the kernel image with the command "linux", if both UEFI |
245 | Secure Boot and MOK Secure Boot are already enabled, grub will call the | 259 | Secure Boot and MOK Secure Boot are already enabled, grub will call the |
246 | verification protocol installed by SELoader to validate the kernel image. | 260 | MOK2 Verify Protocol installed by SELoader to validate the kernel image. |
247 | 261 | ||
248 | Alternately, if grub loads the kernel image with the chainloader command, | 262 | It is recommended to avoid using the command "chainloader" to load kernel |
249 | if both UEFI Secure Boot and MOK Secure Boot are already enabled, grub will | 263 | image. The build system also avoids signing the kernel with EFI-stub |
250 | call the verification protocol installed by shim to validate the kernel image. | 264 | bootloader. |
251 | 265 | ||
252 | By default, the kernel image is signed by vendor certificate and then signed | 266 | By default, the kernel image is signed by vendor certificate and generate |
253 | again to generate the .p7b signature file. | 267 | the .p7b signature file. |
254 | 268 | ||
255 | #### Initramfs Verification | 269 | #### Initramfs verification |
256 | When SELoader loads the kernel image with the initrd command, if both UEFI | 270 | When grub loads the kernel image with the command "initrd", if both UEFI |
257 | Secure Boot and MOK Secure Boot are already enabled, grub will call the | 271 | Secure Boot and MOK Secure Boot are already enabled, grub will call the |
258 | verification protocol installed by SELoader to validate the initramfs image. | 272 | MOK2 Verify Protocol installed by SELoader to validate the initramfs image. |
273 | |||
274 | By default, the initramfs image is signed by vendor certificate and generate | ||
275 | the .p7b signature file. | ||
259 | 276 | ||
260 | #### Verification Failure | 277 | #### Verification failure |
261 | Either situation will cause a failure of verification. | 278 | Either situation will cause a failure of verification. |
262 | - A boot component is not signed. | 279 | - A boot component is not signed. |
263 | - A boot component is signed by a key which doesn't correspond to any | 280 | - A boot component is signed by a key which doesn't correspond to any |
264 | certificate in whitelists such as DB and shim-managed certificates. | 281 | certificate in whitelists such as DB and shim-managed certificates as |
282 | mentioned above. | ||
265 | - A boot component is signed by a key which corresponds to a certificate in | 283 | - A boot component is signed by a key which corresponds to a certificate in |
266 | blacklist such as DBX and shim-managed certificates in MOKX. | 284 | blacklist such as DBX and shim-managed certificates in blacklist as |
285 | mentioned above. | ||
267 | 286 | ||
268 | Each boot component may have different verification failure phenomenon. | 287 | Each boot component may have different verification failure phenomenon. |
269 | - If SELoader fails signature check, UEFI BIOS boot manager will print an error | 288 | - If shim fails signature check, UEFI firmware boot manager will print an |
270 | message about the image authentication failure. | 289 | error message about the image authentication failure. |
290 | - If SELoader fails signature check, shim will print an error message about | ||
291 | the security violation. | ||
271 | - If grub fails signature check, an image authentication failure message is | 292 | - If grub fails signature check, an image authentication failure message is |
272 | printed and the system hangs. | 293 | printed and the system hangs. |
273 | - If a grub configuration file fails the signature check, an authentication | 294 | - If a grub configuration file fails the signature check, an authentication |
@@ -276,11 +297,11 @@ Each boot component may have different verification failure phenomenon. | |||
276 | - If initrd fails signature check, grub returns back to the boot menu. | 297 | - If initrd fails signature check, grub returns back to the boot menu. |
277 | 298 | ||
278 | ### MOK Secure Boot and the shim bootloader | 299 | ### MOK Secure Boot and the shim bootloader |
279 | MOK (Machine Owner Key) Secure Boot is based on UEFI Secure Boot, adding | 300 | MOK Secure Boot is based on UEFI Secure Boot, adding the shim bootloader to |
280 | the shim bootloader to chainloader the second-stage bootloader | 301 | chainloader the second-stage bootloader "SELoader" and eventually chainliader |
281 | "SELoader" and eventually chainliader to the third-stage bootloader "grub". | 302 | to the third-stage bootloader "grub". |
282 | 303 | ||
283 | [ Quoting: https://github.com/rhinstaller/shim ] | 304 | [ Quoting: https://github.com/rhboot/shim ] |
284 | shim is a trivial EFI application that, when run, attempts to open and | 305 | shim is a trivial EFI application that, when run, attempts to open and |
285 | execute another application. It will initially attempt to do this via the | 306 | execute another application. It will initially attempt to do this via the |
286 | standard EFI LoadImage() and StartImage() calls. If these fail (because secure | 307 | standard EFI LoadImage() and StartImage() calls. If these fail (because secure |
@@ -306,13 +327,13 @@ by Microsoft. Microsoft provides the signing service (not free), but only | |||
306 | accept shim bootloader for Linux world. Refer to [Microsoft's signing policy](http://blogs.msdn.com/b/windows_hardware_certification/archive/2013/12/03/microsoft-uefi-ca-signing-policy-updates.aspx). | 327 | accept shim bootloader for Linux world. Refer to [Microsoft's signing policy](http://blogs.msdn.com/b/windows_hardware_certification/archive/2013/12/03/microsoft-uefi-ca-signing-policy-updates.aspx). |
307 | 328 | ||
308 | It is allowed to remove all default certificates and use the self-owned keys to | 329 | It is allowed to remove all default certificates and use the self-owned keys to |
309 | provision UEFI Secure Boot, but this is not practical for ODM/OEM devices | 330 | provision UEFI firmware, but this is not practical for ODM/OEM devices during |
310 | during the manufacture phrase. See the section "Out-of-box Experience". | 331 | the manufacture phrase. See the section "Out-of-box Experience". |
311 | 332 | ||
312 | For a good user experience, shim + SELoader + grub is an excellent combination | 333 | For a good user experience, shim + SELoader + grub is an excellent combination |
313 | to handle Microsoft certificated hardware. With this model, SELoader and grub | 334 | to handle Microsoft certificated hardware. With this model, SELoader and grub |
314 | are signed by a shim-managed certificate without being subject to the limit from | 335 | are signed by a shim-managed certificate without being subject to the limit |
315 | Microsoft's signing policy, and the manual provision is thus unnecessary. | 336 | from Microsoft's signing policy, and the manual provision is thus unnecessary. |
316 | 337 | ||
317 | #### mokutil and MOK Manager | 338 | #### mokutil and MOK Manager |
318 | mokutil is a tool to import or delete the machines owner keys stored in the | 339 | mokutil is a tool to import or delete the machines owner keys stored in the |
@@ -423,23 +444,23 @@ options to change the operation target from MOK to the following options. | |||
423 | --revoke-import | 444 | --revoke-import |
424 | --revoke-delete | 445 | --revoke-delete |
425 | 446 | ||
426 | ##### Handle MOK Secure Boot Failure with MOK Manager | 447 | ##### Handle MOK Secure Boot failure with MOK Manager |
427 | If either grub or SELoader is not signed or signed with an unauthorized | 448 | If either grub or SELoader is not signed or signed with an unauthorized |
428 | certificate, the shim will prompt the end user a UI called MOK manager to | 449 | certificate, the shim will prompt the end user a UI called MOK Manager to |
429 | guide the user to enroll the certificate or hash of the image. | 450 | guide the user to enroll the certificate or hash of the image. |
430 | 451 | ||
431 | The policy of the selection between digest and certificate for next step is | 452 | The policy of the selection between digest and certificate for next step is |
432 | decided by whether the unauthorized grub or SELoader is signed or not. | 453 | decided by whether the unauthorized grub or SELoader is signed or not. |
433 | 454 | ||
434 | If the grub or SELoader is not signed at all, you have to always select | 455 | If the grub or SELoader is not signed at all, you have to always select |
435 | the calculation of the digest based on the file. Note that once grub or SELoader | 456 | the calculation of the digest based on the file. Note that once grub or |
436 | is updated and its digest is changed, you have to relaunch the MOK manager | 457 | SELoader is updated and its digest is changed, you have to relaunch the MOK |
437 | to enroll the new digests. | 458 | Manager to enroll the new digests. |
438 | 459 | ||
439 | If the grub or SELoader is signed by an unauthorized certificate, enrolling the | 460 | If the grub or SELoader is signed by an unauthorized certificate, enrolling the |
440 | signing certificate is the preferred way. Copy the certificate to the boot | 461 | signing certificate is the preferred way. Copy the certificate to the boot |
441 | drive and then select the certificate in MOK manager. Note that the | 462 | drive and then select the certificate in MOK manager. Note that the |
442 | certificate for the selection must be **DER formatted**. | 463 | certificate for the selection must be **DER-formatted**. |
443 | 464 | ||
444 | If doing so, the unauthorized grub or SELoader will be verified successfully | 465 | If doing so, the unauthorized grub or SELoader will be verified successfully |
445 | after exiting MOK Manager. | 466 | after exiting MOK Manager. |
@@ -458,6 +479,13 @@ Rescue mode is always disabled as long as UEFI Secure Boot is enabled. | |||
458 | ### Known Issues | 479 | ### Known Issues |
459 | - The 32-bit MOK Secure Boot is not validated. In other words, loading 32-bit | 480 | - The 32-bit MOK Secure Boot is not validated. In other words, loading 32-bit |
460 | shim, MOK manager, grub and kernel is not supported. | 481 | shim, MOK manager, grub and kernel is not supported. |
482 | - grub module is not supported by SELoader for the integrity check. | ||
461 | 483 | ||
462 | ### Reference | 484 | ### Reference |
463 | [OpenEmbedded layer for EFI secure boot features](https://github.com/jiazhang0/meta-efi-secure-boot) | 485 | [shim - implement MOK Verify Protocol](https://github.com/rhboot/shim) |
486 | |||
487 | [SELoader - implement MOK2 Verify Protocol](https://github.com/jiazhang0/SELoader) | ||
488 | |||
489 | [grub - Mok2Verify patch](https://github.com/jiazhang0/meta-secure-core/blob/master/meta-efi-secure-boot/recipes-bsp/grub/grub-efi/mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch) | ||
490 | |||
491 | [SecureCore - a reference implementation based on OpenEmbedded](https://github.com/jiazhang0/SecureCore) | ||