[deploy] Fixes from the Windows smoke: the admin host has no health path (every API path needs a sign-in), -NoService keeps the person who ran it in the folder's ACL, paths may have backslashes; Pebble 2.6.0 in the CI image (the ACME test's version)

This commit is contained in:
2026-11-17 20:55:41 +01:00
parent 49c05e2523
commit d5d522fe4b
4 changed files with 18 additions and 10 deletions
+10 -2
View File
@@ -47,6 +47,10 @@ function Fail($m) { Write-Error "ianitor install: $m"; exit 1 }
function Plain($v, $name) {
if ($v -match '["\\''`$\r\n]') { Fail "$name contains a character that is not allowed" }
}
# A path may have backslashes (they become '/' in the TOML), nothing else that TOML would read.
function PlainPath($v, $name) {
if ($v -match '["''`$\r\n]') { Fail "$name contains a character that is not allowed" }
}
# Paths in TOML with forward slashes (control and Caddy read C:/ProgramData/... as is).
function Fwd($p) { return ($p -replace '\\', '/') }
@@ -55,7 +59,7 @@ if (-not $NoService) {
if (-not $me.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Fail 'run it in an elevated PowerShell (Run as administrator)' }
}
Plain $AdminHost 'AdminHost'; Plain $PreviewDomain 'PreviewDomain'; Plain $PreviewUpstreams 'PreviewUpstreams'
Plain $RoutesRemote 'RoutesRemote'; Plain $DomiRoot 'DomiRoot'
Plain $RoutesRemote 'RoutesRemote'; PlainPath $DomiRoot 'DomiRoot'; PlainPath $Root 'Root'; PlainPath $Bin 'Bin'
$git = (Get-Command git.exe -ErrorAction SilentlyContinue)
if (-not $git) { Fail 'install Git for Windows first (https://git-scm.com/download/win); control keeps the routes in git' }
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
@@ -88,7 +92,11 @@ foreach ($d in 'control', 'edge', 'caddy', 'certs', 'caddy-state', 'logs', 'cred
New-Item -ItemType Directory -Force (Join-Path $Root $d) | Out-Null
}
# Only Administrators, SYSTEM and the services' account (LocalService) see the state.
icacls $Root /inheritance:r /grant:r '*S-1-5-32-544:(OI)(CI)F' '*S-1-5-18:(OI)(CI)F' '*S-1-5-19:(OI)(CI)M' | Out-Null
$grants = @('*S-1-5-32-544:(OI)(CI)F', '*S-1-5-18:(OI)(CI)F', '*S-1-5-19:(OI)(CI)M')
# -NoService runs everything as the person who ran it, who then needs the folder too.
if ($NoService) { $grants += "*$([Security.Principal.WindowsIdentity]::GetCurrent().User.Value):(OI)(CI)F" }
icacls $Root /inheritance:r /grant:r @grants | Out-Null
if ($LASTEXITCODE -ne 0) { Fail "could not set the folder's permissions on $Root" }
function Secret($name) {
$f = Join-Path $Root "credentials\$name"