Active Directory安全提示 #7:墓碑生命周期
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 天。"
|