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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ documents for different readers.
at all. Every pinned digest is also scanned weekly for fixable HIGH and
CRITICAL CVEs, and each image with findings has an open issue until a scan
finds it clean.
- **Documented decisions and runbooks.** 140 ADRs covering what was chosen
- **Documented decisions and runbooks.** 141 ADRs covering what was chosen
and what was rejected — including the costs accepted knowingly; 57
runbooks for the operations that are easy to get wrong at 1am, one of which
is the handover page a successor reads first. Every critical alert links to
Expand Down Expand Up @@ -236,7 +236,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology
│ ├── architecture.md network.md hardware.md
│ ├── observability.md security.md roadmap.md changelog.md
│ ├── diagrams/ # the network diagram (SVG) and its predecessors
│ ├── adr/ # 140 ADRs — architecture decision records
│ ├── adr/ # 141 ADRs — architecture decision records
│ ├── exercises/ # purple-team exercise records — see its README
│ └── runbooks/ # 57 runbooks; successor-handover.md is the front door
└── Makefile # make help
Expand Down
6 changes: 3 additions & 3 deletions ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ covered in the runbook's [*Run it from `phoenix`*][run] section.
The `tiers`, `shares` and `soc` tags (#448) apply the rest of §5's skeleton and
§11's agents. The nine from `kerberoast` to `spooler` are
[#449](https://github.com/Gerrrt/HomeLab/issues/449)'s deliberate weaknesses
([ADR-0083], and [ADR-0140] for the last three), each off until asked for:
([ADR-0083], and [ADR-0141] for the last three), each off until asked for:
`weakness_<name>_state` is `absent` by default, so a plain run leaves none of
them present. The last three are shipped defaults on the DCs, so for `maq` and
`spooler` a plain run is the change: it sets the quota to 0 and disables
Expand All @@ -161,7 +161,7 @@ ansible-playbook verify.yml # all ni
```

A plain `ansible-playbook verify.yml` asserts every one of these nine weakness
primitives is absent, and that `dsHeuristics` is still unset ([ADR-0140]) — the per-primitive negative test. It does not walk the
primitives is absent, and that `dsHeuristics` is still unset ([ADR-0141]) — the per-primitive negative test. It does not walk the
domain's authorization graph, so it does not by itself prove *no* path to
Domain Admin exists; that graph-level check is a BloodHound collector run with
the tags off ([#451](https://github.com/Gerrrt/HomeLab/issues/451)) — the "run
Expand Down Expand Up @@ -226,7 +226,7 @@ guest.
[ADR-0077]: ../docs/adr/0077-configure-the-lab-domain-with-ansible-from-phoenix.md
[ADR-0080]: ../docs/adr/0080-record-the-lab-domain-with-sysmon-and-capture-on-demand-with-pktmon.md
[ADR-0083]: ../docs/adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md
[ADR-0140]: ../docs/adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md
[ADR-0141]: ../docs/adr/0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md
[ADR-0085]: ../docs/adr/0085-check-the-lab-domains-host-keys-against-keys-read-through-the-guest-agent.md
[runbook]: ../docs/runbooks/build-the-lab-domain.md
[run]: ../docs/runbooks/build-the-lab-domain.md#run-it-from-phoenix
6 changes: 3 additions & 3 deletions ansible/inventory/group_vars/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ soc_agents_velociraptor_msi_url: >-
# never this tree, and the dedicated accounts share it. A role refuses to
# enable a weakness while it is unset. Nothing is enabled by default: a plain
# run leaves all nine absent, which is #449's negative test. The last three
# (ADR-0140) are shipped defaults on the DCs: a plain run turns MAQ and Spooler
# (ADR-0141) are shipped defaults on the DCs: a plain run turns MAQ and Spooler
# off, and leaves LDAP signing enforced.
lab_weak_password: "{{ lookup('ansible.builtin.env', 'LAB_WEAK_PASSWORD') }}"
# The dedicated accounts model Tier 1 service identities, so they live in the
Expand Down Expand Up @@ -150,12 +150,12 @@ lab_weakness_rbcd_account: svc-rbcd
lab_weakness_rbcd_spn: "HOST/svc-rbcd.{{ lab_domain }}"
lab_weakness_rbcd_resource: TITAN

# unsigned_ldap (ADR-0140): Server 2025 enforces LDAP signing while this value
# unsigned_ldap (ADR-0141): Server 2025 enforces LDAP signing while this value
# is unset. present writes it as 0; absent removes it.
lab_weakness_unsigned_ldap_key: HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters
lab_weakness_unsigned_ldap_value: LdapServerEnforceIntegrity

# maq (ADR-0140): ms-DS-MachineAccountQuota on the domain head. present is
# maq (ADR-0141): ms-DS-MachineAccountQuota on the domain head. present is
# Windows' shipped 10; absent is 0.
lab_weakness_maq_present: 10
lab_weakness_maq_absent: 0
Expand Down
2 changes: 1 addition & 1 deletion ansible/lab-domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
# Enable one, watch the SOC see it, disable it, watch the signal go. ADR-0083,
# and the identifiers are in group_vars/all.yaml. The first six are directory
# writes, so they run on the PDC emulator like tiers and population. The last
# three (ADR-0140) are shipped defaults on the DCs, where absent is the
# three (ADR-0141) are shipped defaults on the DCs, where absent is the
# hardened side: a plain run sets MAQ to 0 and disables Spooler on both DCs.
- name: Kerberoast — an SPN on a crackable account
hosts: dc_primary
Expand Down
14 changes: 13 additions & 1 deletion ansible/roles/dns_forwarder/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
# DNS recurses against the root servers whenever the forwarder is slow, and the
# domain's resolution path quietly diverges from the rest of the house (§3).
# No delegation is made on Unbound, ever: ADR-0029.
#
# Remove-DnsServerRootHint clears them from memory only. With the directory's
# root-hint zone empty, the service reloads them from cache.dns at its next
# start, so they came back after every restart (found 2026-11-26). The file is
# left holding one comment: absent, the service logs 1000/1004/1501 errors at
# every start; with a comment only, it starts clean with no hints.
- name: Forward to the gateway, with no root hints
ansible.windows.win_powershell:
script: |
# SupportsShouldProcess is what makes win_powershell run this in check mode,
# where $Ansible.CheckMode keeps it read-only. Without it --check reported a
# change here on every run instead of looking (#448's first run).
[CmdletBinding(SupportsShouldProcess)]
param([string]$Forwarder)
param([string]$Forwarder, [string]$CacheFile)
$changed = $false
$f = Get-DnsServerForwarder
if ((@($f.IPAddress.IPAddressToString) -join ',') -ne $Forwarder -or $f.UseRootHint) {
Expand All @@ -25,6 +31,12 @@
# -InputObject @() does not clear them; piping does (§3).
if (-not $Ansible.CheckMode) { $hints | Remove-DnsServerRootHint -Force }
}
$cache = Join-Path $env:windir 'System32\dns\cache.dns'
if (-not (Test-Path $cache) -or (Get-Content -Raw $cache).Trim() -ne $CacheFile) {
$changed = $true
if (-not $Ansible.CheckMode) { Set-Content -LiteralPath $cache -Value $CacheFile -Encoding Ascii }
}
$Ansible.Changed = $changed
parameters:
Forwarder: "{{ lab_dns_forwarder }}"
CacheFile: "; No root hints: this DC forwards to the gateway only (ADR-0029)."
2 changes: 1 addition & 1 deletion ansible/roles/weakness_maq/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# ansible-playbook lab-domain.yml --tags maq -e weakness_maq_state=present
# and disable by applying the same tag with the default (or =absent). The two
# values are in inventory/group_vars/all.yaml, shared with verify.yml
# (ADR-0083, ADR-0140).
# (ADR-0083, ADR-0141).
weakness_maq_state: absent
2 changes: 1 addition & 1 deletion ansible/roles/weakness_maq/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# ADR-0140: ms-DS-MachineAccountQuota on the domain head. At the shipped 10,
# ADR-0141: ms-DS-MachineAccountQuota on the domain head. At the shipped 10,
# any domain user can create computer accounts, the first step of RBCD and
# shadow-credential chains that need no other switch. present restores 10;
# absent sets 0. Nothing the build does needs it: every join runs as
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/weakness_spooler/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# to Windows' shipped Automatic and running) with
# ansible-playbook lab-domain.yml --tags spooler -e weakness_spooler_state=present
# and disable by applying the same tag with the default (or =absent)
# (ADR-0083, ADR-0140).
# (ADR-0083, ADR-0141).
weakness_spooler_state: absent
2 changes: 1 addition & 1 deletion ansible/roles/weakness_spooler/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# ADR-0140: Print Spooler on the domain controllers. A DC is trusted for
# ADR-0141: Print Spooler on the domain controllers. A DC is trusted for
# unconstrained delegation by default, so a running spooler lets any domain
# user coerce the DC's machine account into authenticating to a host of their
# choosing. present leaves it as Windows ships it; absent stops and disables
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/weakness_unsigned_ldap/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# ansible-playbook lab-domain.yml --tags unsigned_ldap -e weakness_unsigned_ldap_state=present
# and disable by applying the same tag with the default (or =absent). The
# registry location is in inventory/group_vars/all.yaml, shared with verify.yml
# (ADR-0083, ADR-0140).
# (ADR-0083, ADR-0141).
weakness_unsigned_ldap_state: absent
4 changes: 2 additions & 2 deletions ansible/roles/weakness_unsigned_ldap/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# ADR-0140: LDAP signing, off on demand. Server 2025 DCs enforce signing while
# ADR-0141: LDAP signing, off on demand. Server 2025 DCs enforce signing while
# LdapServerEnforceIntegrity is unset. present writes it as 0, so the DC takes
# unsigned simple and SASL binds, which makes NTLM relay to LDAP possible. absent
# removes the value, and the DC returns to the 2025 default.
Expand Down Expand Up @@ -29,7 +29,7 @@
if ($Want -eq 'present') {
if ([int]$p.LDAPServerIntegrity -ne 1) {
throw ("LDAPServerIntegrity is '$($p.LDAPServerIntegrity)', not the shipped 1: " +
'signing would stay required. ADR-0140.')
'signing would stay required. ADR-0141.')
}
if ($null -eq $p.$Name -or [int]$p.$Name -ne 0) {
if (-not $Ansible.CheckMode) {
Expand Down
13 changes: 8 additions & 5 deletions ansible/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
rbcd_state: "{{ weakness_rbcd_state | default('absent') }}"
rbcd_account: "{{ lab_weakness_rbcd_account }}"
rbcd_resource: "{{ lab_weakness_rbcd_resource }}"
# ADR-0140's three, on the DCs.
# ADR-0141's three, on the DCs.
unsigned_ldap_state: "{{ weakness_unsigned_ldap_state | default('absent') }}"
unsigned_ldap_key: "{{ lab_weakness_unsigned_ldap_key }}"
unsigned_ldap_value: "{{ lab_weakness_unsigned_ldap_value }}"
Expand Down Expand Up @@ -157,7 +157,10 @@
$f = Get-DnsServerForwarder
$r["forwards to $Gateway only"] = ((@($f.IPAddress.IPAddressToString) -join ',') -eq $Gateway)
$r['no root hints'] = -not (Get-DnsServerRootHint)
# ADR-0140: dsHeuristics kept as Server 2025 ships it, unset. The
# cache.dns is where the service reloads them from at start.
$r['no root hints in cache.dns'] = -not (Get-Content (Join-Path $env:windir 'System32\dns\cache.dns') `
-ErrorAction SilentlyContinue | Where-Object { $_ -notmatch '^\s*(;|$)' })
# ADR-0141: dsHeuristics kept as Server 2025 ships it, unset. The
# 3051/3054 events at boot are expected; a value here is a hardening.
$dsh = Get-ADObject -Identity ("CN=Directory Service,CN=Windows NT,CN=Services," +
(Get-ADRootDSE).configurationNamingContext) -Properties dsHeuristics
Expand Down Expand Up @@ -382,15 +385,15 @@
}
$r['rbcd matches its toggle'] = ($bHave -eq ($Weak.rbcd_state -eq 'present'))

# maq (ADR-0140): the quota on the domain head, 10 or 0, and
# maq (ADR-0141): the quota on the domain head, 10 or 0, and
# nothing between.
$q = (Get-ADObject -Identity $wbase -Properties 'ms-DS-MachineAccountQuota').'ms-DS-MachineAccountQuota'
$qWant = if ($Weak.maq_state -eq 'present') { $Weak.maq_present } else { $Weak.maq_absent }
$r["machine account quota is $qWant, as maq names"] = ([int]$q -eq [int]$qWant)
}

if ($onDc) {
# unsigned_ldap (ADR-0140): present is the enforcement value at 0
# unsigned_ldap (ADR-0141): present is the enforcement value at 0
# over the shipped LDAPServerIntegrity of 1; absent is the value
# unset, Server 2025's enforced default.
$lp = Get-ItemProperty -Path $Weak.unsigned_ldap_key -ErrorAction SilentlyContinue
Expand All @@ -399,7 +402,7 @@
$r['unsigned_ldap matches its toggle'] = if ($Weak.unsigned_ldap_state -eq 'present') {
$lHave } else { ($null -eq $lv) }

# spooler (ADR-0140): running and Automatic, or stopped and Disabled.
# spooler (ADR-0141): running and Automatic, or stopped and Disabled.
$spl = Get-Service Spooler -ErrorAction SilentlyContinue
$r['spooler matches its toggle'] = if ($Weak.spooler_state -eq 'present') {
[bool]($spl -and $spl.Status -eq 'Running' -and $spl.StartType -eq 'Automatic')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
> [ADR-0077](0077-configure-the-lab-domain-with-ansible-from-phoenix.md) amends the "join none of the estate's loops"
> consequence. The text here is left as written, per ADR-0001 and ADR-0115.
>
> [ADR-0140](0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) amends "LDAP signing on the two DCs" in the
> [ADR-0141](0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) amends "LDAP signing on the two DCs" in the
> list of hardening deliberately removed: it is removed on demand, by the
> `unsigned_ldap` switch, and stays enforced as shipped otherwise. The text
> here is left as written, per ADR-0001 and ADR-0115.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ secret in `phoenix.env`) and
(the weaknesses it said would come)

> [!NOTE]
> [ADR-0140](0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) adds three switches in this model, `unsigned_ldap`,
> [ADR-0141](0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md) adds three switches in this model, `unsigned_ldap`,
> `maq` and `spooler`, under the reopen clause below. For `maq` and `spooler`
> `absent` is the hardened side, so applying them with the defaults changes
> the DCs, where this ADR's six changed nothing on merge. The text here is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ADR-0140: Switch three of the DCs' shipped defaults, and keep dsHeuristics as shipped
# ADR-0141: Switch three of the DCs' shipped defaults, and keep dsHeuristics as shipped

**Status:** Accepted · 2026-11 · amends
[ADR-0029](0029-size-the-lab-domain-and-separate-its-namespace-and-clock.md)
Expand Down
17 changes: 17 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-26

- **Correction to the entry below, "what the `bahamut` audit found,
decided (ADR-0140)".** That decision is
[ADR-0141](adr/0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md).
#1762 merged three minutes earlier with its own ADR-0140, so two ADRs held
the number and `check_docs.py` failed on `main`; the one that landed second
was renumbered. ADR-0140 is #1762's, on Domain Admins network logon.
- **Lab domain: the DCs' root hints came back after every DNS restart.**
`verify.yml`'s "no root hints" check failed on both DCs during the `bahamut`
audit. `roles/dns_forwarder` removed the hints from memory only, and the
service reloads them from `cache.dns` at start. A restart on `leviathan` took
it from 0 hints to 13; with `cache.dns` set aside it came back with 0. The
role now leaves `cache.dns` holding one comment line (a missing file loads
no hints too, but logs errors 1000, 1004 and 1501 at every start), and
`verify.yml` checks the file. Tested on `leviathan`: applied, a second run
changed nothing, and a restart kept 0 hints with resolution working.
`bahamut` changes on the next run. What cleared both DCs' in-memory hints
between two reads that morning is not known.
- **Lab domain: what the `bahamut` audit found, decided (ADR-0140).** The
read-only audit of the PDC emulator (2026-11-13 to 2026-11-25, with
`leviathan` read for the same points) found four things on the DCs that the
Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Ansible, Sysmon and BloodHound each closed with its issue, and the record is in
sub-issue per weakness: #1475 kerberoast, #1476 AS-REP roast, #1477 DCSync,
#1478 resource-based constrained delegation, #1479 unconstrained delegation
and #1480 constrained delegation. It closes when all six are recorded, each
with a detection outcome. The three switches of ADR-0140 (`unsigned_ldap`,
with a detection outcome. The three switches of ADR-0141 (`unsigned_ldap`,
`maq`, `spooler`) are off by default and are not among the six. → [runbook](runbooks/build-the-lab-domain.md)

## last
Expand Down
2 changes: 1 addition & 1 deletion docs/runbooks/build-the-bloodhound-guest.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ containers to come back. They have `restart: unless-stopped`.
SharpHound on a domain host is the path, because the Windows LDAP client
signs and seals over `389` natively. Signing is lifted only by the
`unsigned_ldap` switch
([ADR-0140](../adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md),
([ADR-0141](../adr/0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md),
`build-the-lab-domain.md` §5a). While it is present the Linux collectors
work, but the graph that answers "no path with every switch off" is
SharpHound's, collected with it absent.
Expand Down
12 changes: 9 additions & 3 deletions docs/runbooks/build-the-lab-domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,14 @@ Then the forwarder and the root hints, on `bahamut`:
```powershell
Set-DnsServerForwarder -IPAddress 10.0.30.1 -UseRootHint $false
Get-DnsServerRootHint | Remove-DnsServerRootHint -Force # -InputObject @() does not clear them
Set-Content $env:windir\System32\dns\cache.dns '; No root hints: this DC forwards to the gateway only (ADR-0029).' -Encoding Ascii
```

The last line is what makes it last. `Remove-DnsServerRootHint` clears the hints
from memory only, and the service reloads them from `cache.dns` at its next
start. Deleting the file instead works too, but the service then logs errors
1000, 1004 and 1501 at every start; one comment line loads clean.

> [!CAUTION]
> **Disable root hints, and it is not housekeeping.** Left on, Windows DNS falls
> back to recursing against the root servers whenever the forwarder is slow — so
Expand Down Expand Up @@ -800,8 +806,8 @@ Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.30.50,
This is the one place the §2 rule ("every guest points at .50 and .51") does
not apply: a DC uses its partner then loopback, which is Microsoft's own
guidance and what keeps either DC resolving with the other down. Also remove
the root hints on `leviathan`, exactly as on `bahamut` above — the promotion
command here only sets the forwarder.
the root hints on `leviathan`, exactly as on `bahamut` above, `cache.dns`
included — the promotion command here only sets the forwarder.

Confirm replication before moving on, because a second DC that is not
replicating is worse than no second DC:
Expand Down Expand Up @@ -870,7 +876,7 @@ The six weaknesses #449 asks for — `kerberoast`, `asreproast`, `dcsync`, `ucd`
it ([ADR-0083](../adr/0083-give-the-lab-domain-its-deliberate-weaknesses-as-switchable-tags.md)).
Three more, `unsigned_ldap`, `maq` and `spooler`, switch shipped defaults on
the DCs the same way
([ADR-0140](../adr/0140-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md)).
([ADR-0141](../adr/0141-switch-three-of-the-dcs-shipped-defaults-and-keep-dsheuristics.md)).
A plain run leaves all nine absent.

> [!IMPORTANT]
Expand Down