[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:
@@ -335,10 +335,9 @@ impl Control {
|
||||
share_links: false,
|
||||
device_certs: false,
|
||||
access_log: "off".into(),
|
||||
health_check: Some(crate::hostspec::HealthCheckSpec {
|
||||
path: "/api/v1/health".into(),
|
||||
interval_secs: 10,
|
||||
}),
|
||||
// No health path: every API path needs a sign-in, so a probe would see 401 and
|
||||
// the apply would be reverted. Any answer from control counts as up.
|
||||
health_check: None,
|
||||
request_headers: Vec::new(),
|
||||
response_headers: vec![
|
||||
HeaderRuleSpec {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
ARG RUST=1.99-bookworm
|
||||
ARG CADDY=2.11.7
|
||||
ARG PEBBLE=v2.10.3
|
||||
ARG PEBBLE=v2.6.0
|
||||
|
||||
# ------------------------------------------------------------------ Rust toolchain + native deps
|
||||
FROM rust:${RUST} AS rust
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -105,9 +105,9 @@ try {
|
||||
$url = & (Join-Path $repo 'scripts\preview.ps1') open -Project 'shop' -Branch 'fix-42' -Upstream "http://127.0.0.1:$AppPort" -Ttl 3600
|
||||
Check ($url -eq 'https://fix-42--shop.pv.smoke.test/') "preview URL $url"
|
||||
$ca = Join-Path $offline 'domi-root.crt'
|
||||
$body = & curl.exe -sS --cacert $ca --resolve "fix-42--shop.pv.smoke.test:${Https}:127.0.0.1" "https://fix-42--shop.pv.smoke.test:$Https/"
|
||||
$body = & curl.exe -sS --ssl-no-revoke --cacert $ca --resolve "fix-42--shop.pv.smoke.test:${Https}:127.0.0.1" "https://fix-42--shop.pv.smoke.test:$Https/"
|
||||
Check ($body -eq 'hello from fix-42') "the preview answers through Caddy with a Domi certificate ($body)"
|
||||
$code = & curl.exe -s -o NUL -w '%{http_code}' --cacert $ca --resolve "ianitor.smoke.test:${Https}:127.0.0.1" "https://ianitor.smoke.test:$Https/api/v1/team"
|
||||
$code = & curl.exe -s -o NUL -w '%{http_code}' --ssl-no-revoke --cacert $ca --resolve "ianitor.smoke.test:${Https}:127.0.0.1" "https://ianitor.smoke.test:$Https/api/v1/team"
|
||||
Check ($code -eq '401') "the admin host reaches control and needs a sign-in ($code)"
|
||||
$deny = & curl.exe -s -o NUL -w '%{http_code}' -H "Authorization: Bearer $previewTok" "$base/api/v1/hosts"
|
||||
Check ($deny -eq '403') "the preview token cannot read the hosts ($deny)"
|
||||
@@ -119,10 +119,11 @@ try {
|
||||
$deadline = (Get-Date).AddSeconds(90)
|
||||
do {
|
||||
Start-Sleep 2
|
||||
$code = & curl.exe -s -o NUL -w '%{http_code}' --cacert $ca --resolve "fix-42--shop.pv.smoke.test:${Https}:127.0.0.1" "https://fix-42--shop.pv.smoke.test:$Https/"
|
||||
$code = & curl.exe -s -o NUL -w '%{http_code}' --ssl-no-revoke --cacert $ca --resolve "fix-42--shop.pv.smoke.test:${Https}:127.0.0.1" "https://fix-42--shop.pv.smoke.test:$Https/"
|
||||
} until (($code -ne '200') -or (Get-Date) -gt $deadline)
|
||||
Check ($code -ne '200') "gone after close ($code)"
|
||||
Write-Host 'SMOKE PASSED'
|
||||
$global:LASTEXITCODE = 0
|
||||
} finally {
|
||||
foreach ($p in $procs) { try { Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue } catch {} }
|
||||
Remove-Item Env:\IANITOR_PREVIEW_TOKEN -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user