# DC non-standard LDAPS port count should be retrievable

Domain controllers typically use the standard LDAPS port (636) for secure directory services communication. Non-standard LDAPS ports may indicate:

Source: https://maester.dev/docs/tests/AD-DCD-02

<!-- 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 · Domain controllers · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-DCD-02
```

## Overview

Domain controllers typically use the standard LDAPS port (636) for secure directory services communication. Non-standard LDAPS ports may indicate:

- **Custom SSL/TLS configurations** that could affect secure LDAP client connectivity
- **Security evasion attempts** where alternate ports are used to bypass network monitoring
- **Legacy or specialized deployments** with unique security requirements
- **Load balancer or proxy configurations** using different port mappings

Using non-standard LDAPS ports can cause issues with:
- Secure LDAP (LDAPS) client connectivity
- Certificate-based authentication
- Applications hardcoded to use port 636
- Network security monitoring and compliance auditing

#### Control Type

**Detective**

#### Security Recommendation

1. **Use standard ports where possible**: Port 636 is the industry standard for LDAPS and should be used unless there's a specific requirement
2. **Document security exceptions**: Any non-standard ports should be documented with security justification
3. **Ensure proper certificate configuration**: Non-standard LDAPS ports must have valid SSL/TLS certificates configured
4. **Audit regularly**: Review non-standard port usage during security audits to detect unauthorized changes

#### How the Test Works

This test retrieves all domain controllers and checks their configured LDAPS (SSL) port. The standard LDAPS port is 636. The test reports:

- Total number of domain controllers
- Number of DCs using the standard LDAPS port (636)
- Number of DCs using non-standard LDAPS ports
- Names of DCs with non-standard ports and the specific ports they use

#### Related Tests

- `Test-MtAdDcNonStandardLdapPortCount` - Checks for non-standard LDAP ports
- `Test-MtAdDcReadOnlyCount` - Analyzes RODC deployment

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-DCD-02 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Domain controllers |
| Area | Infrastructure hardening |
| Resource type | DomainController |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdDcNonStandardLdapsPortCount](https://github.com/maester365/maester/blob/main/tests/ad/domain-controller/Test.AD-DCD-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:nTDSDSA:ReadProperty |

</details>

## Source

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