Active Directory 墓碑生命周期安全指南

本文详细解析Active Directory中墓碑生命期的概念及其对系统安全的影响,包含从60天到180天的默认值演变,以及通过PowerShell查询当前设置的实用代码示例。

Active Directory 墓碑生命周期

Active Directory 中的墓碑生命周期(TSL)决定了已删除对象在 AD 中保留的最长时间。原始默认值为 60 天,自 Windows 2003 SP2 起,Windows 版本将此值设置为 180 天。需要注意的是,此设置还会影响备份的有效期和复制行为——如果域控制器在 TSL 期限内未与伙伴进行复制,其他域控制器将忽略该控制器。详情可参考:https://adsecurity.org/?p=81

若您的环境中仍设置为 60 天,建议将其更新为 180 天。虽然这可能会因已删除对象留存时间延长而略微增加 AD 的存储负担,但在需要恢复超过 60 天的数据时,它能提供一定的故障保护机制。

使用 PowerShell 查询墓碑生命周期

以下是通过 AD PowerShell 模块查询墓碑生命周期的代码示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ADRootDSE = Get-ADRootDSE
$ADConfigurationNamingContext = $ADRootDSE.configurationNamingContext
    
$TombstoneObjectInfo = Get-ADObject -Identity "CN=Directory Service,CN=Windows NT,CN=Services,$ADConfigurationNamingContext" -Partition "$ADConfigurationNamingContext" -Properties * 
[int]$TombstoneLifetime = $TombstoneObjectInfo.tombstoneLifetime

IF ($TombstoneLifetime -eq 0) 
 { $TombstoneLifetime = 60 }

Write-Host "AD 林的墓碑生命周期设置为 $TombstoneLifetime 天。"
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计