Anchor the delegation in AdminSDHolder; document the mechanism

BUILTIN\Administrators is itself a protected group, so adding
Serveurs-Admins to it made m.legault transitively protected too: SDProp
then wiped both ACEs and reset adminCount. doctor caught it.

The durable fix is the one that works in a real domain: the ACE lives in
AdminSDHolder, which SDProp copies onto protected objects every hour, so it
is re-applied rather than deleted. The adminCount workaround is gone.

Lore gains a 2021 note explaining exactly this, in the voice of the
instructor who hit it: the delegation kept vanishing, the vendor explained
AdminSDHolder, the right was moved there and stopped disappearing.
This commit is contained in:
2026-10-24 13:49:08 -04:00
parent 23f4e1f060
commit 5e9be0a0b3
4 changed files with 27 additions and 11 deletions
+9 -9
View File
@@ -99,15 +99,15 @@ try {
Write-LabLog 'dc01: svc_backup already has an ACE on t.smith'
}
# t.smith is a Domain Admin, therefore a "protected" object: SDProp resets
# his security descriptor every hour and deletes any ACE not present in
# AdminSDHolder. Clearing adminCount takes him out of SDProp's scope while
# leaving his Domain Admins membership intact.
try {
Set-ADObject -Identity 't.smith' -Replace @{ adminCount = 0 } -ErrorAction Stop
Write-LabLog 'dc01: t.smith excluded from SDProp (adminCount=0)'
} catch {
Write-LabLog "dc01: could not clear adminCount ($($_.Exception.Message))"
# t.smith is a Domain Admin and m.legault is in BUILTIN\Administrators, so
# both are *protected* objects: SDProp rewrites their security descriptor
# from AdminSDHolder every hour and deletes any ACE that only lives on the
# object. Anchoring the same ACE in AdminSDHolder is what makes it stick —
# SDProp then re-applies it instead of removing it.
$adminSdHolder = "CN=AdminSDHolder,CN=System,$base"
if (-not (dsacls.exe $adminSdHolder | Select-String 'svc_backup')) {
$null = dsacls.exe $adminSdHolder /G '@@NETBIOS@@\svc_backup:GA'
Write-LabLog 'dc01: delegation anchored in AdminSDHolder'
}
# Realistic delegation: the service account manages a plain user who is a