Skip to content

fix: harden enrollment against critical failure modes - #173

Merged
mdheller merged 1 commit into
mainfrom
fix/enrollment-hardening
Jun 16, 2026
Merged

fix: harden enrollment against critical failure modes#173
mdheller merged 1 commit into
mainfrom
fix/enrollment-hardening

Conversation

@mdheller

Copy link
Copy Markdown
Contributor

Critical fixes before P0 hardware test

Brick-risk eliminations

  • sops.validateSopsFiles = false: pass-1 nixos-rebuild switch no longer fails activation when /etc/sourceos/age.key and secrets.yaml don't exist yet. Without this, first boot after pass-1 could be unbootable if sops-nix crashed activation.
  • sourceos-syncd ConditionPathExists: daemon now stays inert on pass-1 boot until the sops-decrypted password file actually exists. Previously it would restart every 30s with a credential load error and fill the journal.
  • nixos-rebuild || true removed: both pass-1 and pass-2 now write a full log to /tmp/sourceos-enroll-pass{1,2}-*.log and die with a clear error on failure. Silent pass-through was masking rebuild failures.

Idempotency safeguards

  • Age key consistency check: if secrets.yaml already exists, enroll.sh now verifies it decrypts with the current age key before proceeding. Catches the "key replaced, old ciphertext orphaned" case at step 3 instead of at first boot.
  • Partial harmonia/minisign key detection: if exactly one file of a key pair exists, the script dies immediately rather than silently regenerating and orphaning cache signatures.

Other preflight/recovery improvements

  • Disk space check (100 GB minimum) added to step 0
  • Network check (curl https://api.github.com) added to step 0
  • prophet-platform clone failure is now fatal (was silently swallowed)
  • Foreman timeout configurable via FOREMAN_WAIT_TIMEOUT (default 1800s) with actionable recovery instructions
  • minisign -W flag for passwordless key generation (no interactive prompt)
  • Phase B runbook: nixos-infect and git clone both fail-closed before reboot
  • Troubleshooting section: age key mismatch, partial key state, rebuild failure recovery

…are test

- sops.validateSopsFiles = false: prevents activation failure on pass-1
  nixos-rebuild when age.key/secrets.yaml don't yet exist
- sourceos-syncd ConditionPathExists gate: service stays inert until the
  katello password file is decrypted by sops; no restart spam on pass-1 boot
- enroll.sh: remove || true from both nixos-rebuild calls; failures now log
  to /tmp/sourceos-enroll-pass{1,2}-*.log and die with a clear message
- enroll.sh: disk space (100 GB) and network preflight checks added
- enroll.sh: prophet-platform clone is fatal if both SSH and HTTPS fail
- enroll.sh: age key consistency check — if secrets.yaml exists, verify it
  decrypts with the current key before proceeding
- enroll.sh: partial harmonia/minisign key state → die immediately rather
  than silently regenerate and orphan cache signatures
- enroll.sh: Foreman timeout is configurable (FOREMAN_WAIT_TIMEOUT, default
  1800s) with actionable recovery instructions on expiry
- enroll.sh: minisign -W flag for passwordless key generation (no prompt)
- M2_ENROLL.md: Phase B now fails closed if nixos-infect or git clone fails
- M2_ENROLL.md: troubleshooting entries for age key mismatch, partial key
  state, and rebuild failure recovery
@mdheller
mdheller merged commit c54d347 into main Jun 16, 2026
@mdheller
mdheller deleted the fix/enrollment-hardening branch June 16, 2026 18:17
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