No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2022-11-11 16:46:53 +00:00
doc cert-to-efi-hash-list: add man page 2014-12-22 11:37:32 -08:00
include Version: 1.9.2 2019-01-08 14:13:13 -08:00
lib sha256: do not align raw section sizes 2019-01-08 14:11:06 -08:00
.gitignore flash-var: new routine for manipulating variables in flash images 2015-03-17 17:09:26 -07:00
.gitlab-ci.yml Update to Ubuntu 22.04 2022-11-11 16:46:53 +00:00
cert-to-efi-hash-list.c cert-to-efi-hash-list: fix for openssl 1.1 2017-10-19 12:04:15 -07:00
cert-to-efi-sig-list.c Fix ARM32 build 2016-02-14 11:46:33 -08:00
COPYING COPYING: complete lib/ transition to LGPL 2013-04-17 07:54:59 -07:00
efi-keytool.c efi-keytool, efi-readvar: begin constructing linux versions of efi tools 2013-02-27 08:44:28 -06:00
efi-readvar.c efi-readvar: add MokList as possible variable to read from 2013-03-19 23:12:43 +00:00
efi-updatevar.c support engine based keys 2019-01-05 13:44:13 -08:00
flash-var.c flash-var: new routine for manipulating variables in flash images 2015-03-17 17:09:26 -07:00
hash-to-efi-sig-list.c Fix ARM32 build 2016-02-14 11:46:33 -08:00
HashTool.c arm build fixes 2016-02-12 17:15:22 -08:00
HelloWorld.c HelloWorld: Add return to shut obs up 2012-12-03 15:16:48 +00:00
KeyTool.c arm build fixes 2016-02-12 17:15:22 -08:00
Loader.c arm build fixes 2016-02-12 17:15:22 -08:00
LockDown.c arm build fixes 2016-02-12 17:15:22 -08:00
Make.rules Fix Fedora build 2018-02-20 22:51:31 -05:00
Makefile Makefile: Reverse the order of lib.a and -lcrypto 2019-01-06 08:36:27 -08:00
mkusb.sh mkusb.sh: script to create a bootable USB image with the files 2012-12-03 13:50:28 +00:00
ms-kek.crt Add MS KEK update bundle 2014-12-18 18:12:16 -08:00
ms-uefi.crt Build an update bundle for the Microsoft db key 2014-12-17 11:05:25 -08:00
PreLoader.c PreLoader: use updated security policy install function 2016-05-13 14:54:41 -07:00
README README: update with better explanations 2012-07-21 11:35:15 +01:00
ReadVars.c ReadVars, UpdateVars: add support for dbt 2014-12-22 07:32:47 -08:00
SetNull.c SetNull: simple program to prevent *NULL from being 0 2012-12-11 23:57:48 +00:00
ShimReplace.c shim_protocol: convert to using the pkcs7verify allow and deny function 2016-03-25 11:10:12 -04:00
sig-list-to-certs.c sig-list-to-certs: add -e option to break out all esl payloads 2016-03-25 11:10:12 -04:00
sign-efi-sig-list.c sign-efi-sig-list: add man page entry for engine option 2019-01-07 13:46:34 -08:00
UpdateVars.c arm build fixes 2016-02-12 17:15:22 -08:00
xxdi.pl Makefile/Make.rules: don't rely on vim-core 2013-09-19 08:14:24 -05:00

How to use these files

simply typing make will build you everything including sample certificates for
PK, KEK and db.

The prerequisites are the standard development environment, gnu-efi version
3.0q or later, help2man and sbsigntools.

There will be one file called LockDown.efi.  If run on your efi platform in
Setup Mode, this binary will *replace* all the values in the PK, KEK and db
variables with the ones you just generated and place the platform back into
User Mode (booting securely).  If you don't want to replace all the variables,
take a dump of your current variables, see sig-list-to-cert(1), and add them
to the EFI signature list files before creating LockDown.efi

Say you want to concatenate an existing platform-db.esl file, do this:

make DB.esl
cat platform.esl DB.esl > newDB.esl
mv newDB.esl DB.esl

and then make LockDown.efi in the usual way.

All of the EFI programs are also generated in signed form (signed by both db
and KEK).


Loader.efi
==========

This EFI binary is created to boot an unsigned EFI file on the platform. Since
this explicitly breaks the security of the platform, it will first check to
see if the boot binary is naturally executable and execute it if it is (either
it's properly signed or the platform isn't in Secure Boot mode).  If the
binary gives an EFI_ACCESS_DENIED error meaning it isn't properly signed,
Loader.efi will request present user authorisation before proceeding to boot.

The idea is that Loader.efi may serve as a chain for elilo.efi or another boot
loader on distributed linux live and install CDs and even as the boot loader
for the distribution on the hard disk assuming the user does not wish to take
control of the platform and replace the keys.

To build a secure bootable CD, simply use Loader.efi as the usual
/efi/boot/bootX64.efi and place the usual loader in the same directory as the
file boot.efi.

In order to add further convenience, if the user places the platform in setup
mode and re-runs the loader, it will ask permission to add the signature the
unsigned boot loader, boot.efi, to the authorised signatures database, meaning
Loader.efi will now no longer ask for present user authorisation every time
the system is started.


Creating, using and installing your own keys
============================================

To create PEM files with the certificate and the key for PK for example, do

openssl req -new -x509 -newkey rsa:2048 -subj "/CN=PK/" -keyout PK.key -out PK.crt -days 3650 -nodes -sha256

Which will create a self signed X509 certificate for PK in PK.crt (using
unprotected key PK.key with the subject common name PK (that's what the CN=PK
is doing).

You need to create at least three sets of certificates: one for PK, one for
KEK and one for db.

Now you need to take all the efi binaries in /usr/share/efitools/efi and sign
them with your own db key using

sbsign --key db.key --cert db.crt --output HelloWorld-signed.efi HelloWorld.efi

To install your new keys on the platform, first create your authorised update
bundles:

cert-to-sig-list PK.crt PK.esl
sign-efi-sig-list -k PK.key -c PK.crt PK PK.esl PK.auth

And repeat for KEK and db.  In setup mode, it only matters that the PK update
PK.auth is signed by the new platform key.  None of the other variables will
have their signatures checked.

Now on your platform update the variables, remembering to do PK last because
an update to PK usually puts the platform into secure mode

UpdateVars db db.auth
UpdateVars KEK KEK.auth
UpdateVars PK PK.auth

And you should now be running in secure mode with your own keys.