From d93c283af12f454c98fff6882a121e3faea5224f Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Sat, 28 Nov 2026 11:41:58 +0000 Subject: [PATCH] Record ABSDEV-CI operator account and key provisioning qualification --- .../SCOPE.txt | 2 + .../SHA256SUMS | 6 ++ .../capabilities-after.json | 19 ++++ .../capabilities-before.json | 19 ++++ .../probe.py | 73 +++++++++++++++ .../qualification-log.txt | 20 +++++ .../qualification.sh | 90 +++++++++++++++++++ 7 files changed, 229 insertions(+) create mode 100644 evidence/operator-account-key-provisioning/SCOPE.txt create mode 100644 evidence/operator-account-key-provisioning/SHA256SUMS create mode 100644 evidence/operator-account-key-provisioning/capabilities-after.json create mode 100644 evidence/operator-account-key-provisioning/capabilities-before.json create mode 100644 evidence/operator-account-key-provisioning/probe.py create mode 100644 evidence/operator-account-key-provisioning/qualification-log.txt create mode 100644 evidence/operator-account-key-provisioning/qualification.sh diff --git a/evidence/operator-account-key-provisioning/SCOPE.txt b/evidence/operator-account-key-provisioning/SCOPE.txt new file mode 100644 index 0000000..81b6fcc --- /dev/null +++ b/evidence/operator-account-key-provisioning/SCOPE.txt @@ -0,0 +1,2 @@ +ABSDEV-CI operator account and migration approval signing key qualification, 28 November 2026. +Two disposable locked OS accounts were exercised through a privileged test launcher under their actual non-root identities. The signing key is the framework's HMAC sealing key. The root-owned key permits read access only to the authorised account's group. Approval and rehearsal data were synthetic. No database or deployment operation ran. The tests checked revocation in fresh processes after policy reload and key rotation. They did not exercise live revocation of processes already holding the old policy or key, or production secret delivery. The archive contains neither key bytes nor approval confirmation values. diff --git a/evidence/operator-account-key-provisioning/SHA256SUMS b/evidence/operator-account-key-provisioning/SHA256SUMS new file mode 100644 index 0000000..6f81fe8 --- /dev/null +++ b/evidence/operator-account-key-provisioning/SHA256SUMS @@ -0,0 +1,6 @@ +934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-after.json +934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-before.json +729138832cef705a2b885b30eeaa1710329416c576a3633681a1e37d5e59c1ac ./probe.py +ec94a71ab10f42256c9c7230501a9f8861f1283803842f2fe9b9e28ce1a5fef7 ./qualification-log.txt +42bb47558db3396d43ce6c306da22f882fcc687d35d8cf4772b311bd2d428c4a qualification.sh +3227a1380c102c0467ccf75f81ddf2111828684d3f9be82d636afb1881b7ff2f SCOPE.txt diff --git a/evidence/operator-account-key-provisioning/capabilities-after.json b/evidence/operator-account-key-provisioning/capabilities-after.json new file mode 100644 index 0000000..30d3c30 --- /dev/null +++ b/evidence/operator-account-key-provisioning/capabilities-after.json @@ -0,0 +1,19 @@ +{ + "commands": [ + "validate", + "capabilities", + "inventory", + "retention-plan", + "provision-plan", + "site-policy", + "registry-validate", + "preflight" + ], + "database_restore_enabled": false, + "deployment_execution_enabled": false, + "format_version": 1, + "migration_execution_enabled": false, + "permanent_deletion_enabled": false, + "production_ready": false, + "provisioning_execution_enabled": false +} diff --git a/evidence/operator-account-key-provisioning/capabilities-before.json b/evidence/operator-account-key-provisioning/capabilities-before.json new file mode 100644 index 0000000..30d3c30 --- /dev/null +++ b/evidence/operator-account-key-provisioning/capabilities-before.json @@ -0,0 +1,19 @@ +{ + "commands": [ + "validate", + "capabilities", + "inventory", + "retention-plan", + "provision-plan", + "site-policy", + "registry-validate", + "preflight" + ], + "database_restore_enabled": false, + "deployment_execution_enabled": false, + "format_version": 1, + "migration_execution_enabled": false, + "permanent_deletion_enabled": false, + "production_ready": false, + "provisioning_execution_enabled": false +} diff --git a/evidence/operator-account-key-provisioning/probe.py b/evidence/operator-account-key-provisioning/probe.py new file mode 100644 index 0000000..e7e8f41 --- /dev/null +++ b/evidence/operator-account-key-provisioning/probe.py @@ -0,0 +1,73 @@ +import json +import os +import sys +from datetime import datetime, timedelta, timezone +from pathlib import Path + +from core.approval import issue_approval +from core.approval_store import ApprovalStore, ApprovalStoreError +from core.operator_approval import OperatorApprovalPolicy, OperatorGrant +from core.rehearsal import approval_context, create_rehearsal + +root = Path(sys.argv[1]) +action = sys.argv[2] +config = json.loads((root / "policy.json").read_text()) +now = datetime(2026, 11, 28, 12, tzinfo=timezone.utc) +base = dict(site="operator-lab", release="2", revision="a"*40, provenance="b"*64, + compatibility="c"*64, database_identity="d"*64, backup_sha256="e"*64, + pending_migrations=["2026_11_28_000000_create_fixture"]) +execution = dict(driver="postgresql", source_database="source", target_database="isolated_restore_fixture", + target_identity="f"*64, applied_migrations=base["pending_migrations"], + checks=dict.fromkeys(("isolation_verified", "backup_restored", "migration_succeeded", + "migration_history_verified", "application_verified", + "cleanup_verified"), True)) +rehearsal = create_rehearsal(base, execution, completed_at=now) +rehearsal_path = root / "state" / "rehearsal.json" +if action not in ("issue", "wrong-principal"): + rehearsal = json.loads(rehearsal_path.read_text()) +context = approval_context(rehearsal, base, now=now) +policy = OperatorApprovalPolicy([ + OperatorGrant(config["uid"], "fixture-operator", op, base["site"], base["revision"], + now + timedelta(hours=1)) + for op in config["operations"] +], sealing_key=(root / "operator.key").read_bytes()) +store = ApprovalStore(root / "state", operator_policy=policy) +if action in ("issue", "wrong-principal"): + draft = issue_approval(context, approver=("other-principal" if action == "wrong-principal" + else "fixture-operator"), now=now) + try: + saved = store.save(draft, context, confirmation=draft["confirmation"], now=now) + except ApprovalStoreError as error: + assert action == "wrong-principal" and "not authorised" in str(error) + assert not store.approval_path(draft["approval_id"]).exists() + print("PASS: actual operator UID cannot issue for another principal") + else: + assert action == "issue" and saved["format_version"] == 2 + rehearsal_path.write_text(json.dumps(rehearsal)) + (root / "state" / "current").write_text(saved["approval_id"]) + print("PASS: dedicated OS account issued sealed approval") +else: + identifier = (root / "state" / "current").read_text() + approval = store.load(identifier) + marker = store.consumed_path(identifier) + before = marker.read_bytes() if marker.exists() else None + try: + result = store.consume(identifier, base, rehearsal, confirmation=approval["confirmation"], now=now) + except ApprovalStoreError as error: + assert action in ("replay", "grant-revoked", "key-revoked") + assert (marker.read_bytes() if marker.exists() else None) == before + if action == "replay": + assert before and "already consumed" in str(error) + else: + assert before is None + try: + store.verify_execution(approval, context, confirmation=approval["confirmation"], now=now) + except ApprovalStoreError as cause: + expected = "not authorised" if action == "grant-revoked" else "invalid operator approval seal" + assert expected in str(cause) + else: + raise AssertionError("Preflight accepted revoked authority") + print("PASS:", action, "rejected without changing consumption state") + else: + assert action == "consume" and result["migration_executed"] is False + print("PASS: fresh process consumed an authorised approval without executing migrations") diff --git a/evidence/operator-account-key-provisioning/qualification-log.txt b/evidence/operator-account-key-provisioning/qualification-log.txt new file mode 100644 index 0000000..5517731 --- /dev/null +++ b/evidence/operator-account-key-provisioning/qualification-log.txt @@ -0,0 +1,20 @@ +host=absdev-ci +revision=b0dda75809a7efa2dd8ae3dc910dab23db9cfb61 +uid=1001(aboprxay27) gid=1001(aboprxay27) groups=1001(aboprxay27) +uid=1002(abnorxay27) gid=1002(abnorxay27) groups=1002(abnorxay27) +PASS: both accounts have locked passwords and no login shell +640 root aboprxay27 /var/tmp/absdev-op-provision.rxay27/lab/operator.key +644 root root /var/tmp/absdev-op-provision.rxay27/lab/policy.json +700 aboprxay27 aboprxay27 /var/tmp/absdev-op-provision.rxay27/lab/state +PASS: operator can read the key; neither operator account can modify key or policy; ungranted account cannot read key or enter state +PASS: actual operator UID cannot issue for another principal +PASS: dedicated OS account issued sealed approval +PASS: fresh process consumed an authorised approval without executing migrations +PASS: replay rejected without changing consumption state +PASS: dedicated OS account issued sealed approval +PASS: grant-revoked rejected without changing consumption state +PASS: key-revoked rejected without changing consumption state +PASS: dedicated OS account issued sealed approval +PASS: fresh process consumed an authorised approval without executing migrations +PASS: replay rejected without changing consumption state +PASS: temporary accounts and key/state removed diff --git a/evidence/operator-account-key-provisioning/qualification.sh b/evidence/operator-account-key-provisioning/qualification.sh new file mode 100644 index 0000000..3704bcf --- /dev/null +++ b/evidence/operator-account-key-provisioning/qualification.sh @@ -0,0 +1,90 @@ +set -euo pipefail +umask 077 +test "$(hostname -s | tr A-Z a-z)" = absdev-ci +stage=$(mktemp -d /var/tmp/absdev-op-provision.XXXXXX) +suffix=$(tr '[:upper:]' '[:lower:]' <<< "${stage##*.}") +op="abop$suffix" +other="abno$suffix" +created_op=0 +created_other=0 +cleanup() { + rc=$? + if ((created_other)); then userdel "$other" || rc=1; fi + if ((created_op)); then userdel "$op" || rc=1; fi + rm -rf -- "$stage" || rc=1 + exit "$rc" +} +trap cleanup EXIT +mkdir "$stage/source" "$stage/evidence" +tar -xf - -C "$stage/source" +chmod 0755 "$stage" +chmod -R a+rX "$stage/source" +useradd -U -M -d /nonexistent -s /usr/sbin/nologin "$op" +created_op=1 +useradd -U -M -d /nonexistent -s /usr/sbin/nologin "$other" +created_other=1 +lab="$stage/lab" +install -d -m 0755 "$lab" +install -d -m 0700 -o "$op" -g "$op" "$lab/state" +policy() { + printf '{"uid":%s,"operations":%s}\n' "$(id -u "$op")" "$1" > "$lab/policy.json" + chmod 0644 "$lab/policy.json" +} +rotate() { + python3 -c 'import secrets,sys; sys.stdout.buffer.write(secrets.token_bytes(32))' > "$lab/key.new" + chgrp "$op" "$lab/key.new" + chmod 0640 "$lab/key.new" + mv -f "$lab/key.new" "$lab/operator.key" +} +cd "$stage/source" +out="$stage/evidence" +python3 -B bin/absdev-deploy capabilities > "$out/capabilities-before.json" +python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); f=[v for k,v in d.items() if k.endswith("_enabled") or k=="production_ready"]; assert len(f)==6 and all(v is False for v in f)' "$out/capabilities-before.json" +policy '["issue","execute"]' +rotate +deny() { if "$@"; then echo "Unexpected access: $*" >&2; exit 1; fi; } +probe() { runuser -u "$op" -- python3 -B probe.py "$lab" "$1"; } +{ + printf 'host=%s\nrevision=b0dda75809a7efa2dd8ae3dc910dab23db9cfb61\n' "$(hostname -s)" + id "$op" + id "$other" + test "$(getent passwd "$op" | cut -d: -f7)" = /usr/sbin/nologin + test "$(getent passwd "$other" | cut -d: -f7)" = /usr/sbin/nologin + test "$(passwd -S "$op" | awk '{print $2}')" = L + test "$(passwd -S "$other" | awk '{print $2}')" = L + echo 'PASS: both accounts have locked passwords and no login shell' + stat -c '%a %U %G %n' "$lab/operator.key" "$lab/policy.json" "$lab/state" + runuser -u "$op" -- test -r "$lab/operator.key" + deny runuser -u "$op" -- test -w "$lab/operator.key" + deny runuser -u "$op" -- test -w "$lab/policy.json" + deny runuser -u "$other" -- test -r "$lab/operator.key" + deny runuser -u "$other" -- test -x "$lab/state" + echo 'PASS: operator can read the key; neither operator account can modify key or policy; ungranted account cannot read key or enter state' + probe wrong-principal + probe issue + probe consume + probe replay + probe issue + policy '[]' + probe grant-revoked + policy '["issue","execute"]' + rotate + probe key-revoked + probe issue + probe consume + probe replay + userdel "$other" + created_other=0 + userdel "$op" + created_op=0 + deny getent passwd "$op" + deny getent passwd "$other" + rm -rf -- "$lab" + test ! -e "$lab" + echo 'PASS: temporary accounts and key/state removed' +} > "$out/qualification.log" +python3 -B bin/absdev-deploy capabilities > "$out/capabilities-after.json" +cmp "$out/capabilities-before.json" "$out/capabilities-after.json" +cp probe.py "$out/" +(cd "$out" && sha256sum ./* > SHA256SUMS) +tar -czf - -C "$out" .