Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Require signed server installer updates
rcourtmance95ef1fc69e
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex d0b57f2590..871f516c09 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -507,6 +507,12 @@ installs too: the root `install.sh`, generated update helper, andidentity across install, update, reset, uninstall, and timer/service wiring sostable and preview Pulse runtimes can coexist on one host without drifting backonto the default `pulse.service` paths.+That same server-installer boundary also owns release trust fail-closed: the+root `install.sh`, its generated update helper, and+`scripts/pulse-auto-update.sh` must verify downloaded release tarballs and+installer scripts against the pinned release `.sshsig` sidecars before+execution, rather than treating same-origin checksum files as a sufficient+trust anchor.The local dev-runtime launcher and dependency manifest floor now sit on thatsame installability boundary.`scripts/hot-dev.sh` and `scripts/hot-dev-bg.sh` are the canonical owned entrydiff --git a/install.sh b/install.shindex c1d91c5eff..8112435d61 100755--- a/install.sh+++ b/install.sh@@ -86,6 +86,9 @@ UPDATE_SERVICE_UNIT="$(basename "$UPDATE_SERVICE_PATH")"UPDATE_TIMER_UNIT="$(basename "$UPDATE_TIMER_PATH")"GITHUB_REPO="rcourtman/Pulse"DOCKER_IMAGE_REPO="${DOCKER_IMAGE_REPO:-rcourtman/pulse}"+INSTALL_SIGNATURE_IDENTITY="pulse-installer"+INSTALL_SIGNATURE_NAMESPACE="pulse-install"+PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"BUILD_FROM_SOURCE=falseSKIP_DOWNLOAD=falseIN_CONTAINER=false@@ -101,6 +104,48 @@ CONTAINER_CREATED_FOR_CLEANUP=falseBUILD_FROM_SOURCE_MARKER="$INSTALL_DIR/BUILD_FROM_SOURCE"DETECTED_CTID=""+release_signature_key_available() {+ [[ -n "${PINNED_RELEASE_SSH_PUBLIC_KEY:-}" ]]+}++require_release_signature_verifier() {+ if ! release_signature_key_available; then+ echo "Pinned release signature key is not configured." >&2+ return 1+ fi+ if ! command -v ssh-keygen >/dev/null 2>&1; then+ echo "ssh-keygen is required to verify signed Pulse release assets." >&2+ return 1+ fi+}++verify_release_signature() {+ local target_path="$1"+ local signature_path="$2"+ local context="${3:-downloaded file}"+ local allowed_signers=""++ if ! require_release_signature_verifier; then+ return 1+ fi++ allowed_signers=$(mktemp /tmp/pulse-release-signers.XXXXXX)+ printf '%s %s\n' "$INSTALL_SIGNATURE_IDENTITY" "$PINNED_RELEASE_SSH_PUBLIC_KEY" > "$allowed_signers"++ if ! ssh-keygen -Y verify \+ -f "$allowed_signers" \+ -I "$INSTALL_SIGNATURE_IDENTITY" \+ -n "$INSTALL_SIGNATURE_NAMESPACE" \+ -s "$signature_path" < "$target_path" >/dev/null 2>&1; then+ rm -f "$allowed_signers"+ echo "Cryptographic signature verification failed for ${context}." >&2+ return 1+ fi++ rm -f "$allowed_signers"+ return 0+}+# Installer version - the major version this script is bundled withINSTALLER_MAJOR_VERSION=5@@ -2595,17 +2640,14 @@ download_release_archive() {local archive_name="pulse-${release}-linux-${pulse_arch}.tar.gz"local download_url="https://github.com/$GITHUB_REPO/releases/download/$release/${archive_name}"- local checksums_url="https://github.com/$GITHUB_REPO/releases/download/$release/checksums.txt"- local checksum_url=""- local checksum_file=""- local expected_checksum=""- local actual_checksum=""+ local signature_url="${download_url}.sshsig"+ local signature_file=""DOWNLOAD_URL="$download_url"print_info "Downloading from: $DOWNLOAD_URL"- if ! command -v sha256sum >/dev/null 2>&1; then- print_error "sha256sum is required but not installed"+ if ! require_release_signature_verifier; then+ print_error "Cannot verify signed Pulse release downloads"return 1fi@@ -2616,34 +2658,20 @@ download_release_archive() {return 1fi- checksum_file=$(mktemp /tmp/pulse-checksum-XXXXXX)- if wget -q --timeout=60 --tries=2 -O "$checksum_file" "$checksums_url" 2>/dev/null; then- expected_checksum=$(grep -w "${archive_name}" "$checksum_file" 2>/dev/null | awk '{print $1}')- fi- rm -f "$checksum_file"-- if [[ -z "$expected_checksum" ]]; then- checksum_url="${download_url}.sha256"- checksum_file=$(mktemp /tmp/pulse-checksum-XXXXXX)- if wget -q --timeout=60 --tries=2 -O "$checksum_file" "$checksum_url" 2>/dev/null; then- expected_checksum=$(awk '{print $1}' "$checksum_file")- fi- rm -f "$checksum_file"- fi-- if [[ -z "$expected_checksum" ]]; then- print_error "Failed to download checksum for Pulse release"- print_info "Refusing to install without checksum verification"+ signature_file=$(mktemp /tmp/pulse-release-signature.XXXXXX)+ if ! wget -q --timeout=60 --tries=2 -O "$signature_file" "$signature_url"; then+ rm -f "$signature_file" "$archive_path"+ print_error "Failed to download signature for Pulse release"+ print_info "Refusing to install without signature verification"return 1fi- actual_checksum=$(sha256sum "$archive_path" | awk '{print $1}')- if [[ "$actual_checksum" != "$expected_checksum" ]]; then- print_error "Checksum verification failed for downloaded Pulse release"- print_error "Expected: $expected_checksum"- print_error "Got: $actual_checksum"+ if ! verify_release_signature "$archive_path" "$signature_file" "downloaded Pulse release"; then+ rm -f "$signature_file" "$archive_path"return 1fi+ rm -f "$signature_file"+ print_info "Pulse release signature verified"return 0}@@ -3300,6 +3328,13 @@ PULSE_UPDATE_HELPER_PATH=$(printf '%q' "$update_helper_path")PULSE_AUTO_UPDATE_DEST=$(printf '%q' "$auto_update_dest")PULSE_UPDATE_SERVICE_PATH=$(printf '%q' "$update_service_path")PULSE_UPDATE_TIMER_PATH=$(printf '%q' "$update_timer_path")+INSTALLER_SIG_URL="\${INSTALLER_URL}.sshsig"+INSTALL_SIGNATURE_IDENTITY=$(printf '%q' "$INSTALL_SIGNATURE_IDENTITY")+INSTALL_SIGNATURE_NAMESPACE=$(printf '%q' "$INSTALL_SIGNATURE_NAMESPACE")+PINNED_RELEASE_SSH_PUBLIC_KEY=$(printf '%q' "$PINNED_RELEASE_SSH_PUBLIC_KEY")+$(declare -f release_signature_key_available)+$(declare -f require_release_signature_verifier)+$(declare -f verify_release_signature)extra_args=()installer_env=(@@ -3325,10 +3360,24 @@ elif [[ -f "\${CONFIG_DIR}/system.json" ]]; thenfiecho "Updating Pulse..."+tmp_installer=\$(mktemp /tmp/pulse-update-installer.XXXXXX)+tmp_signature=\$(mktemp /tmp/pulse-update-installer.sig.XXXXXX)+trap 'rm -f "\$tmp_installer" "\$tmp_signature"' EXIT+if ! curl -fsSL "\$INSTALLER_URL" -o "\$tmp_installer"; then+ echo "Failed to download Pulse installer from \$INSTALLER_URL" >&2+ exit 1+fi+if ! curl -fsSL "\$INSTALLER_SIG_URL" -o "\$tmp_signature"; then+ echo "Failed to download Pulse installer signature from \$INSTALLER_SIG_URL" >&2+ exit 1+fi+if ! verify_release_signature "\$tmp_installer" "\$tmp_signature" "downloaded Pulse installer"; then+ exit 1+fiif [[ \${#extra_args[@]} -gt 0 ]]; then- curl -fsSL "\$INSTALLER_URL" | env "\${installer_env[@]}" bash -s -- "\${extra_args[@]}"+ env "\${installer_env[@]}" bash "\$tmp_installer" "\${extra_args[@]}"else- curl -fsSL "\$INSTALLER_URL" | env "\${installer_env[@]}" bash+ env "\${installer_env[@]}" bash "\$tmp_installer"fiecho ""@@ -3352,17 +3401,22 @@ download_auto_update_script() {local asset_base_url=""asset_base_url=$(resolve_release_asset_base_url)local url="${asset_base_url}/pulse-auto-update.sh"- local checksums_url="${asset_base_url}/checksums.txt"- local legacy_checksum_url="${url}.sha256"+ local signature_url="${url}.sshsig"local dest="${AUTO_UPDATE_DEST:-${PULSE_AUTO_UPDATE_DEST:-/usr/local/bin/pulse-auto-update.sh}}"local attempts=0local max_attempts=3local connect_timeout=15local max_time=60+ if ! require_release_signature_verifier; then+ print_warn "Cannot verify signed auto-update helper downloads"+ return 1+ fi+while (( attempts < max_attempts )); do((attempts++))local curl_status=0+ local signature_file=""if command -v timeout >/dev/null 2>&1; thenif timeout $((max_time + 10)) curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$dest" "$url"; then@@ -3379,54 +3433,24 @@ download_auto_update_script() {fiif [[ $curl_status -eq 0 ]]; then- if ! command -v sha256sum >/dev/null 2>&1; then- print_warn "sha256sum is unavailable; cannot verify auto-update script integrity"- rm -f "$dest"- return 1- fi-- local checksum_file expected_checksum actual_checksum- checksum_file=$(mktemp /tmp/pulse-auto-update-checksum.XXXXXX)- expected_checksum=""-+ signature_file=$(mktemp /tmp/pulse-auto-update-signature.XXXXXX)if command -v timeout >/dev/null 2>&1; then- timeout $((max_time + 10)) curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$checksum_file" "$checksums_url" || true+ timeout $((max_time + 10)) curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$signature_file" "$signature_url" || curl_status=$?else- curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$checksum_file" "$checksums_url" || true+ curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$signature_file" "$signature_url" || curl_status=$?fi- if [[ -s "$checksum_file" ]]; then- expected_checksum=$(grep -w "pulse-auto-update.sh" "$checksum_file" 2>/dev/null | awk '{print $1}' | head -1)- fi-- if [[ -z "$expected_checksum" ]]; then- if command -v timeout >/dev/null 2>&1; then- timeout $((max_time + 10)) curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$checksum_file" "$legacy_checksum_url" || true- else- curl -fsSL --connect-timeout "$connect_timeout" --max-time "$max_time" -o "$checksum_file" "$legacy_checksum_url" || true- fi-- if [[ -s "$checksum_file" ]]; then- expected_checksum=$(awk '{print $1}' "$checksum_file" | head -1)- fi- fi-- rm -f "$checksum_file"-- if [[ -z "$expected_checksum" ]]; then- print_warn "Failed to download checksum for pulse-auto-update.sh"- rm -f "$dest"+ if [[ $curl_status -ne 0 ]]; then+ print_warn "Failed to download signature for pulse-auto-update.sh"+ rm -f "$signature_file" "$dest"+ elif ! verify_release_signature "$dest" "$signature_file" "downloaded pulse-auto-update.sh"; then+ rm -f "$signature_file" "$dest"curl_status=1else- actual_checksum=$(sha256sum "$dest" | awk '{print $1}')- if [[ "$actual_checksum" != "$expected_checksum" ]]; then- print_warn "pulse-auto-update.sh checksum verification failed"- rm -f "$dest"- curl_status=1- else- chmod +x "$dest"- return 0- fi+ rm -f "$signature_file"+ chmod +x "$dest"+ print_info "pulse-auto-update.sh signature verified"+ return 0fifidiff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.goindex 383354ee8d..b71888660a 100644--- a/scripts/installtests/install_sh_test.go+++ b/scripts/installtests/install_sh_test.go@@ -1144,6 +1144,15 @@ func TestSetupUpdateCommandHonorsRCChannelAndCustomPaths(t *testing.T) {if !strings.Contains(got, `INSTALLER_URL="https://github.com/example/pulse-fork/releases/latest/download/install.sh"`) {t.Fatalf("update helper missing configured repo installer url:\n%s", got)}+ if !strings.Contains(got, `INSTALLER_SIG_URL="${INSTALLER_URL}.sshsig"`) {+ t.Fatalf("update helper missing installer signature url:\n%s", got)+ }+ if !strings.Contains(got, `verify_release_signature "$tmp_installer" "$tmp_signature" "downloaded Pulse installer"`) {+ t.Fatalf("update helper missing signed installer verification:\n%s", got)+ }+ if strings.Contains(got, `curl -fsSL "$INSTALLER_URL" |`) {+ t.Fatalf("update helper still pipes installer directly to bash:\n%s", got)+ }profileContent, err := os.ReadFile(profilePath)if err != nil {@@ -1189,6 +1198,9 @@ func TestSetupUpdateCommandUsesConfiguredInstallerRepo(t *testing.T) {if !strings.Contains(got, `INSTALLER_URL="https://github.com/example/pulse-fork/releases/latest/download/install.sh"`) {t.Fatalf("update helper missing configured installer repo:\n%s", got)}+ if !strings.Contains(got, `INSTALLER_SIG_URL="${INSTALLER_URL}.sshsig"`) {+ t.Fatalf("update helper missing signature sidecar url:\n%s", got)+ }}func TestSetupUpdateCommandFailsWhenInstallerDownloadFails(t *testing.T) {@@ -1605,7 +1617,7 @@ func TestResolveReleaseAssetBaseURLUsesLatestRelease(t *testing.T) {func TestDownloadAutoUpdateScriptUsesSelectedReleaseAssets(t *testing.T) {tmpDir := t.TempDir()curlPath := filepath.Join(tmpDir, "curl")- shaPath := filepath.Join(tmpDir, "sha256sum")+ sshKeygenPath := filepath.Join(tmpDir, "ssh-keygen")destPath := filepath.Join(tmpDir, "pulse-auto-update.sh")logPath := filepath.Join(tmpDir, "curl.log")@@ -1636,8 +1648,8 @@ case "$url" in"https://github.com/rcourtman/Pulse/releases/download/v9.9.9/pulse-auto-update.sh")printf '#!/usr/bin/env bash\nexit 0\n' > "$out";;- "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/checksums.txt")- printf 'd98f1c4c7aa19d692f43085e0eb3b198e38724289c65e5a95f033c7f6df4c441 pulse-auto-update.sh\n' > "$out"+ "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/pulse-auto-update.sh.sshsig")+ printf 'signed-payload\n' > "$out";;*)echo "unexpected url: $url" >&2@@ -1649,11 +1661,11 @@ esact.Fatalf("write curl stub: %v", err)}- shaStub := `#!/usr/bin/env bash-printf 'd98f1c4c7aa19d692f43085e0eb3b198e38724289c65e5a95f033c7f6df4c441 %s\n' "$1"+ sshKeygenStub := `#!/usr/bin/env bash+exit 0`- if err := os.WriteFile(shaPath, []byte(shaStub), 0755); err != nil {- t.Fatalf("write sha256sum stub: %v", err)+ if err := os.WriteFile(sshKeygenPath, []byte(sshKeygenStub), 0755); err != nil {+ t.Fatalf("write ssh-keygen stub: %v", err)}script := `@@ -1663,6 +1675,12 @@ printf 'd98f1c4c7aa19d692f43085e0eb3b198e38724289c65e5a95f033c7f6df4c441 %s\n'PULSE_AUTO_UPDATE_DEST="` + destPath + `"print_warn() { :; }print_info() { :; }+ INSTALL_SIGNATURE_IDENTITY="pulse-installer"+ INSTALL_SIGNATURE_NAMESPACE="pulse-install"+ PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"+` + extractRootInstallShellFunction(t, "release_signature_key_available") + `+` + extractRootInstallShellFunction(t, "require_release_signature_verifier") + `+` + extractRootInstallShellFunction(t, "verify_release_signature") + `` + extractRootInstallShellFunction(t, "resolve_release_asset_base_url") + `` + extractRootInstallShellFunction(t, "download_auto_update_script") + `download_auto_update_script@@ -1681,14 +1699,15 @@ printf 'd98f1c4c7aa19d692f43085e0eb3b198e38724289c65e5a95f033c7f6df4c441 %s\n'if !strings.Contains(got, "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/pulse-auto-update.sh") {t.Fatalf("missing versioned helper download:\n%s", got)}- if !strings.Contains(got, "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/checksums.txt") {- t.Fatalf("missing versioned checksum download:\n%s", got)+ if !strings.Contains(got, "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/pulse-auto-update.sh.sshsig") {+ t.Fatalf("missing versioned signature download:\n%s", got)}}func TestPulseAutoUpdatePerformUpdateUsesVersionedInstallerURL(t *testing.T) {tmpDir := t.TempDir()curlPath := filepath.Join(tmpDir, "curl")+ sshKeygenPath := filepath.Join(tmpDir, "ssh-keygen")logPath := filepath.Join(tmpDir, "curl.log")installDir := filepath.Join(tmpDir, "install")@@ -1703,12 +1722,40 @@ func TestPulseAutoUpdatePerformUpdateUsesVersionedInstallerURL(t *testing.T) {}curlStub := `#!/usr/bin/env bash+set -eprintf '%s\n' "$*" >> "` + logPath + `"-printf '#!/usr/bin/env bash\nexit 0\n'+out=""+url=""+while [[ $# -gt 0 ]]; do+ case "$1" in+ -o)+ out="$2"+ shift 2+ ;;+ -fsSL)+ shift+ ;;+ *)+ url="$1"+ shift+ ;;+ esac+done+case "$url" in+ "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/install.sh")+ printf '#!/usr/bin/env bash\nexit 0\n' > "$out"+ ;;+ "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/install.sh.sshsig")+ printf 'signed-payload\n' > "$out"+ ;;+esac`if err := os.WriteFile(curlPath, []byte(curlStub), 0755); err != nil {t.Fatalf("write curl stub: %v", err)}+ if err := os.WriteFile(sshKeygenPath, []byte("#!/usr/bin/env bash\nexit 0\n"), 0755); err != nil {+ t.Fatalf("write ssh-keygen stub: %v", err)+ }script := `PATH="` + tmpDir + `:$PATH"@@ -1718,6 +1765,12 @@ printf '#!/usr/bin/env bash\nexit 0\n'detect_service_name() { echo pulse; }get_current_version() { echo v9.9.9; }systemctl() { return 0; }+ INSTALL_SIGNATURE_IDENTITY="pulse-installer"+ INSTALL_SIGNATURE_NAMESPACE="pulse-install"+ PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"+` + extractAutoUpdateFunction(t, "release_signature_key_available") + `+` + extractAutoUpdateFunction(t, "require_release_signature_verifier") + `+` + extractAutoUpdateFunction(t, "verify_release_signature") + `` + extractAutoUpdateFunction(t, "resolve_install_script_url") + `` + extractAutoUpdateFunction(t, "perform_update") + `perform_update v9.9.9@@ -1736,6 +1789,9 @@ printf '#!/usr/bin/env bash\nexit 0\n'if !strings.Contains(got, "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/install.sh") {t.Fatalf("perform_update did not use versioned installer url:\n%s", got)}+ if !strings.Contains(got, "https://github.com/rcourtman/Pulse/releases/download/v9.9.9/install.sh.sshsig") {+ t.Fatalf("perform_update did not use versioned installer signature url:\n%s", got)+ }if strings.Contains(got, "releases/latest/download/install.sh") {t.Fatalf("perform_update still used latest installer url:\n%s", got)}diff --git a/scripts/installtests/root_install_sh_test.go b/scripts/installtests/root_install_sh_test.goindex d13f26cfdb..7a9efa0e81 100644--- a/scripts/installtests/root_install_sh_test.go+++ b/scripts/installtests/root_install_sh_test.go@@ -251,6 +251,32 @@ func TestRootInstallScriptSupportsInstanceScopedServerInstalls(t *testing.T) {}}+func TestRootInstallScriptRequiresSignedReleaseDownloads(t *testing.T) {+ content, err := os.ReadFile(filepath.Join("..", "..", "install.sh"))+ if err != nil {+ t.Fatalf("read root install.sh: %v", err)+ }++ script := string(content)+ required := []string{+ `PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"`,+ `require_release_signature_verifier() {`,+ `verify_release_signature() {`,+ `local signature_url="${download_url}.sshsig"`,+ `Failed to download signature for Pulse release`,+ `verify_release_signature "$archive_path" "$signature_file" "downloaded Pulse release"`,+ `INSTALLER_SIG_URL="\${INSTALLER_URL}.sshsig"`,+ `verify_release_signature "\$tmp_installer" "\$tmp_signature" "downloaded Pulse installer"`,+ `Failed to download signature for pulse-auto-update.sh`,+ `verify_release_signature "$dest" "$signature_file" "downloaded pulse-auto-update.sh"`,+ }+ for _, needle := range required {+ if !strings.Contains(script, needle) {+ t.Fatalf("root install.sh missing signed-release verification contract: %s", needle)+ }+ }+}+func TestPulseAutoUpdateScriptSupportsInstanceScopedServerInstalls(t *testing.T) {content, err := os.ReadFile(filepath.Join("..", "..", "scripts", "pulse-auto-update.sh"))if err != nil {@@ -275,3 +301,26 @@ func TestPulseAutoUpdateScriptSupportsInstanceScopedServerInstalls(t *testing.T)}}}++func TestPulseAutoUpdateScriptRequiresSignedInstallerDownloads(t *testing.T) {+ content, err := os.ReadFile(filepath.Join("..", "..", "scripts", "pulse-auto-update.sh"))+ if err != nil {+ t.Fatalf("read pulse-auto-update.sh: %v", err)+ }++ script := string(content)+ required := []string{+ `PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"`,+ `require_release_signature_verifier() {`,+ `verify_release_signature() {`,+ `local install_signature_url="${install_script_url}.sshsig"`,+ `Failed to download installer signature from $install_signature_url`,+ `verify_release_signature "$installer_tmp" "$signature_tmp" "downloaded Pulse installer"`,+ `Installer signature verified`,+ }+ for _, needle := range required {+ if !strings.Contains(script, needle) {+ t.Fatalf("pulse-auto-update.sh missing signed-installer verification contract: %s", needle)+ }+ }+}diff --git a/scripts/pulse-auto-update.sh b/scripts/pulse-auto-update.shindex 2267c8f5f9..095346556e 100755--- a/scripts/pulse-auto-update.sh+++ b/scripts/pulse-auto-update.sh@@ -14,6 +14,9 @@ CONFIG_DIR="${PULSE_CONFIG_DIR:-/etc/pulse}"UPDATE_TIMER_UNIT="${PULSE_UPDATE_TIMER_UNIT:-${SERVICE_NAME}-update.timer}"LOG_TAG="${PULSE_AUTO_UPDATE_LOG_TAG:-${SERVICE_NAME}-auto-update}"MAX_LOG_SIZE=10485760 # 10MB+INSTALL_SIGNATURE_IDENTITY="pulse-installer"+INSTALL_SIGNATURE_NAMESPACE="pulse-install"+PINNED_RELEASE_SSH_PUBLIC_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDs21c5oPk2khrdHlsw1aZ9EJKoTsyalGzhb0hdwJrkV pulse-installer"# Logging functionlog() {@@ -23,6 +26,48 @@ log() {echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$level] $@"}+release_signature_key_available() {+ [[ -n "${PINNED_RELEASE_SSH_PUBLIC_KEY:-}" ]]+}++require_release_signature_verifier() {+ if ! release_signature_key_available; then+ log error "Pinned release signature key is not configured"+ return 1+ fi+ if ! command -v ssh-keygen >/dev/null 2>&1; then+ log error "ssh-keygen is required to verify signed Pulse release assets"+ return 1+ fi+}++verify_release_signature() {+ local target_path="$1"+ local signature_path="$2"+ local context="${3:-downloaded file}"+ local allowed_signers=""++ if ! require_release_signature_verifier; then+ return 1+ fi++ allowed_signers=$(mktemp /tmp/pulse-release-signers.XXXXXX)+ printf '%s %s\n' "$INSTALL_SIGNATURE_IDENTITY" "$PINNED_RELEASE_SSH_PUBLIC_KEY" > "$allowed_signers"++ if ! ssh-keygen -Y verify \+ -f "$allowed_signers" \+ -I "$INSTALL_SIGNATURE_IDENTITY" \+ -n "$INSTALL_SIGNATURE_NAMESPACE" \+ -s "$signature_path" < "$target_path" >/dev/null 2>&1; then+ rm -f "$allowed_signers"+ log error "Cryptographic signature verification failed for ${context}"+ return 1+ fi++ rm -f "$allowed_signers"+ return 0+}+# Check if auto-updates are enabledcheck_auto_updates_enabled() {# Check system.json for autoUpdateEnabled flag (note: no 's' - matches Go struct)@@ -158,6 +203,8 @@ resolve_install_script_url() {perform_update() {local new_version=$1local service_name=$(detect_service_name)+ local installer_tmp=""+ local signature_tmp=""log info "Starting update to $new_version"@@ -182,6 +229,7 @@ perform_update() {log info "Downloading and installing update"local install_script_urlinstall_script_url=$(resolve_install_script_url "$new_version")+ local install_signature_url="${install_script_url}.sshsig"# Run install script with specific versionlocal marker_file="$INSTALL_DIR/BUILD_FROM_SOURCE"@@ -194,12 +242,28 @@ perform_update() {fifi- if curl -sSL "$install_script_url" | \- env \+ installer_tmp=$(mktemp /tmp/pulse-update-installer.XXXXXX)+ signature_tmp=$(mktemp /tmp/pulse-update-installer.sig.XXXXXX)+ trap 'rm -f "$installer_tmp" "$signature_tmp"' RETURN++ if ! curl -fsSL "$install_script_url" -o "$installer_tmp"; then+ log error "Failed to download installer from $install_script_url"+ return 1+ fi+ if ! curl -fsSL "$install_signature_url" -o "$signature_tmp"; then+ log error "Failed to download installer signature from $install_signature_url"+ return 1+ fi+ if ! verify_release_signature "$installer_tmp" "$signature_tmp" "downloaded Pulse installer"; then+ return 1+ fi+ log info "Installer signature verified"++ if env \"PULSE_SERVICE_NAME=$service_name" \"PULSE_INSTALL_DIR=$INSTALL_DIR" \"PULSE_CONFIG_DIR=$CONFIG_DIR" \- bash -s -- "${installer_args[@]}" 2>&1 | \+ bash "$installer_tmp" "${installer_args[@]}" 2>&1 | \while IFS= read -r line; dolog info "installer: $line"done; then