@@ -15,38 +15,33 @@ IMAGE_ID="$(sed s/sha256:// tmp/iid)"
15
15
./cfsctl --repo tmp/sysroot/composefs oci pull containers-storage:" ${IMAGE_ID} "
16
16
COMPOSEFS_FSVERITY=" $( ./cfsctl --repo tmp/sysroot/composefs oci compute-id --bootable " ${IMAGE_ID} " ) "
17
17
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
18
35
sudo podman build \
19
36
-t quay.io/fedora/fedora-bootc-uki:42 \
20
37
--build-arg=COMPOSEFS_FSVERITY=" ${COMPOSEFS_FSVERITY} " \
21
38
-f Containerfile.stage2 \
39
+ --secret=id=key,src=secureboot/db.key \
40
+ --secret=id=cert,src=secureboot/db.crt \
22
41
--iidfile=tmp/iid2
23
42
24
43
rm -rf tmp/efi
25
44
mkdir -p tmp/efi
26
45
./cfsctl --repo tmp/sysroot/composefs oci pull containers-storage:" ${IMAGE_ID} "
27
46
./cfsctl --repo tmp/sysroot/composefs oci compute-id --bootable " ${IMAGE_ID} "
28
47
./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