@@ -15,38 +15,33 @@ IMAGE_ID="$(sed s/sha256:// tmp/iid)"
1515./cfsctl --repo tmp/sysroot/composefs oci pull containers-storage:" ${IMAGE_ID} "
1616COMPOSEFS_FSVERITY=" $( ./cfsctl --repo tmp/sysroot/composefs oci compute-id --bootable " ${IMAGE_ID} " ) "
1717
18+ # See: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot
19+ # Alternative to generate keys for testing: `sbctl create-keys`
20+ if [[ ! -d " secureboot" ]]; then
21+ echo " Generating test Secure Boot keys"
22+ mkdir secureboot
23+ pushd secureboot > /dev/null
24+ uuidgen --random > GUID.txt
25+ openssl req -newkey rsa:4096 -nodes -keyout PK.key -new -x509 -sha256 -days 3650 -subj " /CN=Test Platform Key/" -out PK.crt
26+ openssl x509 -outform DER -in PK.crt -out PK.cer
27+ openssl req -newkey rsa:4096 -nodes -keyout KEK.key -new -x509 -sha256 -days 3650 -subj " /CN=Test Key Exchange Key/" -out KEK.crt
28+ openssl x509 -outform DER -in KEK.crt -out KEK.cer
29+ openssl req -newkey rsa:4096 -nodes -keyout db.key -new -x509 -sha256 -days 3650 -subj " /CN=Test Signature Database key/" -out db.crt
30+ openssl x509 -outform DER -in db.crt -out db.cer
31+ popd > /dev/null
32+ fi
33+
34+ # For debugging, add --no-cache to podman command
1835sudo podman build \
1936 -t quay.io/fedora/fedora-bootc-uki:42 \
2037 --build-arg=COMPOSEFS_FSVERITY=" ${COMPOSEFS_FSVERITY} " \
2138 -f Containerfile.stage2 \
39+ --secret=id=key,src=secureboot/db.key \
40+ --secret=id=cert,src=secureboot/db.crt \
2241 --iidfile=tmp/iid2
2342
2443rm -rf tmp/efi
2544mkdir -p tmp/efi
2645./cfsctl --repo tmp/sysroot/composefs oci pull containers-storage:" ${IMAGE_ID} "
2746./cfsctl --repo tmp/sysroot/composefs oci compute-id --bootable " ${IMAGE_ID} "
2847./cfsctl --repo tmp/sysroot/composefs oci prepare-boot " ${IMAGE_ID} " --bootdir tmp/efi
29-
30- # For debugging, add --no-cache to podman command
31- # mkdir tmp/internal-sysroot
32- # # podman build \
33- # --iidfile=tmp/iid \
34- # -v "${PWD}/tmp/internal-sysroot:/tmp/sysroot:z,U" \
35- # --secret=id=key,src=secureboot/db.key \
36- # --secret=id=cert,src=secureboot/db.crt \
37-
38- # See: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot
39- # Alternative to generate keys for testing: `sbctl create-keys`
40- # if [[ ! -d "secureboot" ]]; then
41- # echo "Generating test Secure Boot keys"
42- # mkdir secureboot
43- # pushd secureboot > /dev/null
44- # uuidgen --random > GUID.txt
45- # openssl req -newkey rsa:4096 -nodes -keyout PK.key -new -x509 -sha256 -days 3650 -subj "/CN=Test Platform Key/" -out PK.crt
46- # openssl x509 -outform DER -in PK.crt -out PK.cer
47- # openssl req -newkey rsa:4096 -nodes -keyout KEK.key -new -x509 -sha256 -days 3650 -subj "/CN=Test Key Exchange Key/" -out KEK.crt
48- # openssl x509 -outform DER -in KEK.crt -out KEK.cer
49- # openssl req -newkey rsa:4096 -nodes -keyout db.key -new -x509 -sha256 -days 3650 -subj "/CN=Test Signature Database key/" -out db.crt
50- # openssl x509 -outform DER -in db.crt -out db.cer
51- # popd > /dev/null
52- # fi
0 commit comments