fix: WinRM RDP update only via git clone on client (0.20.13)

This commit is contained in:
2026-06-20 19:46:22 +10:00
parent 8c1a8fddb1
commit 191fb4e2cf
4 changed files with 8 additions and 28 deletions
+3 -22
View File
@@ -311,34 +311,14 @@ def _rdp_update_powershell_script(
)
safe_branch = _powershell_literal_path((git_branch or "main").strip() or "main")
body = (
"function Invoke-RdpDeploy {\n"
" param([string]$Path)\n"
" Write-Output \"Running: $Path\"\n"
" & $Path\n"
"}\n"
"$deployCandidates = [System.Collections.Generic.List[string]]::new()\n"
"if ($env:USERDOMAIN) {\n"
" $deployCandidates.Add((Join-Path \"\\\\$($env:USERDOMAIN)\\NETLOGON\\RDP-login-monitor\" 'Deploy-LoginMonitor.ps1'))\n"
"}\n"
"try {\n"
" $dom = (Get-CimInstance Win32_ComputerSystem -ErrorAction Stop).Domain\n"
" if ($dom) {\n"
" $deployCandidates.Add((Join-Path \"\\\\$dom\\NETLOGON\\RDP-login-monitor\" 'Deploy-LoginMonitor.ps1'))\n"
" }\n"
"} catch { }\n"
"foreach ($p in $deployCandidates) {\n"
" if (Test-Path -LiteralPath $p) {\n"
" Invoke-RdpDeploy $p\n"
" exit 0\n"
" }\n"
"}\n"
f"$gitUrl = '{safe_repo}'\n"
f"$branch = '{safe_branch}'\n"
"$repoDir = Join-Path $env:ProgramData 'RDP-login-monitor\\_sac_git'\n"
"$gitCmd = Get-Command git.exe -ErrorAction SilentlyContinue\n"
"if (-not $gitCmd) {\n"
" throw 'Deploy-LoginMonitor.ps1 not on NETLOGON and git.exe missing; set win_agent_update_script in SAC or install Git'\n"
" throw 'git.exe not found on client PC — install Git for Windows or set win_agent_update_script in SAC'\n"
"}\n"
"Write-Output \"git: $gitUrl (branch $branch) -> $repoDir\"\n"
"if (-not (Test-Path -LiteralPath (Join-Path $repoDir '.git'))) {\n"
" if (Test-Path -LiteralPath $repoDir) { Remove-Item -LiteralPath $repoDir -Recurse -Force }\n"
" New-Item -ItemType Directory -Path (Split-Path $repoDir -Parent) -Force | Out-Null\n"
@@ -354,6 +334,7 @@ def _rdp_update_powershell_script(
"}\n"
"$deploy = Join-Path $repoDir 'Deploy-LoginMonitor.ps1'\n"
"if (-not (Test-Path -LiteralPath $deploy)) { throw \"Deploy-LoginMonitor.ps1 missing in git checkout: $repoDir\" }\n"
"Write-Output \"Running: $deploy -SourceShareRoot $repoDir\"\n"
"& $deploy -SourceShareRoot $repoDir\n"
)
return _wrap_powershell_body(body)
+1 -1
View File
@@ -1,5 +1,5 @@
"""Единый источник версии SAC (API, health, логи, OpenAPI)."""
APP_NAME = "Security Alert Center"
APP_VERSION = "0.20.12"
APP_VERSION = "0.20.13"
APP_VERSION_LABEL = f"{APP_NAME} v.{APP_VERSION}"