fix: rdp.session.logoff only on workstations, not DC/Exchange (2.1.12-SAC)
4634/4647 on servers with LogonType 3 flooded SAC with Kerberos/LDAP session ends, not RDP logoffs.
This commit is contained in:
+22
-11
@@ -90,7 +90,7 @@ $script:SkipLogDetailLimit = 15
|
|||||||
# строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах).
|
# строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах).
|
||||||
# Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только
|
# Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только
|
||||||
# исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1).
|
# исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1).
|
||||||
$ScriptVersion = "2.1.11-SAC"
|
$ScriptVersion = "2.1.12-SAC"
|
||||||
|
|
||||||
# Логи (все под InstallRoot)
|
# Логи (все под InstallRoot)
|
||||||
$LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log"
|
$LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log"
|
||||||
@@ -4614,7 +4614,25 @@ function Start-LoginMonitor {
|
|||||||
if ($event.Id -eq 4648) {
|
if ($event.Id -eq 4648) {
|
||||||
$shouldIgnore = $true
|
$shouldIgnore = $true
|
||||||
$ignoreReason = 'EventID 4648 excluded (MonitorInteractiveOnly)'
|
$ignoreReason = 'EventID 4648 excluded (MonitorInteractiveOnly)'
|
||||||
} elseif ($event.Id -in 4624, 4625, 4634, 4647) {
|
} elseif ($event.Id -in 4634, 4647) {
|
||||||
|
if (-not $osKind.IsWorkstation) {
|
||||||
|
$shouldIgnore = $true
|
||||||
|
$ignoreReason = 'logoff 4634/4647 only on workstations (server LT3 is Kerberos/LDAP noise)'
|
||||||
|
} else {
|
||||||
|
$interactiveTypes = @(10)
|
||||||
|
$modeLabel = 'workstation logoff LT10'
|
||||||
|
if ($interactiveTypes -notcontains $eventInfo.LogonType) {
|
||||||
|
$allow4647Workstation = (
|
||||||
|
$event.Id -eq 4647 -and
|
||||||
|
$eventInfo.LogonType -eq 0
|
||||||
|
)
|
||||||
|
if (-not $allow4647Workstation) {
|
||||||
|
$shouldIgnore = $true
|
||||||
|
$ignoreReason = "LogonType $($eventInfo.LogonType) not in $modeLabel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($event.Id -in 4624, 4625) {
|
||||||
if ($osKind.IsWorkstation) {
|
if ($osKind.IsWorkstation) {
|
||||||
$interactiveTypes = @(10)
|
$interactiveTypes = @(10)
|
||||||
$modeLabel = 'workstation LT10'
|
$modeLabel = 'workstation LT10'
|
||||||
@@ -4623,15 +4641,8 @@ function Start-LoginMonitor {
|
|||||||
$modeLabel = 'server LT2/3/10'
|
$modeLabel = 'server LT2/3/10'
|
||||||
}
|
}
|
||||||
if ($interactiveTypes -notcontains $eventInfo.LogonType) {
|
if ($interactiveTypes -notcontains $eventInfo.LogonType) {
|
||||||
$allow4647Workstation = (
|
$shouldIgnore = $true
|
||||||
$osKind.IsWorkstation -and
|
$ignoreReason = "LogonType $($eventInfo.LogonType) not in $modeLabel"
|
||||||
$event.Id -eq 4647 -and
|
|
||||||
$eventInfo.LogonType -eq 0
|
|
||||||
)
|
|
||||||
if (-not $allow4647Workstation) {
|
|
||||||
$shouldIgnore = $true
|
|
||||||
$ignoreReason = "LogonType $($eventInfo.LogonType) not in $modeLabel"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$shouldIgnore = $true
|
$shouldIgnore = $true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File "\\<DC>\NETLOGON\RDP-login-m
|
|||||||
| Источник | Тип SAC |
|
| Источник | Тип SAC |
|
||||||
|----------|---------|
|
|----------|---------|
|
||||||
| Security 4624/4625 | `rdp.login.*` |
|
| Security 4624/4625 | `rdp.login.*` |
|
||||||
| Security 4634/4647 (прямой RDP) | `rdp.session.logoff` → закрытие сессии в SAC |
|
| Security 4634/4647 (прямой RDP, **только рабочая станция**, LT10) | `rdp.session.logoff` → закрытие сессии в SAC |
|
||||||
| Security 5140 | `smb.admin_share.access` |
|
| Security 5140 | `smb.admin_share.access` |
|
||||||
| WinRM Operational 91 | `winrm.session.started` |
|
| WinRM Operational 91 | `winrm.session.started` |
|
||||||
| RD Gateway 302/303 | `rdg.connection.*` → flap 302→303 в SAC |
|
| RD Gateway 302/303 | `rdg.connection.*` → flap 302→303 в SAC |
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.1.11-SAC
|
2.1.12-SAC
|
||||||
|
|||||||
Reference in New Issue
Block a user