fix: StrictMode-safe File Share audit init (UseGuid key)
Enable-SecurityAudit crashed on init when checking RU/EN File Share attempts because accessing UseGuid on a hashtable without that key throws under Set-StrictMode -Version Latest. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-4
@@ -89,7 +89,7 @@ $script:SkipLogDetailLimit = 15
|
||||
# строки ниже, если правки «мелкие» и вы не хотите менять отображаемую версию в логах).
|
||||
# Рекомендация: при значимых релизах меняйте и $ScriptVersion, и version.txt одинаково; при только
|
||||
# исправлениях на шаре — достаточно поднять patch в version.txt (например 1.3.0.1).
|
||||
$ScriptVersion = "2.0.19-SAC"
|
||||
$ScriptVersion = "2.0.20-SAC"
|
||||
|
||||
# Логи (все под InstallRoot)
|
||||
$LogFile = Join-Path $script:InstallRoot "Logs\login_monitor.log"
|
||||
@@ -1311,12 +1311,12 @@ function Enable-SecurityAudit {
|
||||
$ruCategory = Uc @(0x0414,0x043E,0x0441,0x0442,0x0443,0x043F,0x0020,0x043A,0x0020,0x043E,0x0431,0x044A,0x0435,0x043A,0x0442,0x0430,0x043C)
|
||||
$ruSub = Uc @(0x041E,0x0431,0x0449,0x0438,0x0439,0x0020,0x0434,0x043E,0x0441,0x0442,0x0443,0x043F,0x0020,0x043A,0x0020,0x0444,0x0430,0x0439,0x043B,0x0430,0x043C)
|
||||
$attempts = @(
|
||||
@{ Category = $ruCategory; Sub = $ruSub; Label = 'RU File Share' },
|
||||
@{ Category = 'Object Access'; Sub = 'File Share'; Label = 'EN File Share' },
|
||||
@{ Category = $ruCategory; Sub = $ruSub; Label = 'RU File Share'; UseGuid = $false },
|
||||
@{ Category = 'Object Access'; Sub = 'File Share'; Label = 'EN File Share'; UseGuid = $false },
|
||||
@{ Category = $null; Sub = $guid; Label = 'GUID File Share'; UseGuid = $true }
|
||||
)
|
||||
foreach ($a in $attempts) {
|
||||
if ($a.UseGuid) {
|
||||
if ($a['UseGuid']) {
|
||||
$setArgs = ('/set /subcategory:{{{0}}} /success:enable /failure:enable' -f $a.Sub)
|
||||
$set = Invoke-AuditPol -Arguments $setArgs
|
||||
if ($set.ExitCode -eq 0) {
|
||||
|
||||
@@ -34,7 +34,7 @@ Get-Content "C:\ProgramData\RDP-login-monitor\Logs\login_monitor.log" -Tail 60
|
||||
- Документация по развёртыванию: **[Docs/README.md](Docs/README.md)** (RDP-монитор, Exchange, NETLOGON).
|
||||
- **`Encrypt-DpapiForRdpMonitor.ps1`** — опционально для подготовки DPAPI-строк токена/chat id и пароля SMTP (`$MailSmtpPasswordProtectedB64` в файле настроек).
|
||||
- **Локальные настройки RDP-монитора:** **`login_monitor.settings.ps1`** в каталоге установки (образец **`login_monitor.settings.example.ps1`**). При автообновлении **`Login_Monitor.ps1`** с шары файл настроек **не перезаписывается** (как **`exchange_monitor.settings.ps1`** для Exchange).
|
||||
- **Security Alert Center (SAC):** модуль **`Sac-Client.ps1`** (копируется вместе с `Login_Monitor.ps1`). Режимы **`$UseSAC`**: `off` | `exclusive` | `dual` | `fallback` — контракт в репозитории **security-alert-center** (`docs/agent-integration.md`). Версия релиза: **`$ScriptVersion`** и **`version.txt`** (сейчас **2.0.19-SAC**); **`Sac-Client.ps1`** передаёт ту же версию в SAC (`product_version`).
|
||||
- **Security Alert Center (SAC):** модуль **`Sac-Client.ps1`** (копируется вместе с `Login_Monitor.ps1`). Режимы **`$UseSAC`**: `off` | `exclusive` | `dual` | `fallback` — контракт в репозитории **security-alert-center** (`docs/agent-integration.md`). Версия релиза: **`$ScriptVersion`** и **`version.txt`** (сейчас **2.0.20-SAC**); **`Sac-Client.ps1`** передаёт ту же версию в SAC (`product_version`).
|
||||
|
||||
### Highlights (события в SAC / Telegram)
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.0.19-SAC
|
||||
2.0.20-SAC
|
||||
|
||||
Reference in New Issue
Block a user