Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/scripts/pi5_receipts_manifest.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / scripts / pi5_receipts_manifest.sh` 95 lines ยท 4834 bytes Raw Blame History 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 # pi5_receipts_manifest.sh -- PI5-8 Q6: canonical, deterministic manifest of Pi run evidence. 18 # 19 # scripts/pi5_receipts_manifest.sh [-t verdicts.tsv] ... (folders like ~/workspace/pi5-runs/) 20 # scripts/pi5_receipts_manifest.sh [-t verdicts.tsv] --all (every tag in the table) 21 # 22 # Each run folder holds kernel.log and run.log (written by the Pi run harness). The manifest has, per run tag 23 # (sorted bytewise): the image EFI sha256 (run.log first line), aienos_commit (kernel.log), the sha256 of 24 # kernel.log, and the verdict lines picked by the checked-in table (scripts/pi5_receipts_verdicts.tsv). 25 # Output is plain ASCII, LF line endings, no timestamps, no absolute paths: same inputs, same bytes. 26 # 27 # SIGNING (not done here): the owner signs a fixed four-line statement that binds these manifest bytes by length and 28 # sha256 (PIV Ed25519 takes only a small message), as plain Ed25519 (RFC 8032), checked with the in-tree verifier 29 # (native/sig/`ed25519`.c) by native/kernel/tools/ck_manifest_sig.c ("verify MANIFEST SIG PUBKEYHEX"). The statement and the 30 # YubiKey ceremony are in docs/native/PI5-8-OWNER-CEREMONY.md. No owner or release key exists yet; 31 # scripts/ck_pi5_manifest_check.sh proves sign+verify with the public RFC 8032 TEST 1 key and an openssl TEST key only. 32 # 33 # Exit 0 and a manifest on stdout only when every run folder exists, every field was found and every table 34 # row matched at least one line. Otherwise nothing goes to stdout; problems go to stderr (exit 1 evidence 35 # missing, exit 2 usage or missing run folder). 36 set -euo pipefail 37 export LC_ALL=C 38 here="$(cd "$(dirname "$0")" && pwd)" 39 table="${here}/pi5_receipts_verdicts.tsv" 40 if [ "${1:-}" = "-t" ]; then table="${2:?table}"; shift 2; fi 41 [ -r "${table}" ] || { echo "no verdict table ${table}" >&2; exit 2; } 42 rows="$(grep -v '^#' "${table}" | grep -v '^$')" 43 dirs=() 44 if [ "${1:-}" = "--all" ]; then 45 root="${2:?runs root}" 46 while IFS= read -r t; do dirs+=("${root}/${t}"); done < <(cut -f1 <<<"${rows}" | sort -u) 47 else 48 [ $# -ge 1 ] || { echo "usage: $0 [-t table] ... | --all " >&2; exit 2; } 49 dirs=("$@") 50 fi 51 # sorted unique tags, tag -> folder 52 declare -A folder 53 tags="" 54 for d in "${dirs[@]}"; do 55 d="${d%/}"; t="${d##*/}" 56 folder[$t]="$d"; tags="${tags}${t}"$'\n' 57 done 58 tags="$(printf '%s' "${tags}" | sort -u)" 59 missing=0 60 while IFS= read -r t; do 61 d="${folder[$t]}" 62 for f in kernel.log run.log; do 63 [ -r "${d}/${f}" ] || { echo "MISSING ${d}/${f}" >&2; missing=1; } 64 done 65 done <<<"${tags}" 66 [ "${missing}" = 0 ] || exit 2 67 bad=0 68 out="AIENOS-PI5-RECEIPTS-MANIFEST-V1"$'\n' 69 out+="verdict_table_sha256 $(grep -v '^#' "${table}" | grep -v '^$' | sha256sum | cut -d' ' -f1)"$'\n' 70 out+="runs $(grep -c . <<<"${tags}")"$'\n' 71 while IFS= read -r t; do 72 d="${folder[$t]}" 73 efi="$(head -n 1 "${d}/run.log" | grep -ao 'sha256=[0-9a-f]\{64\}' | head -n 1 | cut -d= -f2 || true)" 74 commit="$(grep -a -m1 '^aienos_commit: [0-9a-f]\{40\}' "${d}/kernel.log" | cut -d' ' -f2 || true)" 75 [ -n "${efi}" ] || { echo "no image sha256 in ${d}/run.log first line" >&2; bad=1; } 76 [ -n "${commit}" ] || { echo "no aienos_commit in ${d}/kernel.log" >&2; bad=1; } 77 out+="run ${t}"$'\n' 78 out+="efi_sha256 ${efi:-NONE}"$'\n' 79 out+="aienos_commit ${commit:-NONE}"$'\n' 80 out+="kernel_log_sha256 $(sha256sum < "${d}/kernel.log" | cut -d' ' -f1)"$'\n' 81 nrow=0 82 while IFS=$'\t' read -r rt ms pat; do 83 [ "${rt}" = "${t}" ] || continue 84 nrow=$((nrow + 1)) 85 m="$(tr -d '\r' < "${d}/kernel.log" | grep -aE -e "${pat}" | tr -c '\11\12\40-\176' '?' || true)" 86 if [ -z "${m}" ]; then n=0; h="NONE"; echo "no line matches [${ms}] /${pat}/ in ${t}" >&2; bad=1 87 else n="$(grep -c '' <<<"${m}")"; h="$(printf '%s\n' "${m}" | sha256sum | cut -d' ' -f1)"; fi 88 out+="verdict ${ms} | /${pat}/ | lines=${n} sha256=${h}"$'\n' 89 [ "${n}" = 0 ] || out+="$(sed 's/^/ | /' <<<"${m}")"$'\n' 90 done <<<"${rows}" 91 [ "${nrow}" -gt 0 ] || { echo "run ${t} has no row in the verdict table" >&2; bad=1; } 92 done <<<"${tags}" 93 out+="end"$'\n' 94 [ "${bad}" = 0 ] || exit 1 95 printf '%s' "${out}"