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
fix(sensor-proxy): fix remaining unsafe config writers
rcourtmand6084e29dd4e
diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.shindex f0494d2d84..47858b5133 100755--- a/scripts/install-sensor-proxy.sh+++ b/scripts/install-sensor-proxy.sh@@ -3094,6 +3094,7 @@ elseset -euo pipefailSERVICE="pulse-sensor-proxy"+BINARY_PATH="/opt/pulse/sensor-proxy/bin/pulse-sensor-proxy"INSTALLER="/opt/pulse/sensor-proxy/install-sensor-proxy.sh"CTID_FILE="/etc/pulse-sensor-proxy/ctid"PENDING_FILE="/etc/pulse-sensor-proxy/pending-control-plane.env"diff --git a/scripts/migrate-sensor-proxy-control-plane.sh b/scripts/migrate-sensor-proxy-control-plane.shindex 335ea30bd3..4c70bd915e 100644--- a/scripts/migrate-sensor-proxy-control-plane.sh+++ b/scripts/migrate-sensor-proxy-control-plane.sh@@ -92,14 +92,20 @@ echo "$CONTROL_TOKEN" > "$TOKEN_FILE"chmod 600 "$TOKEN_FILE"chown pulse-sensor-proxy:pulse-sensor-proxy "$TOKEN_FILE"-remove_control_block() {- python3 - "$CONFIG_FILE" <<'PY'+update_config_atomically() {+ # Phase 2: Use atomic write to prevent corruption+ local temp_file+ temp_file=$(mktemp)++ # Remove old control plane blocks and add new one atomically+ python3 - "$CONFIG_FILE" "$temp_file" <<'PY'from pathlib import Pathimport sys-path = Path(sys.argv[1])-if not path.exists():+config_path = Path(sys.argv[1])+temp_path = Path(sys.argv[2])+if not config_path.exists():sys.exit(0)-lines = path.read_text().splitlines(keepends=True)+lines = config_path.read_text().splitlines(keepends=True)result = []i = 0while i < len(lines):@@ -116,13 +122,11 @@ while i < len(lines):continueresult.append(line)i += 1-path.write_text("".join(result))+temp_path.write_text("".join(result))PY-}-log "Updating config..."-remove_control_block-cat >> "$CONFIG_FILE" <<EOF+ # Append new control plane config+ cat >> "$temp_file" <<EOF# Pulse control plane configuration (added by migrate-sensor-proxy-control-plane.sh)pulse_control_plane:@@ -131,6 +135,15 @@ pulse_control_plane:refresh_interval: $REFRESH_INTERVALEOF+ # Atomic rename+ mv "$temp_file" "$CONFIG_FILE"+ chmod 644 "$CONFIG_FILE"+ chown pulse-sensor-proxy:pulse-sensor-proxy "$CONFIG_FILE" 2>/dev/null || true+}++log "Updating config..."+update_config_atomically+if [[ "$SKIP_RESTART" == false ]]; thenlog "Restarting pulse-sensor-proxy..."systemctl restart pulse-sensor-proxy