# Tombstone lifetime should be retrievable

The tombstone lifetime determines how long deleted Active Directory objects are retained in the database before being permanently removed:

Source: https://maester.dev/docs/tests/AD-FOR-03

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/soulemike" title="Michael Soule · Original author"><img src="https://github.com/soulemike.png" alt="Michael Soule" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/soulemike">Michael Soule</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/ad">Active Directory</a> · Active Directory · Directory configuration · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-FOR-03
```

## Overview

The tombstone lifetime determines how long deleted Active Directory objects are retained in the database before being permanently removed:

- **Accidental Deletion Recovery**: Longer lifetimes provide more time to recover accidentally deleted objects
- **Replication Stability**: Ensures deleted objects replicate to all DCs before being purged
- **Backup Recovery**: Aligns with backup retention strategies for directory recovery
- **Compliance**: Some regulations require specific retention periods for directory data

**Default Values**:
- **180 days**: Default for forests created on Windows Server 2003 SP1 and later
- **60 days**: Default for older forests (Windows 2000/2003 RTM)

#### Control Type

**Preventive**

#### Security Recommendation

- **Minimum 180 Days**: Maintain at least 180 days for adequate recovery time
- **Align with Backups**: Ensure tombstone lifetime matches or exceeds backup retention
- **Monitor Changes**: Track any modifications to this critical setting
- **Document**: Record the current setting and any business requirements

To modify the tombstone lifetime:
```powershell
$configurationNC = (Get-ADRootDSE).configurationNamingContext
Set-ADObject -Identity "CN=Directory Service,CN=Windows NT,CN=Services,$configurationNC" -Replace @{tombstoneLifetime=180}
```

#### How the Test Works

This test retrieves the tombstone lifetime from the Directory Service configuration object and reports the current value along with recommendations.

#### Related Tests

- `Test-MtAdRecycleBinStatus` - Checks if the AD Recycle Bin is enabled
- `Test-MtAdForestFunctionalLevel` - Retrieves the forest functional level (required for Recycle Bin)

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | AD-FOR-03 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Directory configuration |
| Area | Infrastructure hardening |
| Resource type | Tenant |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdTombstoneLifetime](https://github.com/maester365/maester/blob/main/tests/ad/domain/Test.AD-FOR-03.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:Configuration/*:ReadProperty, ActiveDirectory:Ldap:crossRef:ReadProperty |

</details>

## Source

- Test: [`tests/ad/domain/Test.AD-FOR-03.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/domain/Test.AD-FOR-03.ps1)
- Documentation: [`tests/ad/domain/Test.AD-FOR-03.md`](https://github.com/maester365/maester/blob/main/tests/ad/domain/Test.AD-FOR-03.md)
