Repository navigation
fix(packer): clear epoch account-expiry on Kali service accounts so clones don't boot degraded - #1195
Conversation
…lones do not boot degraded Kali package postinsts leave service accounts (lightdm, _gvm, inetsim, nm-*, dnsmasq, ...) with shadow account-expiry at the epoch. lightdm is started a systemd user@<uid>.service for the greeter, whose PAM account step then fails 224/PAM, so every clone of templates 910/902 boots degraded (seen on garuda, #921). The preseed late_command now clears the expiry on exactly the accounts at the epoch; real users are untouched. Refs #1194, #921 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped cleanup correctly targets only shadow expiry field 8 values equal to 1.
0 open findings
What changed in this PR
Clears erroneous epoch account-expiry values from Kali service accounts, preventing clones from booting degraded.
Changes:
- Adds a late-install shadow-account cleanup.
- Documents the underlying LightDM/PAM failure.
| File | Description |
|---|---|
packer/kali/preseed.cfg.pkrtpl |
Clears epoch expiry values in shared Kali templates 902 and 910. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
As-run verification (phoenix + Saruman, 2026-10-14)Rebuilt template 910 from this branch and proved the fix end to end. Build — Smoke — Degraded-state acceptance — full-cloned the fresh 910 to a throwaway (930), booted it, checked, destroyed it: So fresh clones of 910 now inherit a clean Still owed (not blocking this PR): the same check on 902 (ifrit's Kali, same preseed) when it's next built — it will carry the identical defect until a rebuild picks up this change. |
…review) Address review on #1197: the late_command fix is only realised on a rebuilt template, so limit the "not born degraded" claim to a rebuilt 910 and note 902 keeps the defect until rebuilt (#1196); phrase the grep-finds-nothing evidence as a pre-fix observation, since PR #1195 added a chage to the preseed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…11 as-run (#1197) * docs(lab): garuda's SOC enrolment as run, phase 2 Runbook section 11 records section 12 as run on 2026-10-10: staging on odin, both packages verified on garuda, the Wazuh agent enrolled as 009 Active with the password on standard input, the Velociraptor client connected (7 connections server-side), and WazuhAgentsNotConnected expecting garuda and quiet. Changelog entry for the day. Refs #921. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(runbook): record the Kali template epoch-expiry fix in analyst §11 as-run Adds the degraded-state follow-up to §11: root cause (Kali's install layer ships ~14 service accounts expired at the epoch; only lightdm surfaces via user@<uid>.service), the live fix on garuda, the preseed late_command fix, and the 910 rebuild + smoke + fresh-clone verification. Corrects the two earlier notes that said user@968 still fails. The 902 sibling check is owed. Refs #921, #1194, #1195, #1196 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(runbook): scope the 902 guarantee and mark the grep as pre-fix (review) Address review on #1197: the late_command fix is only realised on a rebuilt template, so limit the "not born degraded" claim to a rebuilt 910 and note 902 keeps the defect until rebuilt (#1196); phrase the grep-finds-nothing evidence as a pre-fix observation, since PR #1195 added a chage to the preseed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
What
Add one
late_commandstep topacker/kali/preseed.cfg.pkrtplthat clears a bogus account-expiry Kali's package postinsts leave on service accounts.Why
Kali package postinsts create service accounts (
lightdm,_gvm,inetsim,nm-openvpn,nm-openconnect,dnsmasq,tcpdump,mysql,pcscd,rtkit,Debian-snmp,systemd-network,systemd-timesync,_dhcpcd) with their shadow account-expiry pinned to the epoch (field 8 ==1, 1970-01-02).lightdmis the one that bites: systemd starts auser@<uid>.servicemanager for it (the greeter lingers a session), its PAMaccountstep sees the expired account and fails224/PAM, and the whole guest bootsdegraded.Found on garuda during the #921 §9 pass; fixed live there, and tracked for the template in #1194. This is the template-side fix so fresh clones aren't born degraded.
Change
in-target sh -c 'while IFS=: read -r n pass lastchg min max warn inactive expire rest; do [ "$expire" = 1 ] && chage -E -1 "$n"; done < /etc/shadow'late_command, after package postinsts, so it's the last word before first boot; cloud-init on clones never touches expiry.packer, and a clone's operator) have an empty expiry field and are left alone.while IFS=: readloop (notawk) so there are no$1/$8tokens for the shell or Packer'stemplatefile()to expand; the only interpolation token in the file remains${ssh_public_key}.sh -n-clean.Scope
tpl-kali-saruman) and 902 (ifrit'stpl-kali).903(tpl-debian-13) has the same upstream quirk on two base accounts but is benign (no display manager → no user manager → not degraded), so it needs no change.Verification
${ssh_public_key}); embedded loop passessh -n; commit passesscripts/check_close_keywords.py.scripts/packer-smoke.sh 910, confirm a fresh first boot isrunningnotdegraded; check 902 on ifrit when next built.Closes #1194
🤖 Generated with Claude Code