arrfab / rpms / shim

Forked from rpms/shim 5 years ago
Clone

Blame SOURCES/0020-Add-a-preliminary-test-plan.patch

4210fa
From ac356a0e7723662d0a83ca3991088ce346495772 Mon Sep 17 00:00:00 2001
4210fa
From: Peter Jones <pjones@redhat.com>
4210fa
Date: Fri, 14 Feb 2014 14:06:45 -0500
4210fa
Subject: [PATCH 20/74] Add a preliminary test plan.
4210fa
4210fa
Because you know you wanted a test plan.  You feel it deeply inside.
4210fa
4210fa
Note that none of the /negative/ cases are tested yet.
4210fa
4210fa
Signed-off-by: Peter Jones <pjones@redhat.com>
4210fa
---
4210fa
 testplan.txt | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4210fa
 1 file changed, 80 insertions(+)
4210fa
 create mode 100644 testplan.txt
4210fa
4210fa
diff --git a/testplan.txt b/testplan.txt
4210fa
new file mode 100644
4210fa
index 0000000..118dfcd
4210fa
--- /dev/null
4210fa
+++ b/testplan.txt
4210fa
@@ -0,0 +1,80 @@
4210fa
+How to test a new shim build for RHEL/fedora:
4210fa
+
4210fa
+1) build pesign-test-app, and sign it with the appropriate key
4210fa
+2) build shim with the appropriate key built in
4210fa
+3) install pesign-test-app and shim-unsigned on the test machine
4210fa
+4) make a lockdown.efi for "Red Hat Test Certificate" and put it in \EFI\test
4210fa
+   mkdir /boot/efi/EFI/test/
4210fa
+   wget http://pjones.fedorapeople.org/shim/LockDown-rhtest.efi
4210fa
+   mv LockDown-rhtest.efi /boot/efi/EFI/test/lockdown.efi
4210fa
+5) sign shim with RHTC and put it in \EFI\test:
4210fa
+   pesign -i /usr/share/shim/shim.efi -o /boot/efi/EFI/test/shim.efi \
4210fa
+        -s -c "Red Hat Test Certificate"
4210fa
+6) put pesign-test-app-signed.efi in \EFI\test as grubx64.efi
4210fa
+   cp /usr/share/pesign-test-app-0.4/pesign-test-app-signed.efi \
4210fa
+   	/boot/efi/EFI/test/test.efi
4210fa
+7) sign a copy of grubx64.efi with RHTC and iput it in \EFI\test\:
4210fa
+    pesign -i /boot/efi/EFI/redhat/grubx64.efi -o grubx64-unsigned.efi \
4210fa
+    	-r -u 0
4210fa
+    pesign -i grubx64-unsigned.efi -o /boot/efi/EFI/test/grub.efi \
4210fa
+        -s -c "Red Hat Test Certificate"
4210fa
+8) sign a copy of mokmanager with RHTC and put it in \EFI\test:
4210fa
+    pesign -i /usr/share/shim/MokManager.efi \
4210fa
+    	-o /boot/efi/EFI/test/MokManager.efi -s \
4210fa
+	-c "Red Hat Test Certificate"
4210fa
+9) copy grub.cfg to our test directory:
4210fa
+    cp /boot/efi/EFI/redhat/grub.cfg /boot/efi/EFI/test/grub.cfg
4210fa
+10) *move* \EFI\redhat\BOOT.CSV to \EFI\test 
4210fa
+    mv /boot/efi/EFI/redhat/BOOT.CSV /boot/efi/EFI/test/BOOT.CSV
4210fa
+11) sign a copy of fallback.efi and put it in \EFI\BOOT\fallback.efi
4210fa
+    rm -rf /boot/efi/EFI/BOOT/
4210fa
+    mkdir /boot/efi/EFI/BOOT/
4210fa
+    pesign -i /usr/share/shim/fallback.efi \
4210fa
+	-o /boot/efi/EFI/BOOT/fallback.efi \
4210fa
+	-s -c "Red Hat Test Certificate"
4210fa
+12) put shim.efi there as well
4210fa
+    cp /boot/efi/EFI/test/shim.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
4210fa
+13) enroll the current kernel's certificate with mokutil:
4210fa
+    mokutil --import ~/redhatsecurebootca2.cer
4210fa
+14) put machine in setup mode
4210fa
+15) boot to the UEFI shell
4210fa
+16) run lockdown.efi from #4:
4210fa
+    fs0:\EFI\test\lockdown.efi
4210fa
+17) enable secure boot verification
4210fa
+18) verify it can't run other binaries:
4210fa
+    fs0:\EFI\redhat\grubx64.efi
4210fa
+    result should be an error, probably similar to:
4210fa
+    "fs0:\...\grubx64.efi is not recognized as an internal or external command"
4210fa
+19) copy test.efi to grubx64.efi:
4210fa
+    cp \EFI\test\test.efi \EFI\test\grubx64.efi
4210fa
+20) in the EFI shell, run fs0:\EFI\test\shim.efi
4210fa
+21) you should see MokManager.  Enroll the certificate you added in #13, and
4210fa
+    the system will reboot.
4210fa
+22) reboot to the UEFI shell and run fs0:\EFI\test\shim.efi
4210fa
+    result: "This is a test application that should be completely safe."
4210fa
+  If you get the expected result, shim can run things signed by its internal
4210fa
+  key ring.  Check a box someplace that says it can do that.
4210fa
+23) from the EFI shell, copy grub to grubx64.efi:
4210fa
+    cp \EFI\test\grubx.efi \EFI\test\grubx64.efi
4210fa
+24) in the EFI shell, run fs0:\EFI\test\shim.efi
4210fa
+    result: this should start grub, which will let you boot a kernel
4210fa
+  If grub starts, it means shim can run things signed by a key in the system's
4210fa
+  db.  Check a box someplace that says it can do that.
4210fa
+  If the kernel boots, it means shim can run things from Mok.  Check a box
4210fa
+  someplace that says it can do that.
4210fa
+25) remove all boot entries and the BootOrder variable:
4210fa
+    [root@uefi ~]# cd /sys/firmware/efi/efivars/
4210fa
+    [root@uefi efivars]# rm -vf Boot[0123456789]* BootOrder-*
4210fa
+    removed ‘Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c’
4210fa
+    removed ‘Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c’
4210fa
+    removed ‘Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c’
4210fa
+    removed ‘Boot2001-8be4df61-93ca-11d2-aa0d-00e098032b8c’
4210fa
+    removed ‘BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c’
4210fa
+    [root@uefi efivars]# 
4210fa
+27) reboot
4210fa
+28) the system should run \EFI\BOOT\BOOTX64.EFI .  If it doesn't, you may just
4210fa
+    have an old machine.  In that case, go to the EFI shell and run:
4210fa
+    fs0:\EFI\BOOT\BOOTX64.EFI
4210fa
+  If this works, you should see a bit of output very quickly and then the same
4210fa
+  thing as #24.  This means shim recognized it was in \EFI\BOOT and ran
4210fa
+  fallback.efi, which worked.
4210fa
-- 
4210fa
1.9.3
4210fa