Abstract
Secure boot is a security standard developed by members of the PC industry to help make sure that a device boots using only software that is trusted by the Original Equipment Manufacturer (OEM). When the PC starts, the firmware checks the signature of each piece of boot software, including UEFI firmware drivers (also known as Option ROMs), EFI applications, and the operating system. If the signatures are valid, the PC boots, and the firmware gives control to the operating system.
Implementing Secure Boot
Disclaimer
I am not responsible for any hardware bricks. You do it on yourself, you agree to be responsible on what you do.
Before you do anything
Install efitools
package as it will be needed throughout the tutorial. You also have to install sbsigntools
and openssl
as it’ll be needed for the tutorial. Make sure your Secure Boot is still disabled and you have done nothing to it aside from disabling it.
Backup all old stuffs
Create your own keys
You’ll find these kinds of file: .key, .crt, .cer, .esl, .auth commonly throughout the tutorial.
As per Arch Wiki’s reference:
.key
: PEM format private keys for EFI binary and EFI signature list signing..crt
: PEM format certificates forsbsign
,sbvarsign
andsign-efi-sig-list
..cer
: DER format certificates for firmware..esl
: Certificates in an EFI Signature List forsbvarsign
,efi-updatevar
, KeyTool and firmware..auth
: Certificates in an EFI Signature List with an authentication header (i.e. a signed certificate update file) forefi-updatevar
,sbkeysync
, KeyTool and firmware.
First, create a GUID for owner identification:
Platform Key:
Sign an empty file to allow removing Platform Key when in “User Mode”:
Key Exchange Key:
Signature Database Key:
Optional: Adding Microsoft keys
This is useful when you’re dualbooting Windows.
Download this stuffs and copy it to the SB folder we made previously:
- Microsoft Windows Production PCA 2011 for Windows
- Microsoft Corporation UEFI CA 2011 for third-party binaries like UEFI drivers, option ROMs etc.
Create EFI Signature Lists from Microsoft’s DER format certificates using Microsoft’s GUID (77fa9abd-0359-4d32-bd60-28f4e78f784b
) and combine them in one file for simplicity:
Sign a db update with your KEK. Use sign-efi-sig-list
with option -a
to add not replace a db certificate:
Reinstalling GRUB
There are some issues in Arch’s GRUB currently that throws Error : verification requested but nobody cares.
and to fix that, you need to reinstall GRUB first with tpm
module and shim lock disabled:
Change your-esp to, well, your esp path.
See references for more info.
Signing EFI binaries
Change accordingly into your esp partition path e.g mine’s /boot/EFI and your EFI path.
Prepare pacman hook for automatic kernel signing
Edit /etc/pacman.d/hooks/90-mkinitcpio-install.hook
and replace:
with:
Edit /usr/local/share/libalpm/scripts/mkinitcpio-install
and replace:
with:
Put your firmware to “Setup Mode”
Go to firmware settings and erase all certificates. This will put Secure Boot into setup mode. You can verify that by booting to the OS and run bootctl status
.
Enroll your keys
Create the necessary folders then get in to the SB directory we created previously (since you’re rebooting, duh):
Then copy all the .auth
files into their respective directory:
See what changes will sbkeysync
shall do to your system’s UEFI keystore:
Before enrolling, change efivars file attributes so that no write errors are present using:
Finally, use sbkeysync
to enroll your keys.
We’re not enrolling the PK yet, so in order to avoid some invalid arguments issues, use efi-updatevar
instead:
If you got write errors when doing
efi-updatevar
then dosudo chattr -i /sys/firmware/efi/efivars/{PK,KEK,db}*
once again before enrolling PK.
After enrolling your PK, Secure Boot will enter “User Mode” again.
Finishing Touch
After all the hassles, you might want to get into your firmware settings and enable Secure Boot. Try booting your Arch Linux now with Secure Boot enabled. It should be all good.
Verdict
Well, no more words to say. Enjoy playing Valorant if you have Windows 11 installed!