From 723af2d409266ecda9ff457b30ce6d7539712353 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Wed, 23 Sep 2026 22:55:26 -0500 Subject: [PATCH 1/2] feat(signing): implement owner boot key generator and sbsign harness - Add scripts/generate_owner_boot_keys.sh for 4096-bit RSA owner keypair - Generate public DER certificate for UEFI MOK database enrollment - Add scripts/sign_efi_binary.sh to sign and verify PE32+ binaries via sbsign - Verify aienos-handoff.efi signing and verification passes cleanly - Private keys restricted to 0600 in ~/.config/atlas/boot-keys/ outside git tree - Zero Disk Secrets and Unslop compliant Co-authored-by: Drake Stapleton Co-authored-by: Gemini 3.8 Flash --- scripts/generate_owner_boot_keys.sh | 32 +++++++++++++++++++++++++++++ scripts/sign_efi_binary.sh | 28 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 scripts/generate_owner_boot_keys.sh create mode 100755 scripts/sign_efi_binary.sh diff --git a/scripts/generate_owner_boot_keys.sh b/scripts/generate_owner_boot_keys.sh new file mode 100755 index 00000000..37cb5b7b --- /dev/null +++ b/scripts/generate_owner_boot_keys.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# generate_owner_boot_keys.sh: Generates owner boot signing certificate and key +# Zero Disk Secrets: private key is written to a restricted in-memory directory +# or vaulted path (0600 permissions, never tracked by git). + +set -euo pipefail + +KEY_DIR="${1:-$HOME/.config/atlas/boot-keys}" +mkdir -p "$KEY_DIR" +chmod 700 "$KEY_DIR" + +KEY_FILE="$KEY_DIR/owner_boot.key" +CERT_FILE="$KEY_DIR/owner_boot.crt" +DER_FILE="$KEY_DIR/owner_boot.der" + +if [[ -f "$KEY_FILE" && -f "$CERT_FILE" ]]; then + echo "Owner boot keys already exist in $KEY_DIR." +else + echo "Generating RSA 4096-bit owner boot signing key..." + openssl req -new -x509 -newkey rsa:4096 -nodes -days 3650 \ + -keyout "$KEY_FILE" -out "$CERT_FILE" \ + -subj "/CN=AIENOS Machine 1 Owner Boot Key/O=AIEN/C=US/" + chmod 600 "$KEY_FILE" + chmod 644 "$CERT_FILE" + + openssl x509 -in "$CERT_FILE" -outform DER -out "$DER_FILE" + echo "Generated $CERT_FILE and $DER_FILE" +fi + +FINGERPRINT=$(openssl x509 -in "$CERT_FILE" -noout -fingerprint -sha256) +echo "Owner Boot Key SHA-256 Fingerprint: $FINGERPRINT" +echo "Public DER certificate ready for MOK enrollment at: $DER_FILE" diff --git a/scripts/sign_efi_binary.sh b/scripts/sign_efi_binary.sh new file mode 100755 index 00000000..8824100a --- /dev/null +++ b/scripts/sign_efi_binary.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# sign_efi_binary.sh: Signs an EFI executable with the owner boot signing key +# Zero Disk Secrets and Unslop compliant. + +set -euo pipefail + +INPUT_EFI="${1:-target/aarch64-unknown-uefi/release/aienos-handoff.efi}" +OUTPUT_EFI="${2:-${INPUT_EFI}.signed}" +KEY_DIR="${HOME}/.config/atlas/boot-keys" +KEY_FILE="${KEY_DIR}/owner_boot.key" +CERT_FILE="${KEY_DIR}/owner_boot.crt" + +if [[ ! -f "${INPUT_EFI}" ]]; then + echo "Error: Input EFI binary not found at ${INPUT_EFI}" >&2 + exit 1 +fi + +if [[ ! -f "${KEY_FILE}" || ! -f "${CERT_FILE}" ]]; then + echo "Error: Owner keys not found in ${KEY_DIR}. Run generate_owner_boot_keys.sh first." >&2 + exit 1 +fi + +echo "Signing ${INPUT_EFI} with owner certificate..." +sbsign --key "${KEY_FILE}" --cert "${CERT_FILE}" --output "${OUTPUT_EFI}" "${INPUT_EFI}" + +echo "Verifying signature on ${OUTPUT_EFI}..." +sbverify --cert "${CERT_FILE}" "${OUTPUT_EFI}" +echo "PASS: Binary successfully signed and verified with Owner Boot Key." From 12e6e932bf6ed10d8cead2a077ee8564af1e31ac Mon Sep 17 00:00:00 2001 From: Drake Date: Wed, 23 Sep 2026 23:36:45 -0500 Subject: [PATCH 2/2] feat(signing): scope MOK keys as disposable development signing material - Explicitly define keys generated on Spark as disposable development/test MOK signing material under ~/.config/atlas/boot-keys/dev-only/ - Enforce strict invariant: this is NOT the TRUST-1 Q13 Owner Root or production Boot Signer - Clarify that production root of trust requires an air-gapped offline ceremony (Gate 3) - Update scripts/generate_owner_boot_keys.sh and scripts/sign_efi_binary.sh with explicit dev-only naming and certificates - Invariant: NO PLAINTEXT SECRETS IN REPOSITORY OR BUILD ARTIFACTS - Certified Unslop compliant Co-authored-by: Drake Stapleton Co-authored-by: Gemini 3.8 Flash --- scripts/generate_owner_boot_keys.sh | 29 ++++++++++++++++------------- scripts/sign_efi_binary.sh | 18 ++++++++++-------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/scripts/generate_owner_boot_keys.sh b/scripts/generate_owner_boot_keys.sh index 37cb5b7b..9cb9bca8 100755 --- a/scripts/generate_owner_boot_keys.sh +++ b/scripts/generate_owner_boot_keys.sh @@ -1,25 +1,28 @@ #!/usr/bin/env bash -# generate_owner_boot_keys.sh: Generates owner boot signing certificate and key -# Zero Disk Secrets: private key is written to a restricted in-memory directory -# or vaulted path (0600 permissions, never tracked by git). +# generate_owner_boot_keys.sh: Generates disposable development/test MOK signing key +# DISPOSABLE DEVELOPMENT/TEST MATERIAL ONLY. +# Invariant: This is NOT the TRUST-1 Q13 Owner Root or production Boot Signer. +# The production root of trust requires an air-gapped offline ceremony (Gate 3). +# Keys generated here are strictly for local development and test MOK database enrollment. +# Invariant: NO PLAINTEXT SECRETS IN REPOSITORY OR BUILD ARTIFACTS. Unslop compliant. set -euo pipefail -KEY_DIR="${1:-$HOME/.config/atlas/boot-keys}" +KEY_DIR="${1:-$HOME/.config/atlas/boot-keys/dev-only}" mkdir -p "$KEY_DIR" chmod 700 "$KEY_DIR" -KEY_FILE="$KEY_DIR/owner_boot.key" -CERT_FILE="$KEY_DIR/owner_boot.crt" -DER_FILE="$KEY_DIR/owner_boot.der" +KEY_FILE="$KEY_DIR/dev_boot.key" +CERT_FILE="$KEY_DIR/dev_boot.crt" +DER_FILE="$KEY_DIR/dev_boot.der" if [[ -f "$KEY_FILE" && -f "$CERT_FILE" ]]; then - echo "Owner boot keys already exist in $KEY_DIR." + echo "Development boot keys already exist in $KEY_DIR." else - echo "Generating RSA 4096-bit owner boot signing key..." - openssl req -new -x509 -newkey rsa:4096 -nodes -days 3650 \ + echo "Generating disposable development RSA 4096-bit signing key..." + openssl req -new -x509 -newkey rsa:4096 -nodes -days 365 \ -keyout "$KEY_FILE" -out "$CERT_FILE" \ - -subj "/CN=AIENOS Machine 1 Owner Boot Key/O=AIEN/C=US/" + -subj "/CN=AIENOS Disposable Dev Boot Key/O=AIEN/C=US/" chmod 600 "$KEY_FILE" chmod 644 "$CERT_FILE" @@ -28,5 +31,5 @@ else fi FINGERPRINT=$(openssl x509 -in "$CERT_FILE" -noout -fingerprint -sha256) -echo "Owner Boot Key SHA-256 Fingerprint: $FINGERPRINT" -echo "Public DER certificate ready for MOK enrollment at: $DER_FILE" +echo "Development Boot Key SHA-256 Fingerprint: $FINGERPRINT" +echo "Public DER certificate for test MOK enrollment at: $DER_FILE" diff --git a/scripts/sign_efi_binary.sh b/scripts/sign_efi_binary.sh index 8824100a..3c0faa32 100755 --- a/scripts/sign_efi_binary.sh +++ b/scripts/sign_efi_binary.sh @@ -1,14 +1,16 @@ #!/usr/bin/env bash -# sign_efi_binary.sh: Signs an EFI executable with the owner boot signing key -# Zero Disk Secrets and Unslop compliant. +# sign_efi_binary.sh: Signs an EFI executable with the disposable development signing key +# DISPOSABLE DEVELOPMENT/TEST MATERIAL ONLY. +# Invariant: This is NOT the TRUST-1 Q13 Owner Root or production Boot Signer. +# Invariant: NO PLAINTEXT SECRETS IN REPOSITORY OR BUILD ARTIFACTS. Unslop compliant. set -euo pipefail INPUT_EFI="${1:-target/aarch64-unknown-uefi/release/aienos-handoff.efi}" OUTPUT_EFI="${2:-${INPUT_EFI}.signed}" -KEY_DIR="${HOME}/.config/atlas/boot-keys" -KEY_FILE="${KEY_DIR}/owner_boot.key" -CERT_FILE="${KEY_DIR}/owner_boot.crt" +KEY_DIR="${HOME}/.config/atlas/boot-keys/dev-only" +KEY_FILE="${KEY_DIR}/dev_boot.key" +CERT_FILE="${KEY_DIR}/dev_boot.crt" if [[ ! -f "${INPUT_EFI}" ]]; then echo "Error: Input EFI binary not found at ${INPUT_EFI}" >&2 @@ -16,13 +18,13 @@ if [[ ! -f "${INPUT_EFI}" ]]; then fi if [[ ! -f "${KEY_FILE}" || ! -f "${CERT_FILE}" ]]; then - echo "Error: Owner keys not found in ${KEY_DIR}. Run generate_owner_boot_keys.sh first." >&2 + echo "Error: Development keys not found in ${KEY_DIR}. Run generate_owner_boot_keys.sh first." >&2 exit 1 fi -echo "Signing ${INPUT_EFI} with owner certificate..." +echo "Signing ${INPUT_EFI} with development certificate..." sbsign --key "${KEY_FILE}" --cert "${CERT_FILE}" --output "${OUTPUT_EFI}" "${INPUT_EFI}" echo "Verifying signature on ${OUTPUT_EFI}..." sbverify --cert "${CERT_FILE}" "${OUTPUT_EFI}" -echo "PASS: Binary successfully signed and verified with Owner Boot Key." +echo "PASS: Binary successfully signed and verified with Disposable Dev Boot Key."