Clarify startup Telegram: Gateway targets internal PCs; exclude Gateway-only from RDS host line
This commit is contained in:
+8
-3
@@ -366,12 +366,17 @@ function Enable-SecurityAudit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Test-RDSDeploymentPresent {
|
function Test-RDSDeploymentPresent {
|
||||||
|
# Узел только с RD Gateway (RDS-Gateway и т.п.) не считаем «полноценным RDS по сессиям» —
|
||||||
|
# для шлюза отдельное сообщение в Telegram (журнал Gateway, 302/303 к целевым ПК).
|
||||||
|
$gatewayOnlyFeatureNames = @('RDS-Gateway', 'RDS-WEB-ACCESS')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Get-Command Get-WindowsFeature -ErrorAction SilentlyContinue) {
|
if (Get-Command Get-WindowsFeature -ErrorAction SilentlyContinue) {
|
||||||
$rdsFeatures = @(Get-WindowsFeature -ErrorAction SilentlyContinue | Where-Object {
|
$rdsFeatures = @(Get-WindowsFeature -ErrorAction SilentlyContinue | Where-Object {
|
||||||
$_.Name -like 'RDS*' -and $_.InstallState -eq 'Installed'
|
$_.Name -like 'RDS*' -and $_.InstallState -eq 'Installed'
|
||||||
})
|
})
|
||||||
if ($rdsFeatures.Count -gt 0) {
|
$sessionOrHostLike = @($rdsFeatures | Where-Object { $gatewayOnlyFeatureNames -notcontains $_.Name })
|
||||||
|
if ($sessionOrHostLike.Count -gt 0) {
|
||||||
return $true
|
return $true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,13 +401,13 @@ function Send-Heartbeat {
|
|||||||
$message += "🖥️ Сервер: $env:COMPUTERNAME`r`n"
|
$message += "🖥️ Сервер: $env:COMPUTERNAME`r`n"
|
||||||
$message += "🕐 Время запуска: $timestamp"
|
$message += "🕐 Время запуска: $timestamp"
|
||||||
if (Test-RDSDeploymentPresent) {
|
if (Test-RDSDeploymentPresent) {
|
||||||
$message += "`r`n🔐 <b>RDS:</b> обнаружена роль/компоненты Remote Desktop Services — в мониторинг входят также входы пользователей через RDS/RDP (события Security 4624/4625, типы входа по настройке скрипта)."
|
$message += "`r`n🔐 <b>RDS (хост сессий):</b> обнаружены компоненты RDS помимо чистого шлюза — в мониторинг входят входы по RDP/RDS на этом узле (Security 4624/4625, типы входа по настройке скрипта)."
|
||||||
}
|
}
|
||||||
if ($EnableRDGatewayMonitoring) {
|
if ($EnableRDGatewayMonitoring) {
|
||||||
try {
|
try {
|
||||||
$gwLog = Get-WinEvent -ListLog $RDGatewayLogName -ErrorAction SilentlyContinue
|
$gwLog = Get-WinEvent -ListLog $RDGatewayLogName -ErrorAction SilentlyContinue
|
||||||
if ($gwLog) {
|
if ($gwLog) {
|
||||||
$message += "`r`n🌐 <b>RD Gateway:</b> журнал доступен — дополнительно фиксируются подключения через RD Gateway (302/303)."
|
$message += "`r`n🌐 <b>RD Gateway:</b> журнал шлюза доступен — дополнительно фиксируются подключения пользователей к <b>внутренним целевым компьютерам</b> через RD Gateway (события 302/303 в журнале шлюза)."
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "D:\Soft\Login_Monitor.p
|
|||||||
- `D:\Soft\Logs\watchdog.log`
|
- `D:\Soft\Logs\watchdog.log`
|
||||||
- Heartbeat:
|
- Heartbeat:
|
||||||
- `D:\Soft\Logs\last_heartbeat.txt` обновляется примерно раз в час (по `$HeartbeatInterval`).
|
- `D:\Soft\Logs\last_heartbeat.txt` обновляется примерно раз в час (по `$HeartbeatInterval`).
|
||||||
- Telegram при старте: если обнаружена роль RDS (или типичный сервис RDS Session Host), в тексте явно указано, что мониторятся и входы через RDS/RDP; при доступном журнале RD Gateway — отдельная строка про события Gateway.
|
- Telegram при старте: при установленном **RD Session Host** (или аналогичных компонентах RDS, не только шлюз) — строка про входы по RDP/RDS на этом сервере; при доступном журнале **RD Gateway** — отдельная строка про подключения к **внутренним целевым ПК** через шлюз (302/303). Узел только с ролью RD Gateway не дублирует формулировку «хост сессий».
|
||||||
|
|
||||||
## 5) Автоматический перезапуск при падении
|
## 5) Автоматический перезапуск при падении
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user