diff --git a/infra/bootstrap/verify.sh b/infra/bootstrap/verify.sh index e80f960..c5c476f 100755 --- a/infra/bootstrap/verify.sh +++ b/infra/bootstrap/verify.sh @@ -33,6 +33,18 @@ else echo 'FAIL Docker Compose unavailable' failed=1 fi +if python3 -c 'import json; d=json.load(open("/etc/docker/daemon.json")); assert d.get("log-driver") == "local" and d.get("log-opts",{}).get("max-size") == "10m" and d.get("log-opts",{}).get("max-file") == "3"' 2>/dev/null; then + echo 'PASS Docker log rotation configuration' +else + echo 'FAIL Docker log rotation configuration differs from repository target' + failed=1 +fi +if id -nG codex | tr ' ' '\n' | grep -Eq '^(sudo|docker)$'; then + echo 'FAIL codex has sudo or Docker group access' + failed=1 +else + echo 'PASS codex is outside sudo and docker groups' +fi for path in /opt/akyldash /etc/akyldash /var/lib/akyldash/data /var/backups/akyldash; do if [[ -d $path ]]; then @@ -50,6 +62,32 @@ for path in /etc/akyldash /var/backups/akyldash; do failed=1 fi done +for path in /etc/akyldash/production.env /etc/akyldash/review_secret; do + if [[ -f $path && $(stat -c %U:%a "$path") == root:600 ]]; then + printf 'PASS protected file %s mode 0600\n' "$path" + elif [[ -e $path ]]; then + printf 'FAIL protected file %s must be root-owned mode 0600\n' "$path" + failed=1 + else + printf 'FAIL protected file %s missing\n' "$path" + failed=1 + fi +done + +checkout=/opt/akyldash/current +compose_file=$checkout/deploy/production/compose.yaml +if git -C "$checkout" diff --quiet HEAD -- deploy/production/compose.yaml deploy/production/Dockerfile.backend deploy/production/Dockerfile.opensearch; then + echo 'PASS production Compose and Dockerfiles match the checked-out Git revision' +else + echo 'FAIL production Compose or Dockerfile has local drift' + failed=1 +fi +if docker compose --env-file /etc/akyldash/production.env -f "$compose_file" config --quiet >/dev/null 2>&1; then + echo 'PASS rendered production Compose configuration' +else + echo 'FAIL production Compose configuration cannot be rendered' + failed=1 +fi if ufw status | grep -q '^Status: active$'; then echo 'PASS UFW active'