Skip to content

fix(enroll): eleventh audit — container liveness, silent set-e exits, &&||antipattern, age-key remediation#183

Merged
mdheller merged 1 commit into
mainfrom
fix/enroll-eleventh-audit
Jun 16, 2026
Merged

fix(enroll): eleventh audit — container liveness, silent set-e exits, &&||antipattern, age-key remediation#183
mdheller merged 1 commit into
mainfrom
fix/enroll-eleventh-audit

Conversation

@mdheller

Copy link
Copy Markdown
Member

Summary

  • HIGH — Foreman wait loop: container crash detected only after 30-min MAX_WAIT timeout. docker exec katello-foreman ... 2>/dev/null silently swallows the "container not running" error and the loop keeps counting. Added docker ps --filter status=running liveness check inside the loop that dies immediately with logs/restart commands. Also tightened progress interval from 60s to 30s.
  • MEDIUMnixos-generate-config ... > ${HW_CONFIG}.tmp: failure triggered silent set -e exit with no remediation message. Added || die with journalctl hint.
  • MEDIUMKATELLO_PASSWORD=$(cat "${KATELLO_ADMIN_PW_FILE}"): missing file (not just empty) caused cat to exit non-zero, firing set -e before the guard die with regeneration steps could run. Added file-existence pre-check with clear rm + re-run remediation.
  • MEDIUMage-keygen -y "${AGE_KEY}": corrupt key exited non-zero, firing set -e before the empty-guard die. Added || die with full regeneration instructions including removing secrets.yaml.
  • MEDIUMnix copy ... && ok ... || warn ... (×2 in step 11): classic &&...|| anti-pattern — if ok exits non-zero for any reason, warn fires on a successful push. Replaced both with if/else.
  • MEDIUM — Same &&...|| in Katello CV promotion loop. Replaced with if/else.

Test plan

  • bash -n scripts/enroll.sh — syntax clean
  • Kill katello-foreman container mid-wait → immediate die with logs command (not 30-min timeout)
  • Remove hardware-configuration.nix target dir (simulate nixos-generate-config fail) → clear die
  • Delete katello-admin-password file before step 4 exits → pre-check die fires with correct remediation
  • Write garbage to age.key, run step 3 re-entry → age-keygen -y || die fires with rm instructions
  • Verify nix copy if/else branches each print correctly

@mdheller mdheller merged commit c7e6b71 into main Jun 16, 2026
@mdheller mdheller deleted the fix/enroll-eleventh-audit branch June 16, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant