aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / scripts / apply-ceremony-public-record.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 | # Post-ceremony step (D3, sc#385, sc#118): turn the PUBLIC folder the operator carried out of the ceremony into the |
| 18 | # release trust configuration. Touches exactly three files and reads only the two public ones: |
| 19 | # docs/release/allowed_signers the one key line (with a short header) |
| 20 | # docs/release/ceremony-record.txt the public record, copied unchanged |
| 21 | # install.sh AIEN_RELEASE_SIGNER='<same key line>' |
| 22 | # scripts/apply-ceremony-public-record.sh <public-dir> [--root DIR] [--allow-rehearsal] |
| 23 | # <public-dir> is the ceremony's public/ folder (allowed_signers + ceremony-record.txt). Any other file, any private key |
| 24 | # material, a REHEARSAL record (without --allow-rehearsal) or an inconsistent record stops it. Ends by running |
| 25 | # scripts/check-release-trust-config.sh. It never needs, reads or asks for a private key. |
| 26 | set -euo pipefail |
| 27 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"; REH=0; PUB="" |
| 28 | while [[ $# -gt 0 ]]; do |
| 29 | case "$1" in |
| 30 | --root) ROOT="$(cd "${2:?--root needs a directory}" && pwd)"; shift ;; |
| 31 | --allow-rehearsal) REH=1 ;; |
| 32 | *) [[ -z "$PUB" ]] || { echo "one public folder only" >&2; exit 2; }; PUB="$1" ;; |
| 33 | esac |
| 34 | shift |
| 35 | done |
| 36 | die() { echo "apply: REFUSED: $*" >&2; exit 1; } |
| 37 | [[ -d "$PUB" ]] || die "give the ceremony's public folder" |
| 38 | [[ "$(ls -A "$PUB" | sort | tr '\n' ' ')" == "allowed_signers ceremony-record.txt " ]] \ |
| 39 | || die "$PUB must hold exactly allowed_signers and ceremony-record.txt" |
| 40 | ! grep -rq 'PRIVATE KEY' "$PUB" || die "private key material in $PUB" |
| 41 | line="$(grep -vE '^[[:space:]]*(#|$)' "$PUB/allowed_signers" || true)" |
| 42 | [[ "$(printf '%s' "$line" | grep -c .)" -eq 1 ]] || die "the public allowed_signers must hold exactly one key line" |
| 43 | [[ "$line" =~ ^aien-release\ ssh-ed25519\ [A-Za-z0-9+/]+=*$ ]] || die "unexpected key line format" |
| 44 | if [[ "$REH" == 0 ]]; then |
| 45 | ! grep -qi REHEARSAL "$PUB/allowed_signers" "$PUB/ceremony-record.txt" || die "this is a REHEARSAL record, not a ceremony" |
| 46 | fi |
| 47 | { |
| 48 | echo "# AIEN public-release key (ssh-keygen allowed_signers format, principal aien-release)." |
| 49 | echo "# Pinned from the witnessed key ceremony; the public record is docs/release/ceremony-record.txt." |
| 50 | echo "# Only this one public key may ever be listed here. The private half is offline and is not in this repository." |
| 51 | [[ "$REH" == 0 ]] || echo "# REHEARSAL KEY (test only)" |
| 52 | echo "$line" |
| 53 | } > "$ROOT/docs/release/allowed_signers" |
| 54 | cp "$PUB/ceremony-record.txt" "$ROOT/docs/release/ceremony-record.txt" |
| 55 | sed -i "s|^AIEN_RELEASE_SIGNER=.*|AIEN_RELEASE_SIGNER='$line'|" "$ROOT/install.sh" |
| 56 | args=(--root "$ROOT"); [[ "$REH" == 0 ]] || args+=(--allow-rehearsal) |
| 57 | bash "$ROOT/scripts/check-release-trust-config.sh" "${args[@]}" |