aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / generate_owner_boot_keys.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # generate_owner_boot_keys.sh: Generates disposable development/test MOK signing key |
| 18 | # DISPOSABLE DEVELOPMENT/TEST MATERIAL ONLY. |
| 19 | # Invariant: This is NOT the TRUST-1 Q13 Owner Root or production Boot Signer. |
| 20 | # The production root of trust requires an air-gapped offline ceremony (Gate 3). |
| 21 | # Keys generated here are strictly for local development and test MOK database enrollment. |
| 22 | # Invariant: NO PLAINTEXT SECRETS IN REPOSITORY OR BUILD ARTIFACTS. Unslop compliant. |
| 23 | |
| 24 | set -euo pipefail |
| 25 | |
| 26 | KEY_DIR="${1:-$HOME/.config/atlas/boot-keys/dev-only}" |
| 27 | mkdir -p "$KEY_DIR" |
| 28 | chmod 700 "$KEY_DIR" |
| 29 | |
| 30 | KEY_FILE="$KEY_DIR/dev_boot.key" |
| 31 | CERT_FILE="$KEY_DIR/dev_boot.crt" |
| 32 | DER_FILE="$KEY_DIR/dev_boot.der" |
| 33 | |
| 34 | if [[ -f "$KEY_FILE" && -f "$CERT_FILE" ]]; then |
| 35 | echo "Development boot keys already exist in $KEY_DIR." |
| 36 | else |
| 37 | echo "Generating disposable development RSA 4096-bit signing key..." |
| 38 | openssl req -new -x509 -newkey rsa:4096 -nodes -days 365 \ |
| 39 | -keyout "$KEY_FILE" -out "$CERT_FILE" \ |
| 40 | -subj "/CN=AIENOS Disposable Dev Boot Key/O=AIEN/C=US/" |
| 41 | chmod 600 "$KEY_FILE" |
| 42 | chmod 644 "$CERT_FILE" |
| 43 | |
| 44 | openssl x509 -in "$CERT_FILE" -outform DER -out "$DER_FILE" |
| 45 | echo "Generated $CERT_FILE and $DER_FILE" |
| 46 | fi |
| 47 | |
| 48 | FINGERPRINT=$(openssl x509 -in "$CERT_FILE" -noout -fingerprint -sha256) |
| 49 | echo "Development Boot Key SHA-256 Fingerprint: $FINGERPRINT" |
| 50 | echo "Public DER certificate for test MOK enrollment at: $DER_FILE" |