Lockdown
Lockdown
-
Microsoft and partners design new device security requirements to protect against targeted firmware attacks (David Weston, Microsoft 2019-10-21)
-
The return of the lockdown patches (Jake Edge, LWN 2019-04-03)
- Linux Kernel Lockdown and UEFI Secure Boot (mjg59, 2018-04-04)
- Verifying your system state in a secure and private way (mgj59, 2020-01-20)
Android and Chromebooks
- Android - Verified Boot (2020?)
- Chromium OS - Verified Boot (2009?)
- Chrome OS Verified Boot - Surviving in the Internet of Insecure Things (Randall Spangler, Google)
Configuration guides
- Cryptographically verifying container linux at runtime (mjg59, coreos 2017-01-26)
- Avoiding gaps in IOMMU protection at boot (mjg59, 2020-01-28)
- Linux Integrity Measurement Architecture (IMA) (strongSwan, 2004?)
- Protecting your system from the scum of the universe (Gilad Ben-Yossef, Embedded Linux Conference 2017)
- Integrity Protection Solutions in Linux (Dmitry Kasatkin, Samsung / LinuxCon 2013)
- Managing EFI Boot Loaders for Linux: Controlling Secure Boot (Rod Smith, 2018)
- Take Control of Your PC with UEFI Secure Boot (Greig Paul, Linux Journal 2015)
- The meaning of all the UEFI keys (James Bottomley, 2012)
Roots of Trust
- NIST SP800-193: Platform Firmware Resiliency (NIST, 2019)
- UEFI Secure Boot Chain - Intel Boot Guard (edk2, ?)
- Microsoft "Secured Core" overview
- Titan in depth (Savagankar et al, Google 2017)
- Project Cerberus Hardware Security (Kelly & Edery, Microsoft 2018)
- Apple T2 Security Chip Overview (Apple, 2018)
- Universal Platform Firmware Resiliency (PFR) (Lattice FPGA, 2019)
Secure Boot
Keys
- Converting keys between GnuPG and OpenSSL (Jerome Pouiller, 2010)
- Monkeysphere - extending OpenPGP's web of trust to new areas
yubico-piv-tool -s 9c -a generate -o pubkey.pem # will take a while and overwrite any existing private keys yubico-piv-tool -s 9c -a verify-pin -a selfsign-certificate -S '/OU=test/O=example.com/' -i pubkey.pem -o cert.pem yubico-piv-tool -s 9c -a import-certificate -i cert.pem openssl x509 -outform der -in cert.pem -out cert.crt openssl x509 -in cert.pem -text -noout # display the contents of the PEM file
The DER format cert.crt
is suitable for installing in the UEFI PK/KEK/DB. The cert.pem
will be used for sbsign
to make valid EFI images. This is not the same as the one used to sign kernel modules, which is generated at build time.
The sbsign
tool needs to be built from source to have support for the smart card signing.
sudo apt install libbfd-dev gnu-efi help2man libengine-pkcs11-openssl1.1 git clone https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/ cd sbsigntools ./autogen make -j8
Although this has trouble with pkcs11 keys in the yubikey. It seems that they have to be specified in a weird format:
./src/sbsign \ --engine pkcs11 \ --key 'pkcs11:manufacturer=piv_II;id=%02' \ --cert ../boot/cert.pem \ --output bzImage.signed \ bzImage
Testing secure boot
Build UEFI firmware for qemu with secure boot enabled:
git clone --recursive https://github.com/tianocore/edk2 cd edk2/OvmfPkg ./buildsh -D SECURE_BOOT_ENABLE -D DEBUG_ON_SERIAL_PORT
Test it with:
qemu-system-x86_64 \ -pflash ../Build/OvmfX64/DEBUG_GCC5/FV/OVMF_CODE.fd \ -pflash ../Build/OvmfX64/DEBUG_GCC5/FV/OVMF_VARS.fd \ -serial stdio \ -drive fat:ro:/boot
You can hit Escape while it is booting to go to the setup screen and select the EFI shell.
Notes:
- enrolling keys works (same key for pk, kek and db; need to try hierarchical keys)
- signing bzimage works
- uefi secure boot does not validate signatures on separate initrd, have to bundle it into the bzimage
- not sure yet about kernel command line parameters
- have to enable lockdown, etc for proper protection
- kvm in initrd works, need to figure out pcie pass through
- module signing: should it use the same key? can be specified with https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html