geenforce: harden allowlist + fix share-less kiosk client and display scope

This commit is contained in:
2026-07-28 17:09:35 -04:00
parent 9b133b0cce
commit 8f0c110dda
6 changed files with 229 additions and 46 deletions

View File

@@ -55,7 +55,13 @@ param(
function Write-Log {
param([string]$Message, [string]$Level = 'INFO')
$line = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [$Level] $Message"
try { Add-Content -LiteralPath $LogFile -Value $line -ErrorAction SilentlyContinue } catch {}
try {
$logDir = Split-Path -Parent $LogFile
if ($logDir -and -not (Test-Path $logDir)) {
New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null
}
Add-Content -LiteralPath $LogFile -Value $line -ErrorAction SilentlyContinue
} catch {}
Write-Host $line
}
@@ -164,8 +170,23 @@ try {
# code, or emit several objects. ConvertTo-ShopdbSummary adapts whatever it
# returns into a well-formed summary hashtable so the report stage always
# gets clean input (we do NOT assume the engine was fixed).
# The engine requires -InstallerRoot (base for any relative Source/Installer
# path) and -LogFile. Shadow runs off the share, so relative paths resolve
# against the share scope dir. Cutover rewrites payloads to ABSOLUTE local
# paths, so InstallerRoot is only a harmless fallback base (the payload cache).
if ($ShadowMode -and $ShareManifestPath) {
$installerRoot = Split-Path -Parent $ShareManifestPath
} else {
$installerRoot = Join-Path (Split-Path -Parent $manifestToRun) 'payloads'
}
if ($installerRoot -and -not (Test-Path $installerRoot)) {
New-Item -ItemType Directory -Path $installerRoot -Force -ErrorAction SilentlyContinue | Out-Null
}
$engineLog = $LogFile -replace '\.log$', '-engine.log'
Write-Log "Running engine against $manifestToRun"
$engineResult = & $EnginePath -ManifestPath $manifestToRun -PCType $Scope
$engineResult = & $EnginePath -ManifestPath $manifestToRun -PCType $Scope `
-InstallerRoot $installerRoot -LogFile $engineLog
$summary = ConvertTo-ShopdbSummary -EngineResult $engineResult
# Report the result (best-effort).