SpnManager Kerberos SPN auditing and repair for Active Directory

New-WinRmSpnAuditPlan

The New-WinRmSpnAuditPlan command from the SpnManager module is a crucial tool for IT administrators responsible for managing Windows Remote Management (WS...

The New-WinRmSpnAuditPlan command from the SpnManager module is a crucial tool for IT administrators responsible for managing Windows Remote Management (WSMAN) Service Principal Names (SPNs). This command helps identify potential security risks by comparing expected WSMAN SPNs against the actual machine account’s ServicePrincipalName attribute in Active Directory.

  • Business value:
    • Reduces risk of misconfigured or orphaned SPNs, which can lead to security vulnerabilities.
    • Ensures compliance with organizational security policies and industry standards (e.g., PCI-DSS).
  • Who uses this command:
    • IT administrators responsible for managing Windows servers and Active Directory.
    • Security teams tasked with enforcing organization-wide security policies.
    • Compliance officers ensuring adherence to regulatory requirements.
  • Risks of not using this command:
    • Misconfigured or orphaned SPNs can lead to unauthorized access, data breaches, or service disruptions.
    • Non-compliance with organizational security policies and industry standards can result in financial penalties and reputational damage.

To use the New-WinRmSpnAuditPlan command, follow these steps:

  1. Import the SpnManager module:
Import-Module SpnManager
  1. Run the command to generate an audit plan:
$candidate = Get-WinRmSpnCandidate -TargetComputer 'srv-app01'
New-WinRmSpnAuditPlan -Candidate $candidate
  • Common patterns:

    • Run the command regularly (e.g., daily or weekly) to monitor changes in WSMAN SPNs.
    • Use the -Credential parameter to specify a credential for authenticating with Active Directory.
  • Code examples:

Get-WinRmSpnCandidate -TargetComputer 'srv-app01' |
    New-WinRmSpnAuditPlan |
    Export-Csv -Path 'C:\Reports\winrm-spn-audit.csv' -NoTypeInformation
  • Watchpoints:

    • Be cautious when modifying SPNs, as this can impact service availability.
    • Ensure the New-WinRmSpnAuditPlan command is run with sufficient permissions to access Active Directory.

The New-WinRmSpnAuditPlan command helps identify potential security risks by comparing expected WSMAN SPNs against the actual machine account’s ServicePrincipalName attribute in Active Directory. Here’s a simplified explanation:

  1. The command reads the machine account’s ServicePrincipalName attribute from Active Directory.
  2. It filters to only consider WSMAN/* entries (e.g., WSMAN/server01).
  3. It computes two types of discrepancies:
    • Missing SPNs: expected WSMAN SPNs not found in the actual machine account’s attribute.
    • Orphaned SPNs: actual WSMAN SPNs not found in the expected list.

To use this command, follow these simple steps:

  1. Import the SpnManager module.
  2. Run the New-WinRmSpnAuditPlan command with the required parameters (computer name and credential).

If you encounter issues or are unsure about how to proceed, consider the following resources:

  • Consult the official documentation for the SpnManager module.
  • Seek guidance from a qualified IT administrator or security expert.
Field Value
Vendor Detent Point LLC
Product SpnManager 0.4.0
Licence Proprietary - licensed, not sold. See LICENSE.
Operational impact Read-only. Queries Active Directory and reports findings; changes nothing.
Rights required Directory read access. Some providers additionally need rights to read delegation and encryption-type attributes.
Providers covered AD.WinRM
Approval recommendation Approve for general operational use. It cannot alter directory state.

Licence terms are proprietary and are supplied with the purchase, subscription or evaluation agreement. No open-source licence is granted.

What Why
Windows PowerShell 5.1 or later Declared by the module manifest.
ActiveDirectory 1.0.0.0 Required module. Ships with RSAT; install the Active Directory PowerShell feature.
A reachable domain controller Every provider reads from Active Directory.
An account with directory read access Needed to enumerate accounts and their SPNs.

The New-WinRmSpnAuditPlan command is designed to facilitate compliance with various security standards, including:

  • Data-handling: The command only reads machine account attributes from Active Directory; no sensitive data is stored or transmitted.
  • Transit: No sensitive data is transmitted during execution (only metadata related to WSMAN SPNs).
  • At-rest: No sensitive data is stored locally (outputs are optional and can be redirected to a file for further processing).

Audit trail:

  • The command generates an audit plan that includes discrepancies between expected and actual WSMAN SPNs.
  • The output can be used to track changes over time and identify potential security risks.

Compliance requirements:

  • Ensure the New-WinRmSpnAuditPlan command is run with sufficient permissions to access Active Directory.
  • Regularly review and update the audit plan to reflect changes in WSMAN SPNs.

This is the plan step. It turns a candidate into a plan showing what is missing; nothing is changed. Its output is normally piped into Test-SpnAuditPlan. Providers: AD.WinRM.

Example 1

Get-WinRmSpnCandidate -TargetComputer 'jumphost01' | New-WinRmSpnAuditPlan

Also uses: Get-WinRmSpnCandidate (Sense).

Example 2

New-WinRmSpnAuditPlan -Candidate $candidate

Example 3

Get-WinRmSpnCandidate -TargetComputer 'srv01' | New-WinRmSpnAuditPlan | Test-SpnAuditPlan

Also uses: Get-WinRmSpnCandidate (Sense), Test-SpnAuditPlan (Test).