Shim - Gestionnaire de clés MOK mmx

Création : Debian 10.5 / Buster

Sommaire

1 - Principe

2 - Installation

$ sudo dmesg |grep secureboot
[ 0.000000] secureboot: Secure boot enabled
$ sudo aptitude install mokutil
$ sudo tree /boot/efi
/boot/efi
└── EFI
├── MOK
│ ├── mmx64.efi
│ └── shimx64.efi
...
$ sudo dmesg |grep MokListRT
$ mokutil --list-enrolled
MokListRT is empty

3 - Création et enregistrement d'une clé

3.1 - Création

$ openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -days 36500 -subj "/CN=Pengouin/" -nodes
Generating a RSA private key
....
writing new private key to 'MOK.priv'
$ ls MOK* 
MOK.der MOK.priv
$ sudo cp MOK.der /boot/efi/EFI/MOK

3.2 - Enregistrement de la demande d'importation

$ sudo mokutil --import MOK.der
input password:
input password again:
$ sudo mokutil --list-new |grep -E "Issuer" 
Issuer: CN=Pengouin

$ sudo mokutil --list-new |grep -A1 "Serial Number"
Serial Number:
13:49:xx:....:xx:d7:08

3.3 - Enregistrement

Shim UEFI key management

Pres any key to perform MOK management

Booting in 9 seconds
Perform MOK management

Continue boot
Enroll MOK
Enroll key from disk
Enroll hash from disk

Il est possible de choisir d'enregistrer

Select Key

The selected key will be enrolled into the MOK database
THis means any binaries signed with it will be run without prompting
Remember to make sure it is a genuine key before Enrolling it

..................
EFI/
MOK/
MOK.der
Enroll the key(s)?

No/Yes

4 - Vérifications

$ sudo dmesg |grep MokListRT
[ 0.638481] Loaded UEFI:MokListRT cert 'Pengouin: c8d09...69b9f' linked to secondary sys keyring
[ 0.638606] Loaded UEFI:MokListRT cert 'Debian Secure Boot CA: 6ccece7e4c6c0d1f6149f3dd27dfcc5cbb419ea1' linked to secondary sys keyring
$ sudo cat /proc/keys |grep Pengouin
0aae3c0b I------ 1 perm 1f010000 0 0 asymmetri Pengouin: c8d09....9b9f: X509.rsa 39169b9f []
$ mokutil -l |grep Issuer |grep Pengouin
Issuer: CN=Pengouin

5 - Suppression d'une clé

$ ls *.der
MOK.der
$ sudo mokutil --delete MOK.der