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/verify_native_rollback.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 / verify_native_rollback.sh` 199 lines ยท 6289 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 # verify_native_rollback.sh 18 # Host-side automated verifier for AIENOS native-boot rollback observations. 19 # 20 # Consumes pre-boot and post-return evidence captures and determines whether 21 # rollback invariants held. 22 # 23 # Stable result verdicts: 24 # PASS - All rollback invariants satisfied. 25 # FAIL - One or more invariants violated (e.g. BootOrder changed, root modified, BootNext stuck). 26 # BLOCKED - Hardware qualification blocked by trust chain / Secure Boot. 27 # INCOMP - Incomplete evidence or missing required capture files. 28 29 set -euo pipefail 30 31 usage() { 32 cat < 36 37 Capture post-return evidence: 38 $0 --capture-post 39 40 Verify pre/post observations: 41 $0 --verify --pre --post [--candidate ] 42 EOF 43 exit 2 44 } 45 46 capture_state() { 47 local out_file="$1" 48 local sb_state="unknown" 49 local secure_boot_var="/sys/firmware/efi/efivars/SecureBoot-`8be4df61`-93ca-11d2-aa0d-`00e098032b8c`" 50 51 if [[ -r "${secure_boot_var}" ]]; then 52 local b 53 b="$(od -An -t u1 -j 4 -N 1 "${secure_boot_var}" 2>/dev/null | tr -d ' ' || echo "")" 54 if [[ "${b}" == "1" ]]; then 55 sb_state="enabled" 56 elif [[ "${b}" == "0" ]]; then 57 sb_state="disabled" 58 fi 59 fi 60 61 if [[ "${sb_state}" == "unknown" ]] && command -v mokutil >/dev/null 2>&1; then 62 if mokutil --sb-state 2>/dev/null | grep -qi "enabled"; then 63 sb_state="enabled" 64 else 65 sb_state="disabled" 66 fi 67 fi 68 69 local boot_current="" 70 local boot_order="" 71 local boot_next="" 72 if command -v efibootmgr >/dev/null 2>&1; then 73 boot_current="$(efibootmgr 2>/dev/null | sed -n 's/^BootCurrent: //p' || echo "")" 74 boot_order="$(efibootmgr 2>/dev/null | sed -n 's/^BootOrder: //p' || echo "")" 75 boot_next="$(efibootmgr 2>/dev/null | sed -n 's/^BootNext: //p' || echo "")" 76 fi 77 78 local root_dev root_uuid root_opts 79 root_dev="$(findmnt -no SOURCE / 2>/dev/null || echo "")" 80 root_uuid="$(findmnt -no UUID / 2>/dev/null || echo "")" 81 root_opts="$(findmnt -no OPTIONS / 2>/dev/null || echo "")" 82 83 local esp_dev esp_uuid esp_opts 84 esp_dev="$(findmnt -no SOURCE /boot/efi 2>/dev/null || echo "")" 85 esp_uuid="$(findmnt -no UUID /boot/efi 2>/dev/null || echo "")" 86 esp_opts="$(findmnt -no OPTIONS /boot/efi 2>/dev/null || echo "")" 87 88 local commit="" 89 commit="$(git rev-parse HEAD 2>/dev/null || echo "unknown")" 90 91 cat >"${out_file}" <