Harden DLP endpoint collector error handling and print dedupe
This commit is contained in:
@@ -386,6 +386,9 @@ function Evaluate-ClipboardRules {
|
|||||||
[string]$ClipboardText,
|
[string]$ClipboardText,
|
||||||
[string]$ClipboardHash
|
[string]$ClipboardHash
|
||||||
)
|
)
|
||||||
|
if ([string]::IsNullOrEmpty($ClipboardText) -or [string]::IsNullOrEmpty($ClipboardHash)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($rule in @($script:Policy.endpoint.clipboard)) {
|
foreach ($rule in @($script:Policy.endpoint.clipboard)) {
|
||||||
if (-not $rule) { continue }
|
if (-not $rule) { continue }
|
||||||
@@ -724,6 +727,7 @@ function Get-BetterDocumentNameFromPrintServiceEvents {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Write-EndpointLog ("printservice fallback failed: {0}" -f $_.Exception.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
return $null
|
return $null
|
||||||
@@ -786,6 +790,7 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Write-EndpointLog ("clipboard poll failed: {0}" -f $_.Exception.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -813,6 +818,7 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Write-EndpointLog ("usb poll failed: {0}" -f $_.Exception.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -834,12 +840,22 @@ while ($true) {
|
|||||||
$documentName = $eventDocumentName
|
$documentName = $eventDocumentName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$printDocumentNorm = if ($documentName) { [string]$documentName } else { '' }
|
||||||
|
$printSignalKey = ('{0}|{1}|{2}|{3}' -f
|
||||||
|
(Normalize-PrinterForMatch -Value $printerName),
|
||||||
|
(Normalize-OwnerForMatch -Value $owner),
|
||||||
|
$printDocumentNorm.ToLowerInvariant(),
|
||||||
|
'print_job')
|
||||||
|
if (-not (Should-EmitByCooldown -Fingerprint $printSignalKey -CooldownSeconds 90)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
Send-EndpointSignalHeartbeat -SignalType 'print_job' -Data @{
|
Send-EndpointSignalHeartbeat -SignalType 'print_job' -Data @{
|
||||||
printerName = $printerName
|
printerName = $printerName
|
||||||
documentName = $documentName
|
documentName = $documentName
|
||||||
documentNameOriginal = $documentNameOriginal
|
documentNameOriginal = $documentNameOriginal
|
||||||
owner = $owner
|
owner = $owner
|
||||||
|
eventSource = 'win32_printjob'
|
||||||
}
|
}
|
||||||
Evaluate-PrintRules -PrinterName $printerName -DocumentName $documentName -Owner $owner
|
Evaluate-PrintRules -PrinterName $printerName -DocumentName $documentName -Owner $owner
|
||||||
}
|
}
|
||||||
@@ -853,6 +869,7 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Write-EndpointLog ("printjob poll failed: {0}" -f $_.Exception.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -880,6 +897,17 @@ while ($true) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$effectiveDocument = if ($resolvedDocument) { [string]$resolvedDocument } else { [string]$documentName }
|
||||||
|
$printSignalKey = ('{0}|{1}|{2}|{3}' -f
|
||||||
|
(Normalize-PrinterForMatch -Value $printerName),
|
||||||
|
(Normalize-OwnerForMatch -Value $owner),
|
||||||
|
$effectiveDocument.ToLowerInvariant(),
|
||||||
|
'print_job')
|
||||||
|
if (-not (Should-EmitByCooldown -Fingerprint $printSignalKey -CooldownSeconds 90)) {
|
||||||
|
Write-PrintServiceEventTrace -EventSummary $summary -Phase 'skip' -MatchReason 'dedupe-recent-printjob' -ResolvedDocument $resolvedDocument
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
Send-EndpointSignalHeartbeat -SignalType 'print_job' -Data @{
|
Send-EndpointSignalHeartbeat -SignalType 'print_job' -Data @{
|
||||||
printerName = $printerName
|
printerName = $printerName
|
||||||
documentName = if ($resolvedDocument) { $resolvedDocument } else { $documentName }
|
documentName = if ($resolvedDocument) { $resolvedDocument } else { $documentName }
|
||||||
@@ -900,6 +928,7 @@ while ($true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
Write-EndpointLog ("printservice poll failed: {0}" -f $_.Exception.Message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user