Skip to content

fix(packer,lab): no plaintext build password left in Panther on Windows clones (#1099) - #1102

Merged
Gerrrt merged 4 commits into
mainfrom
gerrrt/panther-plaintext-1099
Oct 9, 2026
Merged

Gerrrt merged 4 commits into
mainfrom
gerrrt/panther-plaintext-1099

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #1099. The seven running guests were already cleaned through the guest agent on 2026-10-09; this lands the prevention for them and for future clones.

What's there, measured

I checked all seven running Windows guests on 2026-10-09: bahamut, leviathan, titan, ramuh, carbuncle, siren and dot-windows. Every one has C:\Windows\Panther\unattend-original.xml, readable by BUILTIN\Users.

File Password elements <PlainText>true</PlainText> Non-empty values
unattend-original.xml (~9 KB) 2 2 3
unattend.xml (~1.5 KB) 1 0 0 (scrubbed by Setup)

The check counted elements and printed no value.

Where it comes from. It is created during the template build, about half an hour before each clone's own first boot. On carbuncle: created 2026-10-07 15:18Z, SetupComplete.log 15:52Z, and the same pattern on dot-windows. So it's baked into 911 and 912, and every clone inherits it. It's Setup's untouched copy of the build answer file: the build Administrator password and the build AutoLogon.

Why it matters. roles/base rotates the local Administrator away from the build password, but the template reuses that password, and clones Ansible hasn't touched keep it. That includes dot-windows, and any new clone until base runs. On the endpoints, ordinary domain users log on interactively.

The fix, alongside #1103

#1103, merged while this was open, handles each clone's first boot. Its SetupComplete.cmd deletes unattend-original.xml and unattend.xml and refuses to start the guest agent if either survives, and its smoke test checks for them. This PR's own SetupComplete.cmd lines were dropped in favour of it, so that file now matches main. What this PR adds:

  1. packer/windows/scripts/sysprep.ps1: the generated packer-sysprep.cmd runs del /f /q "%WINDIR%\Panther\unattend-original.xml" as its last step before sysprep /generalize, so a rebuilt template no longer carries the file.
  2. ansible/roles/base: win_file … state: absent for unattend-original.xml and unattend-oobe.xml (the first-boot answer file, which also carries the build password) on every run. That cleans any clone of the current templates.
  3. ansible/verify.yml: no plaintext answer file in Panther, which fails if either file is present.

Checked

  • PowerShell's own parser reads sysprep.ps1 with 0 errors (run on carbuncle). The new line sits in packer-sysprep.cmd directly before sysprep.exe.
  • yamllint, check_docs.py and markdownlint pass. ansible-lint runs in CI.

After merge

🤖 Generated with Claude Code

…ws clones (#1099)

C:\Windows\Panther\unattend-original.xml is Setup's untouched copy of the
build answer file. Read on all seven running Windows guests (2026-10-09), it
holds two password elements, both <PlainText>true</PlainText>, readable by
BUILTIN\Users. The check counted them and printed no value. It is created at
template build time, so 911 and 912 carried it into every clone.
Panther\unattend.xml beside it is scrubbed by Setup and stays.

- sysprep.ps1: the generated packer-sysprep.cmd deletes it as its last step
  before sysprep /generalize.
- SetupComplete.cmd: deletes it again before a clone's first logon, and logs
  whether it is gone.
- roles/base: removes it on every run (existing clones, and clones of
  templates built before this). verify.yml asserts it is absent.

Checked on carbuncle without touching Panther: PowerShell's parser reads
sysprep.ps1 with 0 errors, and the new SetupComplete lines, run against a
temp folder, delete a present file and pass over an absent one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 03:12
@Gerrrt Gerrrt added security A credential, an exposure, or a control that is weaker than recorded lab stacks/lab on alexander (VLAN 30) labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The verification can pass while another credential-bearing Panther answer file remains.

1 open finding
What changed in this PR

Removes the plaintext Windows build credential from cloned guests and adds remediation and verification safeguards.

Changes:

  • Deletes the exposed answer file during sysprep and clone setup.
  • Removes it from existing Ansible-managed guests.
  • Adds verification and operational documentation.
File Description
packer/​windows/​scripts/​sysprep.ps1 Deletes the build answer copy before generalization.
packer/​windows/​scripts/​SetupComplete.cmd Adds clone-time deletion and logging.
ansible/​roles/​base/​tasks/​main.yml Removes the exposed file during convergence.
ansible/​verify.yml Adds a credential-file absence check.
docs/​changelog.md Records the finding, fix, and rollout steps.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ansible/verify.yml Resolved
Gerrrt and others added 3 commits October 8, 2026 20:24
unattend-oobe.xml, the answer sysprep uses on a clone's first boot, carries
the build Administrator password in plaintext as well. SetupComplete.cmd
deletes it, but verify.yml checked only unattend-original.xml, so a failed
deletion would pass (review on #1102). roles/base now removes both, and the
check requires both absent. On carbuncle, where both are gone, the check's
expression evaluates True.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…upComplete.cmd (#1099)

#1103, merged alongside, deletes unattend-original.xml and unattend.xml in SetupComplete.cmd and refuses to start the guest agent if either survives, and its smoke test checks for them. This PR's own SetupComplete.cmd lines would have duplicated that step in a weaker form, so they are dropped. The file now matches main. #1102 keeps the template-build deletion in sysprep.ps1, roles/base's cleanup of existing clones and of unattend-oobe.xml, and verify.yml's check. The changelog entry now says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 53fcd9a into main Oct 9, 2026
9 of 10 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/panther-plaintext-1099 branch October 9, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lab stacks/lab on alexander (VLAN 30) security A credential, an exposure, or a control that is weaker than recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Win clones leave the build password in plaintext at C:\Windows\Panther\unattend-original.xml, readable by Users

2 participants