Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

fix: gracefully handle standalone node cleanup limitation

Richard Courtman02701ca22b81
diff --git a/docs/TEMPERATURE_MONITORING.md b/docs/TEMPERATURE_MONITORING.md
index c9d22af37d..7faed19217 100644
--- a/docs/TEMPERATURE_MONITORING.md
+++ b/docs/TEMPERATURE_MONITORING.md
@@ -562,7 +562,22 @@ Starting in v4.26.0, SSH keys are **automatically removed** when you delete a no
- Removes the SSH key entries (`# pulse-managed-key` and `# pulse-proxy-key`)
- Logs the cleanup action via syslog
-This works for both **cluster nodes** and **standalone nodes** (added via turnkey setup).
+**Automatic cleanup works for:**
+- ✅ **Cluster nodes** - Full automatic cleanup (Proxmox clusters have unrestricted passwordless SSH)
+- ⚠️ **Standalone nodes** - Cannot auto-cleanup due to forced command security (see below)
+
+**Standalone Node Limitation:**
+
+Standalone nodes use forced commands (`command="sensors -j"`) for security. This same restriction prevents the cleanup script from running `sed` to remove keys. This is a **security feature, not a bug** - adding a workaround would defeat the forced command protection.
+
+For standalone nodes:
+- Keys remain after removal (but they're **read-only** - only `sensors -j` access)
+- **Low security risk** - no shell access, no write access, no port forwarding
+- **Auto-cleanup on re-add** - Setup script removes old keys when node is re-added
+- **Manual cleanup if needed:**
+ ```bash
+ ssh root@standalone-node "sed -i '/# pulse-proxy-key$/d' /root/.ssh/authorized_keys"
+ ```
**Monitoring Cleanup:**
```bash
diff --git a/scripts/install-sensor-proxy.sh b/scripts/install-sensor-proxy.sh
index 107116ad54..32c6d453da 100755
--- a/scripts/install-sensor-proxy.sh
+++ b/scripts/install-sensor-proxy.sh
@@ -428,15 +428,21 @@ else
fi
# Remove both pulse-managed-key and pulse-proxy-key entries from remote host
- $SSH_CMD root@"$HOST_CLEAN" \
- "sed -i -e '/# pulse-managed-key\$/d' -e '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys" 2>&1 | \
- logger -t "$LOG_TAG" -p user.info
+ CLEANUP_OUTPUT=$($SSH_CMD root@"$HOST_CLEAN" \
+ "sed -i -e '/# pulse-managed-key\$/d' -e '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys && echo 'SUCCESS'" 2>&1)
- if [[ $? -eq 0 ]]; then
+ if echo "$CLEANUP_OUTPUT" | grep -q "SUCCESS"; then
log_info "Successfully cleaned up SSH keys on $HOST_CLEAN"
else
- log_error "Failed to clean up SSH keys on $HOST_CLEAN"
- exit 1
+ # Check if this is a standalone node with forced commands (common case)
+ if echo "$CLEANUP_OUTPUT" | grep -q "cpu_thermal\|coretemp\|k10temp"; then
+ log_warn "Cannot cleanup standalone node $HOST_CLEAN (forced command prevents cleanup)"
+ log_info "Standalone node keys are read-only (sensors -j) - low security risk"
+ log_info "Manual cleanup: ssh root@$HOST_CLEAN \"sed -i '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys\""
+ else
+ log_error "Failed to clean up SSH keys on $HOST_CLEAN: $CLEANUP_OUTPUT"
+ exit 1
+ fi
fi
fi
fi
diff --git a/scripts/pulse-sensor-cleanup.sh b/scripts/pulse-sensor-cleanup.sh
index 8ea979bf75..e52550c062 100644
--- a/scripts/pulse-sensor-cleanup.sh
+++ b/scripts/pulse-sensor-cleanup.sh
@@ -115,15 +115,21 @@ else
fi
# Remove both pulse-managed-key and pulse-proxy-key entries from remote host
- $SSH_CMD root@"$HOST_CLEAN" \
- "sed -i -e '/# pulse-managed-key\$/d' -e '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys" 2>&1 | \
- logger -t "$LOG_TAG" -p user.info
+ CLEANUP_OUTPUT=$($SSH_CMD root@"$HOST_CLEAN" \
+ "sed -i -e '/# pulse-managed-key\$/d' -e '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys && echo 'SUCCESS'" 2>&1)
- if [[ $? -eq 0 ]]; then
+ if echo "$CLEANUP_OUTPUT" | grep -q "SUCCESS"; then
log_info "Successfully cleaned up SSH keys on $HOST_CLEAN"
else
- log_error "Failed to clean up SSH keys on $HOST_CLEAN"
- exit 1
+ # Check if this is a standalone node with forced commands (common case)
+ if echo "$CLEANUP_OUTPUT" | grep -q "cpu_thermal\|coretemp\|k10temp"; then
+ log_warn "Cannot cleanup standalone node $HOST_CLEAN (forced command prevents cleanup)"
+ log_info "Standalone node keys are read-only (sensors -j) - low security risk"
+ log_info "Manual cleanup: ssh root@$HOST_CLEAN \"sed -i '/# pulse-proxy-key\$/d' /root/.ssh/authorized_keys\""
+ else
+ log_error "Failed to clean up SSH keys on $HOST_CLEAN: $CLEANUP_OUTPUT"
+ exit 1
+ fi
fi
fi
fi