eventsModule/AdfsEventsModule.psm1
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ---------------------------------------------------- # # Global Constants # # ---------------------------------------------------- $script:CONST_ADFS_ADMIN = "AD FS" $script:CONST_ADFS_AUDIT = "AD FS Auditing" $script:CONST_ADFS_DEBUG = "AD FS Tracing" $script:CONST_SECURITY_LOG = "security" $script:CONST_ADMIN_LOG = "AD FS/Admin" $script:CONST_DEBUG_LOG = "AD FS Tracing/Debug" $script:CONST_LOG_PARAM_SECURITY = "security" $script:CONST_LOG_PARAM_ADMIN = "admin" $script:CONST_LOG_PARAM_DEBUG = "debug" $script:CONST_AUDITS_TO_AGGREGATE = @( 299, 324, 403, 404, 412) $script:CONST_AUDITS_LINKED = @(500, 501, 502, 503, 510) $script:CONST_TIMELINE_AUDITS = @(299, 324, 403, 411, 412) # TODO: PowerShell is not good with JSON objects. Headers should be {}. $script:REQUEST_OBJ_TEMPLATE = '{"num": 0,"time": "1/1/0001 12:00:00 AM","protocol": "","host": "","method": "","url": "","query": "","useragent": "","server": "","clientip": "","contlen": 0,"headers": [],"tokens": [],"ver": "1.0"}' $script:RESPONSE_OBJ_TEMPLATE = '{"num": 0,"time": "1/1/0001 12:00:00 AM","result": "","headers": {},"tokens": [],"ver": "1.0"}' $script:ANALYSIS_OBJ_TEMPLATE = '{"requests": [],"responses": [],"errors": [],"timeline": [],"ver": "1.0"}' $script:ERROR_OBJ_TEMPLATE = '{"time": "1/1/0001 12:00:00 AM","eventid": 0,"level": "", "message": [],"ver": "1.0"}' $script:TIMELINE_OBJ_TEMPLATE = '{"time": "","type": "", "tokentype": "", "rp": "","result": "","stage": 0,"ver": "1.0"}' $script:TOKEN_OBJ_TEMPLATE = '{"num": 0,"type": "","rp": "","user": "","direction": "","claims": [],"oboclaims": [],"actasclaims": [],"ver": "1.0"}' $script:TIMELINE_INCOMING = "incoming" $script:TIMELINE_AUTHENTICATION = "authn" $script:TIMELINE_AUTHORIZATION = "authz" $script:TIMELINE_ISSUANCE = "issuance" $script:TIMELINE_SUCCESS = "success" $script:TIMELINE_FAILURE = "fail" $script:TOKEN_TYPE_ACCESS = "access_token" $script:CONST_ADFS_HTTP_PORT = 0 $script:CONST_ADFS_HTTPS_PORT = 0 $script:DidLoadPorts = $false # ---------------------------------------------------- # # Helper Functions - Querying # # ---------------------------------------------------- function Enable-ADFSAuditing { param( [parameter(Mandatory=$False)] [string[]]$Server="LocalHost" ) <# .SYNOPSIS This script enables ADFS verbose related events from the security, admin, and debug logs. .DESCRIPTION To track ADFS authentication processing there are multiple items which must be enabled on the ADFS server(s). This function provides automation in enabling those items. Specifically, this function enables ADFS sourced Security events in the Security event log, verbose events in the ADFS Admin log, and ADFS tracing events in the ADFS Tracing/Debug log. Note that this function can only run the ADFS properties on remote servers, and not the OS trace log commands. EXAMPLE Enable-ADFSAuditing #> $cs = get-wmiobject -class win32_computersystem -ComputerName "localhost" $DomainRole = $cs.domainrole #Check and add service account to auditing user right if needed $ADFSService = GWMI Win32_Service -Filter "name = 'adfssrv'" -ComputerName "localhost" $ADFSServiceAccount = $ADFSService.StartName $objUser = New-Object System.Security.Principal.NTAccount($ADFSServiceAccount) $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]) $SvcAcctSID = $strSID.Value $SecTempPath = $pwd.path + '\SecTempPath' if((test-path $SecTempPath) -eq $false){$SecPath = New-item -Path $SecTempPath -ItemType Directory} $SecTempPath = $SecTempPath + "\secpol.cfg" $SeceditCmd = secedit /export /cfg $SecTempPath $OldSeSecPriv = Select-string -path $SecTempPath -pattern "SeAuditPrivilege" $OldSeSecPriv = $OldSeSecPriv.Line $NewSeSecPriv = $OldSeSecPriv + ",*" + $SvcAcctSID (gc $SecTempPath).replace($OldSeSecPriv,$NewSeSecPriv) | Out-File -Filepath $SecTempPath secedit /configure /db c:\windows\security\local.sdb /cfg $SecTempPath /areas SECURITYPOLICY $RM = rm -force $SecTempPath -confirm:$false -ErrorAction SilentlyContinue gpupdate /force #Enable ADFS Tracing log $ADFSTraceLogName = "AD FS Tracing/Debug" $ADFSTraceLog = New-Object System.Diagnostics.Eventing.Reader.EventlogConfiguration $ADFSTraceLogName if($ADFSTraceLog.IsEnabled -ne $true) { $ADFSTraceLog.IsEnabled = $true $ADFSTraceLog.SaveChanges() } foreach($Machine in $Server) { Try { $Session = New-PSSession -ComputerName $Machine Set-ADFSAuditingRemote -Session $Session -Enable $True auditpol.exe /set /subcategory:"Application Generated" /failure:enable /success:enable } Catch { Write-Warning "Error enabling ADFS auditing settings on $Machine. Error: $_" } Finally { if($Session) { Remove-PSSession $Session } } } Write-Verbose "ADFS auditing is now enabled." } function Disable-ADFSAuditing { param( [parameter(Mandatory=$False)] [string[]]$Server="LocalHost" ) <# .SYNOPSIS This script disables ADFS verbose related events from the security, admin, and debug logs. .DESCRIPTION To track ADFS authentication processing there are multiple items which must be enabled on the ADFS server(s). This function provides automation for disabling those items so that event logs do not fill up. Note that this function can only run the ADFS properties on remote servers, and not the OS trace log commands. EXAMPLE Disable-ADFSAuditing #> #Disable ADFS Tracing log $ADFSTraceLogName = "AD FS Tracing/Debug" $ADFSTraceLog = New-Object System.Diagnostics.Eventing.Reader.EventlogConfiguration $ADFSTraceLogName if ($ADFSTraceLog.IsEnabled -ne $false) { $ADFSTraceLog.IsEnabled = $false $ADFSTraceLog.SaveChanges() } #Disable security auditing from ADFS $cs = get-wmiobject -class win32_computersystem -ComputerName "localhost" $DomainRole = $cs.domainrole foreach($Machine in $Server) { Try { $Session = New-PSSession -ComputerName $Machine Set-ADFSAuditingRemote -Session $Session -Enable $False auditpol.exe /set /subcategory:"Application Generated" /failure:disable /success:disable } Catch { Write-Warning "Error disabling ADFS auditing settings on $Machine. Error: $_" } Finally { if($Session) { Remove-PSSession $Session } } } Write-Verbose "ADFS auditing is now disabled." } function Set-ADFSAuditingRemote { param( [Parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [Parameter(Mandatory=$True)] [bool]$Enable ) Invoke-Command -Session $Session -ScriptBlock { param($Enable) $OSVersion = gwmi win32_operatingsystem [int]$BuildNumber = $OSVersion.BuildNumber if ( $BuildNumber -le 7601 ) { Add-PsSnapin Microsoft.Adfs.Powershell -ErrorAction SilentlyContinue }else { Import-Module ADFS -ErrorAction SilentlyContinue } $SyncProps = Get-ADFSSyncProperties if ( $SyncProps.Role -ne 'SecondaryComputer' ) { if ( $Enable ) { Set-ADFSProperties -LogLevel @( "FailureAudits", "SuccessAudits", "Warnings", "Verbose", "Errors", "Information") Set-ADFSProperties -AuditLevel Verbose }else{ Set-ADFSProperties -LogLevel @( "Warnings", "Errors", "Information" ) } } } -ArgumentList $Enable } function MakeQuery { <# .DESCRIPTION Performs a log search query to a remote machine, using remote PowerShell, and Get-WinEvent #> param( [parameter(Mandatory=$True)] [string]$Query, [Parameter(Mandatory=$True)] [string]$Log, [Parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [parameter(Mandatory=$false)] [string]$FilePath, [parameter(Mandatory=$false)] [bool]$ByTime, [parameter(Mandatory=$false)] [DateTime]$Start = (Get-Date), [parameter(Mandatory=$false)] [DateTime]$End = (Get-Date), [parameter(Mandatory=$false)] [bool]$IncludeLinkedInstances ) # Get-WinEvent is performed through a remote powershell session to avoid firewall issues that arise from simply passing a computer name to Get-WinEvent Invoke-Command -Session $Session -ArgumentList $Query, $Log, $script:CONST_ADFS_AUDIT, $script:CONST_AUDITS_TO_AGGREGATE, $script:CONST_AUDITS_LINKED, $IncludeLinkedInstances, $ByTime, $Start, $End, $FilePath -ScriptBlock { param( [string]$Query, [string]$Log, [string]$providername, [object]$auditsToAggregate, [object]$auditsWithInstanceIds, [bool] $IncludeLinkedInstances, [bool]$ByTime, [DateTime]$Start, [DateTime]$End, [string]$FilePath) # # Perform Get-WinEvent call to collect logs # $Result = @() if ( $FilePath.Length -gt 0 -and !$ByTime) { $Result += Get-WinEvent -Path $FilePath -FilterXPath $Query -ErrorAction SilentlyContinue -Oldest } elseif ( $ByTime ) { # Adjust times for zone on specific server $TimeZone = [System.TimeZoneInfo]::Local $AdjustedStart = [System.TimeZoneInfo]::ConvertTimeFromUtc($Start, $TimeZone) $AdjustedEnd = [System.TimeZoneInfo]::ConvertTimeFromUtc($End, $TimeZone) # Filtering based on time is more robust when using hashtable filters if($FilePath.Length -gt 0) { $Result += Get-WinEvent -FilterHashtable @{Path = $FilePath; providername = $providername; starttime = $AdjustedStart; endtime = $AdjustedEnd} -ErrorAction SilentlyContinue } elseif ( $Log -eq "security" ) { $Result += Get-WinEvent -FilterHashtable @{logname = $Log; providername = $providername; starttime = $AdjustedStart; endtime = $AdjustedEnd} -ErrorAction SilentlyContinue } else { $Result += Get-WinEvent -FilterHashtable @{logname = $Log; starttime = $AdjustedStart; endtime = $AdjustedEnd} -ErrorAction SilentlyContinue -Oldest } } else { $Result += Get-WinEvent -LogName $Log -FilterXPath $Query -ErrorAction SilentlyContinue -Oldest } # # Process results from Get-WinEvent query # $instanceIdsToQuery = @{} foreach ( $Event in $Result | Where { $null -ne $_ } ) { # Copy over all properties so they remain accessible when remote session terminates $Properties = @() foreach ( $Property in $Event.Properties ) { $Properties += $Property.value } $Event | Add-Member RemoteProperties $Properties if ( $Event.ActivityId ) { # We have an Activity ID, set the CorrelationID field for consistency $Event | Add-Member CorrelationID $Event.ActivityId.Guid } # If we didn't have an ActivityId, try to extract one manually if ( (-not $Event.ActivityId) -and $Event.Properties.count -gt 0 ) { $guidRef = [ref] [System.Guid]::NewGuid() if ( [System.Guid]::TryParse( $Event.Properties[1].Value, $guidRef ) ) { $Event | Add-Member CorrelationID $Event.Properties[1].Value } } # If we want to include events that are linked by the instance ID, we need to # generate a list of instance IDs to query on for the current server if ( $IncludeLinkedInstances ) { if ( $auditsToAggregate -contains $Event.Id ) { # The instance ID in this event should be used to get more data $instanceID = $Event.Properties[0].Value $instanceIdsToQuery[$instanceID] = $Event.CorrelationID } } } # # If we have instance IDs to collect accross, do that collection now # if ( $instanceIdsToQuery.Count -gt 0 ) { foreach ( $eventID in $auditsWithInstanceIds ) { if ( $FilePath ) { $instanceIdResultsRaw = Get-WinEvent -FilterHashtable @{Path= $FilePath; providername = $providername; Id = $eventID } -ErrorAction SilentlyContinue } else { $instanceIdResultsRaw = Get-WinEvent -FilterHashtable @{logname = $Log; providername = $providername; Id = $eventID } -ErrorAction SilentlyContinue } foreach ( $instanceId in $instanceIdsToQuery.Keys ) { $correlationID = $instanceIdsToQuery[$instanceId] foreach ( $instanceEvent in $instanceIdResultsRaw) { if ( $instanceId -eq $instanceEvent.Properties[0].Value ) { # We have an event that we want # Copy data of remote params $Properties = @() foreach ( $Property in $instanceEvent.Properties ) { $Properties += $Property.value } $instanceEvent | Add-Member RemoteProperties $Properties $instanceEvent | Add-Member AdfsInstanceId $instanceEvent.Properties[0].Value $instanceEvent | Add-Member CorrelationID $correlationID $Result += $instanceEvent } } } } } return $Result } } function GetSecurityEvents { <# .DESCRIPTION Perform a query to get the ADFS Security Events #> param( [parameter(Mandatory=$False)] [string]$CorrID, [parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [parameter(Mandatory=$false)] [bool]$ByTime, [parameter(Mandatory=$false)] [DateTime]$Start, [parameter(Mandatory=$false)] [DateTime]$End, [parameter(Mandatory=$false)] [bool]$IncludeLinkedInstances, [parameter(Mandatory=$false)] [string]$FilePath ) $Query = "*[System[Provider[@Name='{0}']]]" -f $script:CONST_ADFS_AUDIT if($CorrID.Length -gt 0) { $Query += " and *[EventData[Data and (Data='{0}')]]" -f $CorrID } # Perform the log query return MakeQuery -Query $Query -Log $script:CONST_SECURITY_LOG -Session $Session -ByTime $ByTime -Start $Start -End $End -IncludeLinkedInstances $IncludeLinkedInstances -FilePath $FilePath } function GetAdminEvents { <# .DESCRIPTION Perform a query to get the ADFS Admin events #> param( [parameter(Mandatory=$False)] [string]$CorrID, [parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [parameter(Mandatory=$false)] [bool]$ByTime, [parameter(Mandatory=$false)] [DateTime]$Start, [parameter(Mandatory=$false)] [DateTime]$End, [parameter(Mandatory=$false)] [string]$FilePath ) # Default to query all $Query = "*[System[Provider[@Name='{0}']]]" -f $script:CONST_ADFS_ADMIN if ( $CorrID.length -gt 0 ) { $Query += " and *[System[Correlation[@ActivityID='{$CorrID}']]]" } return MakeQuery -Query $Query -Log $script:CONST_ADMIN_LOG -Session $Session -ByTime $ByTime -Start $Start -End $End -FilePath $FilePath } function GetDebugEvents { <# .DESCRIPTION Perform a query to get the ADFS Debug logs #> param( [parameter(Mandatory=$False)] [string]$CorrID, [parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [parameter(Mandatory=$false)] [bool]$ByTime, [parameter(Mandatory=$false)] [DateTime]$Start, [parameter(Mandatory=$false)] [DateTime]$End, [parameter(Mandatory=$false)] [string]$FilePath ) # Default to query all $Query = "*[System[Provider[@Name='{0}']]]" -f $script:CONST_ADFS_DEBUG if ( $CorrID.length -gt 0 ) { $Query += " and *[System[Correlation[@ActivityID='{$CorrID}']]]" } return MakeQuery -Query $Query -Log $script:CONST_DEBUG_LOG -Session $Session -ByTime $ByTime -Start $Start -End $End -FilePath $FilePath } function QueryDesiredLogs { <# .DESCRIPTION Query for all logs that were requested from the user input #> param( [parameter(Mandatory=$False)] [string]$CorrID, [parameter(Mandatory=$True)] [System.Management.Automation.Runspaces.PSSession]$Session, [parameter(Mandatory=$false)] [bool]$ByTime, [parameter(Mandatory=$false)] [DateTime]$Start, [parameter(Mandatory=$false)] [DateTime]$End, [parameter(Mandatory=$false)] [bool]$IncludeLinkedInstances, [parameter(Mandatory=$false)] [string]$FilePath ) $Events = @() if ($Logs -contains $script:CONST_LOG_PARAM_SECURITY) { $Events += GetSecurityEvents -CorrID $CorrID -Session $Session -ByTime $ByTime -Start $Start -End $End -IncludeLinkedInstances $IncludeLinkedInstances -FilePath $FilePath } if ($Logs -contains $script:CONST_LOG_PARAM_DEBUG) { $Events += GetDebugEvents -CorrID $CorrID -Session $Session -ByTime $ByTime -Start $Start -End $End -FilePath $FilePath } if ($Logs -contains $script:CONST_LOG_PARAM_ADMIN) { $Events += GetAdminEvents -CorrID $CorrID -Session $Session -ByTime $ByTime -Start $Start -End $End -FilePath $FilePath } return $Events } # ---------------------------------------------------- # # Helper Functions - JSON Management # # ---------------------------------------------------- function NewObjectFromTemplate { param( [parameter(Mandatory=$true)] [string]$Template ) return $Template | ConvertFrom-Json } # ---------------------------------------------------- # # Helper Functions - Event Processing # # ---------------------------------------------------- function Process-HeadersFromEvent { param( [parameter(Mandatory=$true)] [object]$events ) $longText = "" foreach ( $event in $events ) { if ( $event.Id -eq 510 ) { # 510 events are generic "LongText" events. When the LongText that's being # written is header data (from a 403 or 404), then the schema is: # instanceID : $event.RemoteProperties[0] # headers_json : $event.RemoteProperties[1...N] (ex. {"Content-Length":"89","Content-Type":"application/x-www-form-urlencoded", etc. } ) for ( $i=1; $i -le $event.RemoteProperties.Count - 1; $i++ ) { $propValue = $event.RemoteProperties[$i] if ( $propValue -ne "-") { $longText += $propValue } } } } return $longText | ConvertFrom-Json } function Get-ClaimsFromEvent { param( [parameter(Mandatory=$true)] [object]$event ) $keyValuePair = @() for ($i = 1; $i -lt $event.RemoteProperties.Count - 1; $i += 2) { if ($event.RemoteProperties[$i] -ne "-" -and $event.RemoteProperties[$i + 1] -ne "-" ) { $keyValuePair += @($event.RemoteProperties[$i], $event.RemoteProperties[$i + 1]) } } return $keyValuePair } function Process-TokensFromEvent { param( [parameter(Mandatory=$true)] [object]$event, [parameter(Mandatory=$false)] [object]$LinkedEvents ) $allTokens = @() if ( $event.Id -eq 412 -or $event.Id -eq 324 ) { $tokenObj = NewObjectFromTemplate -Template $script:TOKEN_OBJ_TEMPLATE $claims = @() foreach ( $linkedEvent in $LinkedEvents[$event.RemoteProperties[0]] ) #InstanceID { # Get claims out of event $claims += Get-ClaimsFromEvent -event $linkedEvent } $tokenObj.type = $event.RemoteProperties[2] $tokenObj.rp = $event.RemoteProperties[3] $tokenObj.direction = "incoming" $tokenObj.claims = $claims $allTokens += $tokenObj } if ( $event.Id -eq 299 ) { $tokenObjIn = NewObjectFromTemplate -Template $script:TOKEN_OBJ_TEMPLATE $tokenObjOut = NewObjectFromTemplate -Template $script:TOKEN_OBJ_TEMPLATE $claimsIn = @() $claimsOut = @() foreach ( $linkedEvent in $LinkedEvents[$event.RemoteProperties[0]] ) #InstanceID { if ( $linkedEvent.Id -eq 500 ) { # Issued claims $claimsOut += Get-ClaimsFromEvent -event $linkedEvent } if ( $linkedEvent.Id -eq 501 ) { # Caller claims $claimsIn += Get-ClaimsFromEvent -event $linkedEvent } } $tokenObjOut.rp = $event.RemoteProperties[2] $tokenObjOut.direction = "outgoing" $tokenObjIn.claims = $claimsIn $tokenObjOut.claims = $claimsOut $allTokens += $tokenObjIn $allTokens += $tokenObjOut } return $allTokens } function Generate-ErrorEvent { param( [parameter(Mandatory=$true)] [object]$event ) $errorObj = NewObjectFromTemplate -Template $script:ERROR_OBJ_TEMPLATE $errorObj.time = $event.TimeCreated $errorObj.eventid = $event.Id $errorObj.message = $event.Message $errorObj.level = $event.LevelDisplayName return $errorObj } function Generate-ResponseEvent { param( [parameter(Mandatory=$false)] [object]$event, [parameter(Mandatory=$true)] [int]$requestCount, [parameter(Mandatory=$false)] [object]$LinkedEvents ) $response = NewObjectFromTemplate -Template $script:RESPONSE_OBJ_TEMPLATE $response.num = $requestCount # Return an empty response object if we don't have data to use if ( $event.length -eq 0 ) { return $response } $response.time = $event.RemoteProperties[2] #Datetime # "{Status code} {status_description}"" $response.result = "{0} {1}" -f $event.RemoteProperties[3], $event.RemoteProperties[4] $headerEvent = $LinkedEvents[$event.RemoteProperties[0]] #InstanceID if ( $headerEvent -eq $null ) { $headerEvent = @{} } $headersObj = Process-HeadersFromEvent -events $headerEvent $response.headers = $headersObj return $response } function Generate-RequestEvent { param( [parameter(Mandatory=$false)] [object]$event, [parameter(Mandatory=$true)] [int]$requestCount, [parameter(Mandatory=$false)] [object]$LinkedEvents ) $currentRequest = NewObjectFromTemplate -Template $script:REQUEST_OBJ_TEMPLATE $currentRequest.num = $requestCount # Return an empty request object if we don't have data to use if ( -not $event ) { return $currentRequest } $currentRequest.time = $event.RemoteProperties[2] #Date $currentRequest.clientip = $event.RemoteProperties[3] #ClientIP $currentRequest.method = $event.RemoteProperties[4] #HTTP_Method $currentRequest.url = $event.RemoteProperties[5] #URL $currentRequest.query = $event.RemoteProperties[6] #QueryString $currentRequest.useragent = $event.RemoteProperties[9] #UserAgent $currentRequest.contlen = $event.RemoteProperties[10] #ContentLength $currentRequest.server = $event.MachineName $headerEvent = $LinkedEvents[$event.RemoteProperties[0]] #InstanceID if ($headerEvent -eq $null ) { $headerEvent = @{} } $headersObj = Process-HeadersFromEvent -events $headerEvent $currentRequest.headers = $headersObj # Load the HTTP and HTTPS ports, if we haven't already # We need these to convert the 'LocalPort' field in the 403 audit if (-not $script:DidLoadPorts) { $script:CONST_ADFS_HTTP_PORT = (Get-AdfsProperties).HttpPort $script:CONST_ADFS_HTTPS_PORT = (Get-AdfsProperties).HttpsPort $script:DidLoadPorts = $true } if ( $event.RemoteProperties[7] -eq $script:CONST_ADFS_HTTP_PORT) { $currentRequest.protocol = "HTTP" } if ( $event.RemoteProperties[7] -eq $script:CONST_ADFS_HTTPS_PORT) { $currentRequest.protocol = "HTTPS" } return $currentRequest } function Update-ResponseEvent { param( [parameter(Mandatory=$false)] [object]$event, [parameter(Mandatory=$true)] [object]$responseEvent, [parameter(Mandatory=$false)] [object]$LinkedEvents ) if ( $event.Id -eq 404 ) { $responseEvent.time = $event.RemoteProperties[2] #Datetime # "{Status code} {status_description}"" $responseEvent.result = "{0} {1}" -f $event.RemoteProperties[3], $event.RemoteProperties[4] $headerEvent = $LinkedEvents[$event.RemoteProperties[0]] #InstanceID if ($headerEvent -eq $null ) { $headerEvent = @{} } $headersObj = Process-HeadersFromEvent -events $headerEvent $responseEvent.headers = $headersObj return $responseEvent } } function Update-RequestEvent { param( [parameter(Mandatory=$false)] [object]$event, [parameter(Mandatory=$true)] [object]$requestEvent, [parameter(Mandatory=$true)] [int]$requestCount, [parameter(Mandatory=$false)] [object]$LinkedEvents ) if ( $event.Id -eq 403 ) { $newEvent = Generate-RequestEvent -event $event -requestCount $requestCount -LinkedEvents $LinkedEvents # Merge tokens $newEvent.tokens += $requestEvent.tokens return $newEvent } } function Generate-TimelineEvent { param( [parameter(Mandatory=$true)] [object]$event ) $timelineEvent = NewObjectFromTemplate -Template $script:TIMELINE_OBJ_TEMPLATE $timelineEvent.time = $event.TimeCreated # 403 - request received if ( $event.Id -eq 403 ) { $timelineEvent.type = $script:TIMELINE_INCOMING $timelineEvent.result = $script:TIMELINE_SUCCESS return $timelineEvent } # 411 - token validation failure if ( $event.Id -eq 411 ) { $timelineEvent.type = $script:TIMELINE_AUTHENTICATION $timelineEvent.result = $script:TIMELINE_FAILURE $timelineEvent.tokentype = $event.RemoteProperties[1] #Token Type return $timelineEvent } # 412 - authentication success if ( $event.Id -eq 412 ) { $timelineEvent.type = $script:TIMELINE_AUTHENTICATION $timelineEvent.result = $script:TIMELINE_SUCCESS $timelineEvent.tokentype = $event.RemoteProperties[2] #Token Type $timelineEvent.rp = $event.RemoteProperties[3] #RP return $timelineEvent } # 324 - authorization failure if ( $event.Id -eq 324 ) { $timelineEvent.type = $script:TIMELINE_AUTHORIZATION $timelineEvent.result = $script:TIMELINE_FAILURE $timelineEvent.rp = $event.RemoteProperties[3] #RP return $timelineEvent } # 299 - token issuance success if ( $event.Id -eq 299 ) { $timelineEvent.type = $script:TIMELINE_ISSUANCE $timelineEvent.result = $script:TIMELINE_SUCCESS $timelineEvent.rp = $event.RemoteProperties[2] #RP $timelineEvent.tokentype = $script:TOKEN_TYPE_ACCESS return $timelineEvent } return $timelineEvent } function Process-EventsForAnalysis { param( [parameter(Mandatory=$true)] [object]$events ) # TODO: Validate that all events have the same correlation ID, or no correlation ID # Validate that the events are sorted by time $events = $events | Sort-Object TimeCreated $requestCount = 0 $mapRequestNumToObjects = @{} $allErrors = @() $allTimeline = @() $timelineIncomingMarked = $false $LinkedEvents = @{} $PreviousRequestStatus = @() # Do a pre-pass through the events set to generate # a hashtable of instance IDs to their events foreach ( $event in $events ) { if ( $event.AdfsInstanceId ) { if ( $LinkedEvents.Contains( $event.AdfsInstanceId ) ) { # Add event to exisiting list $LinkedEvents[$event.AdfsInstanceId] += $event } else { # Add instance ID and fist event to hashtable $LinkedEvents[$event.AdfsInstanceId] = @() + $event } } } # # Do a second pass through the events to collect all the data we need for analysis # foreach ( $event in $events ) { # Error or warning. We use 'Level' int to avoid localization issues if ( ( $event.Level -ge 1 -and $event.Level -le 3 ) -or ( $event.Level -eq 16 ) ) { $allErrors += Generate-ErrorEvent -event $event } # If this event signals a timeline event, generate it if ( $event.Id -in $script:CONST_TIMELINE_AUDITS) { $allTimeline += Generate-TimelineEvent -event $event } if ( -not $mapRequestNumToObjects[$requestCount] ) { # We don't have a request/response pair to work with, so create one now $currentRequest = Generate-RequestEvent -requestCount $requestCount $currentResponse = Generate-ResponseEvent -requestCount $requestCount $mapRequestNumToObjects[$requestCount] = @($currentRequest, $currentResponse) } # 411 - token validation failure if ( $event.Id -eq 411 ) { # TODO: Use for error } # 412 - authentication success or 324 - authorization failure if ( $event.Id -eq 412 -or $event.Id -eq 324 ) { # Use this for caller identity on request object $tokenObj = Process-TokensFromEvent -event $event -LinkedEvents $LinkedEvents $tokenObj[0].num = $requestCount $currentRequest = $mapRequestNumToObjects[$requestCount][0] $currentRequest.tokens += $tokenObj[0] } # 299 - token issuance success if ( $event.Id -eq 299 ) { $tokenObj = Process-TokensFromEvent -event $event -LinkedEvents $LinkedEvents $tokenObj[0].num = $requestCount $tokenObj[1].num = $requestCount $currentRequest = $mapRequestNumToObjects[$requestCount][0] $currentRequest.tokens += $tokenObj[0] $currentResponse = $mapRequestNumToObjects[$requestCount][1] $currentResponse.tokens += $tokenObj[1] } # 403 - request received if ( $event.Id -eq 403 ) { # We have a new request, so generate a request/response pair, and store it if ( $PreviousRequestStatus.Count -gt 0 ) { # We have a previous request in the pipeline. Finalize that request and generate a new one $requestCount += 1 $currentRequest = Generate-RequestEvent -event $event -requestCount $requestCount -LinkedEvents $LinkedEvents $currentResponse = Generate-ResponseEvent -requestCount $requestCount $mapRequestNumToObjects[$requestCount] = @($currentRequest, $currentResponse) } else { $currentRequest = $mapRequestNumToObjects[$requestCount][0] $updatedRequest = Update-RequestEvent -event $event -requestCount $requestCount -requestEvent $currentRequest -LinkedEvents $LinkedEvents $mapRequestNumToObjects[$requestCount][0] = $updatedRequest } $PreviousRequestStatus += 403 } # 404 - response sent if ( $event.Id -eq 404 ) { if ( $PreviousRequestStatus.Count -gt 0 -and $PreviousRequestStatus[-1] -eq 404 ) { # We have received two 404 events without a 403. We should create a new request/response pair $requestCount += 1 $currentRequest = Generate-RequestEvent -requestCount $requestCount $currentResponse = Generate-ResponseEvent -requestCount $requestCount -event $event -LinkedEvents $LinkedEvents $mapRequestNumToObjects[$requestCount] = @($currentRequest, $currentResponse) } else { $currentResponse = $mapRequestNumToObjects[$requestCount][1] $updatedResponse = Update-ResponseEvent -event $event -responseEvent $currentResponse -LinkedEvents $LinkedEvents $mapRequestNumToObjects[$requestCount][1] = $updatedResponse } # We do not mark a request/response pair as complete until we have a new request come in, # since we sometimes see events after the 404 (token issuance, etc.) $PreviousRequestStatus += 404 } } # # Generate the complete analysis JSON object # $analysisObj = NewObjectFromTemplate -Template $script:ANALYSIS_OBJ_TEMPLATE $allRequests = @() $allResponses = @() foreach ( $requestKey in $mapRequestNumToObjects.keys ) { $allRequests += $mapRequestNumToObjects[$requestKey][0] $allResponses += $mapRequestNumToObjects[$requestKey][1] } $analysisObj.requests = $allRequests $analysisObj.responses = $allResponses $analysisObj.errors = $allErrors $analysisObj.timeline = $allTimeline return $analysisObj } function AggregateOutputObject { param( [parameter(Mandatory=$true, Position=0)] [ValidateNotNullOrEmpty()] [string]$CorrID, [parameter(Mandatory=$true,Position=1)] [AllowEmptyCollection()] [PSObject[]]$Events, [parameter(Mandatory=$true,Position=2)] [AllowEmptyCollection()] [PSObject]$Data) $Output = New-Object PSObject -Property @{ "CorrelationID" = $CorrID "Events" = $Events "AnalysisData" = $Data } return $Output } # ---------------------------------------------------- # # Exported Functions # # ---------------------------------------------------- function Write-ADFSEventsSummary { <# .DESCRIPTION This cmdlet consumes a piped-in list of Event objects, and produces a summary table of the relevant data from the request. Note: this function should only be used on a list of Event objects that all contain the same correlation ID (i.e. all of the events are from the same user request) #> param( [parameter(ValueFromPipeline=$True)] [PSObject]$Events ) foreach($Event in $Events) { $newRow = New-Object PSObject -Property @{ Time = $Event.TimeCreated Level = $Event.LevelDisplayName EventID = $Event.Id Details = $Event.Message CorrelationID = $Event.CorrelationID Machine = $Event.MachineName Log = $Event.LogName } Write-Output $newRow } } function Get-AdfsEvents { <# .SYNOPSIS This script gathers ADFS related events from the security, admin, and debug logs into a single file, and allows the user to reconstruct the HTTP request/response headers from the logs. .DESCRIPTION Given a correlation id, the script will gather all events with the same identifier and reconstruct the request and response headers if they exist. Using the 'All' option (either with or without headers enabled) will first collect all correlation ids and proceed to gather the events for each. If start and end times are provided, all events that fall into that span will be returned. The start and end times will be assumed to be base times. That is, all time conversions will be based on the UTC of these values. .EXAMPLE Get-AdfsEvents -Logs Security, Admin, Debug -CorrelationID 669bced6-d6ae-4e69-889b-09ceb8db78c9 -Server LocalHost, MyServer .Example Get-AdfsEvents -CorrelationID 669bced6-d6ae-4e69-889b-09ceb8db78c9 -Headers .EXAMPLE Get-AdfsEvents -Logs Admin -All .EXAMPLE Get-AdfsEvents -Logs Debug, Security -All -Headers -Server LocalHost, Server1, Server2 .Example Get-AdfsEvents -Logs Debug -StartTime (Get-Date -Date ("2017-09-14T18:37:26.910168700Z")) -EndTime (Get-Date) -Headers #> # Provide either correlation id, 'All' parameter, or time range along with logs to be queried and list of remote servers [CmdletBinding(DefaultParameterSetName='CorrelationIDParameterSet')] param( [parameter(Mandatory=$false, Position=0)] [ValidateSet("Admin", "Debug", "Security")] [string[]]$Logs = @("Security","Admin"), [parameter(Mandatory=$true, Position=1, ParameterSetName="CorrelationIDParameterSet")] [ValidateNotNullOrEmpty()] [string]$CorrelationID, [parameter(Mandatory=$true, Position=1, ParameterSetName="AllEventsSet")] [switch]$All, [parameter(Mandatory=$true, Position=1, ParameterSetName="AllEventsByTimeSet")] [DateTime]$StartTime, [parameter(Mandatory=$true, Position=2, ParameterSetName="AllEventsByTimeSet")] [DateTime]$EndTime, [parameter(Mandatory=$false)] [switch]$CreateAnalysisData, [parameter(Mandatory=$false, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] [string[]]$Server="LocalHost", [parameter(Mandatory=$false, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] [string]$FilePath, [parameter(Mandatory=$false, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] [PSCredential]$Credential ) # TODO: Add warning if environment is not Win2016 if ($Server -eq "*") { $Server = @() $nodes = (Get-AdfsFarmInformation).FarmNodes foreach( $server in $nodes) { $Server += $server } } $ServerList = @() # Validate timing parameters if ( $StartTime -ne $null -and $EndTime -ne $null ) { if ( $EndTime -lt $StartTime ) { $temp = $StartTime $StartTime = $EndTime $EndTime = $temp Write-Warning "The EndTime provided is earlier than the StartTime. Swapping time parameters and continuing." } $ByTime = $true } else { $ByTime = $false # Set values to prevent binding issues when passing parameters $StartTime = Get-Date $EndTime = Get-Date } # Validate Correlation ID is a valid GUID $guidRef = [ref] [System.Guid]::NewGuid() if ( (!$All -and !$ByTime) -and ($CorrelationID.length -eq 0 -or ![System.Guid]::TryParse( $CorrelationID, $guidRef )) ){ Write-Error "Invalid Correlation ID. Please provide a valid GUID." Break } $Events = @() # Iterate through each server, and collect the required logs foreach ( $Machine in $Server ) { $includeLinks = $false if ( $CreateAnalysisData ) { $includeLinks = $true } Try { $Session = $null if ( $Credential -eq $null ) { $Session = New-PSSession -ComputerName $Machine } else { $Session = New-PSSession -ComputerName $Machine -Credential $Credential } $Events += QueryDesiredLogs -CorrID $CorrelationID -Session $Session -ByTime $ByTime -Start $StartTime.ToUniversalTime() -End $EndTime.ToUniversalTime() -IncludeLinkedInstances $includeLinks -FilePath $FilePath } Catch { Write-Warning "Error collecting events from $Machine. Error: $_" } Finally { if ( $Session ) { Remove-PSSession $Session } } } $EventsByCorrId = @{} # Collect events by correlation ID, and store in a hashtable foreach ( $Event in $Events ) { $ID = [string] $Event.CorrelationID if(![string]::IsNullOrEmpty($ID) -and $EventsByCorrId.Contains($ID)) { # Add event to exisiting list $EventsByCorrId.$ID = $EventsByCorrId.$ID + $Event } elseif(![string]::IsNullOrEmpty($ID)) { # Add correlation ID and fist event to hashtable $EventsByCorrId.$ID = @() + $Event } } # Note: When we do the correlation ID aggregation, we are dropping any events that do not have a correlation ID set. # All Admin logs should have a correlation ID, and all audits should either have a correlation ID, or have a separate # record, which is identical, but contains a correlation ID (we do this for audits that have an instance ID, but no correlation ID) foreach ( $corrId in $EventsByCorrId.Keys ) { $eventsData = @() if ( $EventsByCorrId[$corrId] ) { $eventsData = $EventsByCorrId[$corrId] } $dataObj = @{} if ( $CreateAnalysisData ) { $dataObj = Process-EventsForAnalysis -events $eventsData } $aggObject = AggregateOutputObject -Data $dataObj -Events $eventsData -CorrID $corrId Write-Output $aggObject } } # # Export the appropriate modules # Export-ModuleMember -Function Enable-ADFSAuditing Export-ModuleMember -Function Disable-ADFSAuditing Export-ModuleMember -Function Get-AdfsEvents Export-ModuleMember -Function Write-ADFSEventsSummary # SIG # Begin signature block # MIIjhAYJKoZIhvcNAQcCoIIjdTCCI3ECAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC0dOXsd4rGNVMj # Z4oUQ+7IDdNTS5yq8mEEWO5D3ge4i6CCDYIwggYAMIID6KADAgECAhMzAAABXF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