Kerberos and WinRM Troubleshooting in Idira SIA Environment
Environment
Secure Infrastructure Access (formerly DPA) DPA for RDP
Procedure
Overview
This document summarizes a discussion on how Kerberos authentication integrates with WinRM in a Windows domain environment, particularly in the context of Idira Secure Infrastructure Access (SIA). The focus is on using a privileged domain "strong account" to manage and delete ephemeral user profiles on target machines. Key issues include lingering local profiles after domain user deletion, potential Kerberos ticket failures, SPN misconfigurations, and troubleshooting steps via event logs and commands.
Key Concepts
Kerberos in WinRM Connections
- WinRM (Windows Remote Management) uses Kerberos by default for secure authentication in domain setups via the "Negotiate" provider.
- Process:
- Client (e.g., Idira SIA) requests a Ticket-Granting Ticket (TGT) from the Domain Controller (KDC).
- Then, requests a Service Ticket for the target's WinRM service, identified by a Service Principal Name (SPN).
- Tickets are presented to the target machine, allowing secure access without sending credentials.
- In Idira SIA:
- Strong account (privileged domain account) connects via WinRM to target machines.
- Used to delete ephemeral user profiles (temporary accounts created for sessions).
- Ephemeral users: Domain-level (created under domain root) and local (profiles on target machines under C:\Users).
Service Principal Name (SPN)
- SPN: Unique identifier in Active Directory mapping a service (e.g., WinRM) to an account.
- Examples: HTTP/targetmachine.domain.com or WSMAN/targetmachine.domain.com.
- Registered to the machine account or service account running WinRM.
- Issues: Missing, duplicated, or mismatched SPNs cause Kerberos failures (e.g., "access denied" or "invalid token").
Strong Account Interaction
- WinRM service on target runs as SYSTEM (tied to machine's domain identity).
- Strong account authenticates via Kerberos ticket for the target's SPN.
- Once connected, strong account needs local admin rights to delete profiles (e.g., using PowerShell commands like Remove-CimInstance for profiles).
- Issue Scenario:
- Domain ephemeral user deleted from Active Directory root.
- Local profile persists on target (e.g., due to permissions, locked files, or command failures).
Common Issues
- Kerberos Ticket Problems: Invalid/expired tickets, clock skew (>5 min time difference), or fallback to NTLM.
- Permissions: Strong account lacks local admin on target or privileges for profile deletion.
- Profile Cleanup Failures: Locked registry hives, open files, or SID mismatches after domain deletion.
- WinRM Config: Not set to use Negotiate (Kerberos).
Troubleshooting Steps
Verify SPN and WinRM Config
- Check SPN: setspn -Q HTTP/targetmachine.domain.com (queries if SPN exists and to which account it's tied).
- Add SPN if missing: setspn -S HTTP/targetmachine.domain.com domain\strongaccount.
- WinRM Config: winrm get winrm/config (ensure Authentication > Negotiate is enabled).
- Manual Test: Use PowerShell Invoke-Command -ComputerName targetmachine -ScriptBlock { Get-CimInstance -Class Win32_UserProfile | Where { $_.LocalPath -like "*ephemeraluser*" } | Remove-CimInstance } as the strong account.
Enable and Check Auditing
- Auditing may need enabling for detailed logs (not always on by default for all events).
- Check Policy: auditpol /get /category:* (look for "Logon" and "Account Logon" set to Success/Failure).
- Enable Logon Auditing: auditpol /set /subcategory:"Logon" /success:enable /failure:enable.
- Note: Use forward slashes (/) in auditpol commands, e.g., auditpol /set /subcategory:"Logon" /success:enable /failure:enable.
Key Event IDs in Windows Event Logs
Inspect logs on the target machine via Event Viewer.
Security Log
- 4624: Successful logon (confirm Kerberos use and SPN).
- 4634: Logoff.
- 4672: Privileges assigned (check for deletion rights).
- 4771: Kerberos pre-authentication failed (credential/clock issues).
- 4768: Kerberos TGT granted.
- 4776: Credential validation (NTLM fallback).
System Log
- 7045: Service installed/modified (WinRM changes).
- 10016: DCOM errors (WinRM/PowerShell issues).
- 7001/7002: Service Control Manager (WinRM start/stop).
Application Log
- 1530: Profile unload/deletion failure (key for lingering profiles, e.g., "access denied" or locked).
- 1511: Couldn't find local profile.
- 1515: Profile unloading issue.