Expose drift verifier through a fixed sudo helper
CI / tests-and-images (pull_request) Has been cancelled

This commit is contained in:
agent committed 2026-10-11 19:39:02 +03:00
1 parent 711700fcc9
commit 02cf4e6e95
10 files changed
+52 -25

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
checkout=/opt/akyldash/current
if [[ $# -ne 0 || $EUID -ne 0 || ! -d $checkout || -L $checkout || $(stat -c %U "$checkout") != root ]]; then
echo 'Refusing verification: the approved root-owned checkout is unavailable.' >&2
exit 1
fi
unsafe=$(find "$checkout" -xdev \( ! -user root -o -perm /022 \) -print -quit)
if [[ -n $unsafe ]]; then
echo 'Refusing verification: the checkout contains a writable or non-root-owned path.' >&2
exit 1
fi
exec /bin/bash "$checkout/infra/bootstrap/verify.sh" --remote
+7 -6
View File
@@ -3,7 +3,7 @@ set -euo pipefail
if [[ ${1:-} != --remote ]]; then
ssh_alias=${1:-akyldash_vps}
exec ssh -F "${HOME}/.ssh/config" -o BatchMode=yes "$ssh_alias" 'sudo -n bash -s -- --remote' < "$0"
exec ssh -F "${HOME}/.ssh/config" -o BatchMode=yes "$ssh_alias" 'sudo -n /usr/local/sbin/akyldash-verify'
fi
if [[ ${EUID} -ne 0 ]]; then
@@ -129,14 +129,15 @@ for endpoint in $udp_listeners; do
failed=1
done
sudoers_rule='codex ALL=(root) NOPASSWD: /usr/local/sbin/akyldash-rollback *'
if [[ -x /usr/local/sbin/akyldash-rollback && $(stat -c %U:%a /usr/local/sbin/akyldash-rollback) == root:750 && \
expected_sudoers=$'codex ALL=(root) NOPASSWD: /usr/local/sbin/akyldash-verify\ncodex ALL=(root) NOPASSWD: /usr/local/sbin/akyldash-rollback *'
if [[ -x /usr/local/sbin/akyldash-verify && $(stat -c %U:%a /usr/local/sbin/akyldash-verify) == root:750 && \
-x /usr/local/sbin/akyldash-rollback && $(stat -c %U:%a /usr/local/sbin/akyldash-rollback) == root:750 && \
-f /usr/local/lib/akyldash/archive.py && $(stat -c %U:%a /usr/local/lib/akyldash/archive.py) == root:644 && \
-f /etc/sudoers.d/akyldash-codex && $(stat -c %U:%a /etc/sudoers.d/akyldash-codex) == root:440 && \
$(cat /etc/sudoers.d/akyldash-codex) == "$sudoers_rule" ]]; then
echo 'PASS limited rollback helper and sudoers rule present'
$(cat /etc/sudoers.d/akyldash-codex) == "$expected_sudoers" ]]; then
echo 'PASS read-only verifier, rollback helper, and exact sudoers rules present'
else
echo 'FAIL limited rollback helper or sudoers rule missing/different'
echo 'FAIL restricted helper or sudoers installation missing/different'
failed=1
fi
if [[ -f /opt/akyldash/deployed-image.txt ]]; then