I use full-disk encryption, my /boot is unencrypted and resides on a separate partition, along with the EFI partition.
I followed Sakaki's Guide, this Funtoo Guide and this.
At this point, I have generated the necessary keys and enrolled them successfully in my firmware:
Code: Select all
sbkeysync --verbose
Filesystem keystore:
firmware keys:
PK:
/CN=thinkpad platform key
KEK:
/CN=thinkpad key-exchange-key
db:
/CN=thinkpad kernel-signing-key
dbx:
filesystem keys:
PK:
KEK:
db:
dbx:
New keys in filesystem:
Code: Select all
sbverify --verbose --cert /etc/efikeys/db.crt /boot/EFI/gentoo/grubx64.efi
signature 1
image signature issuers:
- /CN=thinkpad kernel-signing-key
image signature certificates:
- subject: /CN=thinkpad kernel-signing-key
issuer: /CN=thinkpad kernel-signing-key
PKCS7 verification passed
Signature verification OK
Next, GRUB should verify the kernel and initramfs with a GPG signature. For this, I generated the appropriate key
Code: Select all
gpg --verbose --homedir=/mnt/grub /mnt/grub/grub.pub
pub rsa3072 2022-03-19 [SC]
65CFEB3B14BF520829563EAA5D8C9013801625B6
uid grub2
sig 5D8C9013801625B6 2022-03-19 [selfsig]
sub rsa3072 2022-03-19 [E]
sig 5D8C9013801625B6 2022-03-19 [keybind]
Code: Select all
gpg --verbose --homedir=/mnt/grub --verify /boot/vmlinuz-5.15.26-gentoo-x86_64.sig
gpg: assuming signed data in '/boot/vmlinuz-5.15.26-gentoo-x86_64'
gpg: Signature made Sa 19 Mär 2022 13:25:15 CET
gpg: using RSA key 65CFEB3B14BF520829563EAA5D8C9013801625B6
gpg: using pgp trust model
gpg: Good signature from "grub2" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 65CF EB3B 14BF 5208 2956 3EAA 5D8C 9013 8016 25B6
gpg: binary signature, digest algorithm SHA256, key algorithm rsa3072
Code: Select all
grub-mkstandalone --directory /usr/lib/grub/x86_64-efi/ --format x86_64-efi --modules part_gpt fat ext2 configfile verify gcry_sha512 gcry_sha256 gcry_rsa password_pbkdf2 echo normal linux linuxefi all_video search search_fs_uuid reboot sleep loadenv minicmd test echo --pubkey /mnt/grub/grub.pub --disable-shim-lock --output /boot/EFI/gentoo/grubx64.efi /boot/grub/grub.cfg=/etc/default/grub-initial.cfg /boot/grub/grub.cfg.sig=/etc/default/grub-initial.cfg.sig
My grub-initial.cfg:
Code: Select all
set check_signatures=enforce
set check_signatures
set superusers="root"
export superusers
password_pbkdf2 root grub.pbkdf2.sha512.10000.XXXX-MY-PASSWORD-HASH-XXXX
set root=(memdisk)
set prefix=$(root)/grub
search --no-floppy --fs-uuid --set=root 7DF7-8065
configfile /grub/grub.cfg
echo grub.cfg did not boot the system but returned to initial.cfg.
echo Exiting in 10 seconds.
sleep 10
exit
The menu entry that GRUB shows is defined in /boot/grub/grub.cfg:
Code: Select all
menuentry 'Gentoo GNU/Linux' --unrestricted --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-dd25cec6-beaa-4109-ab6b-e3e80e37f317' {
load_video
if [ "x$grub_platform" = xefi ]; then
set gfxpayload=keep
fi
insmod gzio
insmod part_gpt
insmod fat
search --no-floppy --fs-uuid --set=root 7DF7-8065
echo 'Loading Linux 5.15.26-gentoo-x86_64 ...'
linux /vmlinuz-5.15.26-gentoo-x86_64 root=/dev/mapper/volgroup-root ro dolvm crypt_root=UUID=0a094fef-7708-41c2-8e96-649bfc5a2637 keymap=de quiet
echo 'Loading initial ramdisk ...'
initrd /custom-initramfs-5.15.26-gentoo.cpio.gz
}
Code: Select all
Loading Linux 5.15.26-gentoo-x86_64 ...
error: Verification requested but nobody cares
I checked online if others have had similar problems, but most of the time people were using the "normal" GRUB image with the modules not built in (instead of grub-mkstandalone), but I think I do that correctly.
Any hints are appreciated. Thank you in advance.
Cheers,
regox


