Skip to content

Commit

Permalink
generate_payload: Create extension update payloads
Browse files Browse the repository at this point in the history
When a release has extension update payloads for OEM software these
should be signed as well.
Extend the generate_payload script to detect additional extension files
and generate signed payloads for them.
  • Loading branch information
pothos committed Sep 18, 2023
1 parent 6a77077 commit 870f3da
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions generate_payload
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,41 @@ mkdir -p "${GNUPGHOME}"
chmod 700 "${GNUPGHOME}"
trap 'rm -rf ${GNUPGHOME}' EXIT

OUTPUT_PATH="${DATA_DIR}/flatcar_production_update.gz"

# Setup GnuPG for verifying the image signature
gpg --batch --quiet --import <<< "${GPG_KEY}"

echo "Verifying files"
gpg --verify "${DATA_DIR}/flatcar_production_update.bin.bz2.sig"
gpg --verify "${DATA_DIR}/flatcar_production_image.vmlinuz.sig"
# Check that we have a signature for the files we work on
test -f "${DATA_DIR}/flatcar_production_update.bin.bz2.sig"
test -f "${DATA_DIR}/flatcar_production_image.vmlinuz.sig"
for FILE_PATH in "${DATA_DIR}"/*.sig; do
gpg --verify "${FILE_PATH}"
done

echo "Generating extension payloads"
for EXTENSION_PATH in "${DATA_DIR}"/*.raw; do
# Check that we have a signature for the files we work on
test -f "${EXTENSION_PATH}".sig
OUTPUT_PATH="${EXTENSION_PATH/.raw/.gz}"
if [ ! -f "${OUTPUT_PATH}" ]; then
echo "Generating ${OUTPUT_PATH}"
./core_sign_update \
--image "${EXTENSION_PATH}" \
--output "${OUTPUT_PATH}" \
--private_keys "${PUBLIC_KEYS_DIR}/dummy.key.pem+pkcs11:object=10;type=private" \
--public_keys "${PUBLIC_KEYS_DIR}/dummy.pub.pem+${PUBLIC_KEYS_DIR}/flatcar.pub.pem" \
--keys_separator "+"
else
echo "ERROR: Found update payload already: ${OUTPUT_PATH}."
exit 1
fi
done

echo "Extracting flatcar_production_update.bin.bz2"
bunzip2 -f -k "${DATA_DIR}/flatcar_production_update.bin.bz2"

echo "Generating update payload"
echo "Generating generic update payload"
OUTPUT_PATH="${DATA_DIR}/flatcar_production_update.gz"
if [ ! -f "${OUTPUT_PATH}" ]; then
echo "Update payload not found. Building..."
./core_sign_update \
Expand Down

0 comments on commit 870f3da

Please sign in to comment.