Initialize TLS for legacy client updates
Some checks failed
OfficeCom Sentinel Client / validate-client (push) Successful in 23s
OfficeCom Sentinel Client / build-client-windows (push) Failing after 47s

This commit is contained in:
OfficeCom Codex
2026-07-27 01:22:46 +02:00
parent 85f0682769
commit 3f09805999

View File

@@ -40,6 +40,31 @@ function Get-OCSentinelManifest {
} }
} }
function Invoke-OCSentinelUpdater {
param(
[Parameter(Mandatory)][string]$UpdaterPath,
[Parameter(Mandatory)][string]$ManifestUri
)
# Existing clients can still contain an older updater without TLS setup.
# Start it in a prepared child process so it can download the current package.
$escapedUpdaterPath = $UpdaterPath.Replace("'", "''")
$escapedManifestUri = $ManifestUri.Replace("'", "''")
$command = @"
`$protocols = [Net.SecurityProtocolType]::Tls12
if ([Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls13') {
`$protocols = `$protocols -bor [Net.SecurityProtocolType]::Tls13
}
[Net.ServicePointManager]::SecurityProtocol = `$protocols
[Net.ServicePointManager]::Expect100Continue = `$false
& '$escapedUpdaterPath' -ManifestUrl '$escapedManifestUri'
exit `$LASTEXITCODE
"@
& powershell.exe -NoProfile -ExecutionPolicy Bypass -Command $command
return $LASTEXITCODE
}
Initialize-OCSentinelTls Initialize-OCSentinelTls
$installRoot = Join-Path $env:ProgramFiles "OCSentinel" $installRoot = Join-Path $env:ProgramFiles "OCSentinel"
@@ -79,9 +104,9 @@ function Assert-ArtifactSignature {
if (Test-Path -LiteralPath $updaterPath) { if (Test-Path -LiteralPath $updaterPath) {
Write-Host "Existing OCSentinel installation found. Checking for updates." Write-Host "Existing OCSentinel installation found. Checking for updates."
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $updaterPath -ManifestUrl $ManifestUrl $updaterExitCode = Invoke-OCSentinelUpdater -UpdaterPath $updaterPath -ManifestUri $ManifestUrl
if ($LASTEXITCODE -ne 0) { if ($updaterExitCode -ne 0) {
throw "OCSentinel updater exited with code $LASTEXITCODE" throw "OCSentinel updater exited with code $updaterExitCode"
} }
} }
else { else {