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
refactor(api): remove sensor proxy config from API handlers
rcourtman7599915b8f3f
diff --git a/internal/api/config_handlers.go b/internal/api/config_handlers.goindex c9fe5863b7..1163f28ea1 100644--- a/internal/api/config_handlers.go+++ b/internal/api/config_handlers.go@@ -28,7 +28,6 @@ import ("github.com/rcourtman/pulse-go-rewrite/internal/models""github.com/rcourtman/pulse-go-rewrite/internal/monitoring""github.com/rcourtman/pulse-go-rewrite/internal/system"- "github.com/rcourtman/pulse-go-rewrite/internal/tempproxy""github.com/rcourtman/pulse-go-rewrite/internal/websocket"internalauth "github.com/rcourtman/pulse-go-rewrite/pkg/auth"pkgdiscovery "github.com/rcourtman/pulse-go-rewrite/pkg/discovery"@@ -39,20 +38,10 @@ import ("github.com/rs/zerolog/log")-const minProxyReadyVersion = "4.24.0"-var (setupAuthTokenPattern = regexp.MustCompile(`^[A-Fa-f0-9]{32,128}$`))-const (- temperatureTransportDisabled = "disabled"- temperatureTransportSocketProxy = "socket-proxy"- temperatureTransportHTTPSProxy = "https-proxy"- temperatureTransportSSHFallback = "ssh"- temperatureTransportSSHBlocked = "ssh-blocked"-)-func sanitizeInstallerURL(raw string) (string, error) {trimmed := strings.TrimSpace(raw)if trimmed == "" {@@ -420,7 +409,6 @@ type NodeResponse struct {MonitorPhysicalDisks *bool `json:"monitorPhysicalDisks,omitempty"`PhysicalDiskPollingMinutes int `json:"physicalDiskPollingMinutes,omitempty"`TemperatureMonitoringEnabled *bool `json:"temperatureMonitoringEnabled,omitempty"`- TemperatureTransport string `json:"temperatureTransport,omitempty"`MonitorDatastores bool `json:"monitorDatastores,omitempty"`MonitorSyncJobs bool `json:"monitorSyncJobs,omitempty"`MonitorVerifyJobs bool `json:"monitorVerifyJobs,omitempty"`@@ -438,41 +426,6 @@ type NodeResponse struct {Source string `json:"source,omitempty"` // "agent" or "script" - how this node was registered}-func determineTemperatureTransport(enabled bool, proxyURL, proxyToken string, socketAvailable bool, containerSSHBlocked bool) string {- if !enabled {- return temperatureTransportDisabled- }-- proxyURL = strings.TrimSpace(proxyURL)- proxyToken = strings.TrimSpace(proxyToken)- if proxyURL != "" && proxyToken != "" {- return temperatureTransportHTTPSProxy- }-- if socketAvailable {- return temperatureTransportSocketProxy- }-- if containerSSHBlocked {- return temperatureTransportSSHBlocked- }-- return temperatureTransportSSHFallback-}--func ensureTemperatureTransportAvailable(enabled bool, proxyURL, proxyToken string, socketAvailable bool, containerSSHBlocked bool) error {- if !enabled {- return nil- }-- transport := determineTemperatureTransport(true, proxyURL, proxyToken, socketAvailable, containerSSHBlocked)- if transport == temperatureTransportSSHBlocked {- return fmt.Errorf("pulse is running in a container without access to pulse-sensor-proxy. Install the host proxy or register an HTTPS-mode sensor proxy for this node before enabling temperature monitoring")- }-- return nil-}-func isContainerSSHRestricted() bool {isContainer := os.Getenv("PULSE_DOCKER") == "true" || system.InContainer()if !isContainer {@@ -481,14 +434,6 @@ func isContainerSSHRestricted() bool {return strings.ToLower(strings.TrimSpace(os.Getenv("PULSE_DEV_ALLOW_CONTAINER_SSH"))) != "true"}-func (h *ConfigHandlers) resolveTemperatureTransport(enabledOverride *bool, proxyURL, proxyToken string, socketAvailable bool, containerSSHBlocked bool) string {- enabled := h.config.TemperatureMonitoringEnabled- if enabledOverride != nil {- enabled = *enabledOverride- }- return determineTemperatureTransport(enabled, proxyURL, proxyToken, socketAvailable, containerSSHBlocked)-}-// deriveSchemeAndPort infers the scheme (without ://) and port from a base host URL.// Defaults align with Proxmox expectations when details are omitted.func deriveSchemeAndPort(baseHost string) (scheme string, port string) {@@ -1008,8 +953,6 @@ func defaultDetectPVECluster(clientConfig proxmox.ClientConfig, nodeName string,// GetAllNodesForAPI returns all configured nodes for API responsesfunc (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {nodes := []NodeResponse{}- socketAvailable := h.monitor != nil && h.monitor.HasSocketTemperatureProxy()- containerSSHBlocked := isContainerSSHRestricted()// Add PVE nodesfor i := range h.config.PVEInstances {@@ -1035,7 +978,6 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {MonitorPhysicalDisks: pve.MonitorPhysicalDisks,PhysicalDiskPollingMinutes: pve.PhysicalDiskPollingMinutes,TemperatureMonitoringEnabled: pve.TemperatureMonitoringEnabled,- TemperatureTransport: h.resolveTemperatureTransport(pve.TemperatureMonitoringEnabled, pve.TemperatureProxyURL, pve.TemperatureProxyToken, socketAvailable, containerSSHBlocked),Status: h.getNodeStatus("pve", pve.Name),IsCluster: pve.IsCluster,ClusterName: pve.ClusterName,@@ -1060,7 +1002,6 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {Fingerprint: pbs.Fingerprint,VerifySSL: pbs.VerifySSL,TemperatureMonitoringEnabled: pbs.TemperatureMonitoringEnabled,- TemperatureTransport: h.resolveTemperatureTransport(pbs.TemperatureMonitoringEnabled, "", "", socketAvailable, containerSSHBlocked),MonitorDatastores: pbs.MonitorDatastores,MonitorSyncJobs: pbs.MonitorSyncJobs,MonitorVerifyJobs: pbs.MonitorVerifyJobs,@@ -1098,7 +1039,6 @@ func (h *ConfigHandlers) GetAllNodesForAPI() []NodeResponse {MonitorQuarantine: pmgInst.MonitorQuarantine,MonitorDomainStats: pmgInst.MonitorDomainStats,Status: h.getNodeStatus("pmg", pmgInst.Name),- TemperatureTransport: h.resolveTemperatureTransport(pmgInst.TemperatureMonitoringEnabled, "", "", socketAvailable, containerSSHBlocked),}nodes = append(nodes, node)}@@ -1161,7 +1101,6 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)IsCluster: true,ClusterName: "mock-cluster",ClusterEndpoints: clusterEndpoints, // All cluster nodes- TemperatureTransport: temperatureTransportSocketProxy,}mockNodes = append(mockNodes, clusterNode)}@@ -1188,7 +1127,6 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)IsCluster: false, // Not part of a clusterClusterName: "",ClusterEndpoints: []config.ClusterEndpoint{},- TemperatureTransport: temperatureTransportSocketProxy,}mockNodes = append(mockNodes, standaloneNode)}@@ -1196,23 +1134,22 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)// Add mock PBS instancesfor i, pbs := range state.PBSInstances {pbsNode := NodeResponse{- ID: generateNodeID("pbs", i),- Type: "pbs",- Name: pbs.Name,- Host: pbs.Host,- User: "pulse@pbs",- HasPassword: false,- TokenName: "pulse",- HasToken: true,- Fingerprint: "",- VerifySSL: false,- MonitorDatastores: true,- MonitorSyncJobs: true,- MonitorVerifyJobs: true,- MonitorPruneJobs: true,- MonitorGarbageJobs: true,- Status: "connected", // Always connected in mock mode- TemperatureTransport: temperatureTransportSocketProxy,+ ID: generateNodeID("pbs", i),+ Type: "pbs",+ Name: pbs.Name,+ Host: pbs.Host,+ User: "pulse@pbs",+ HasPassword: false,+ TokenName: "pulse",+ HasToken: true,+ Fingerprint: "",+ VerifySSL: false,+ MonitorDatastores: true,+ MonitorSyncJobs: true,+ MonitorVerifyJobs: true,+ MonitorPruneJobs: true,+ MonitorGarbageJobs: true,+ Status: "connected", // Always connected in mock mode}mockNodes = append(mockNodes, pbsNode)}@@ -1220,18 +1157,17 @@ func (h *ConfigHandlers) HandleGetNodes(w http.ResponseWriter, r *http.Request)// Add mock PMG instancesfor i, pmg := range state.PMGInstances {pmgNode := NodeResponse{- ID: generateNodeID("pmg", i),- Type: "pmg",- Name: pmg.Name,- Host: pmg.Host,- User: "root@pam",- HasPassword: true,- TokenName: "pulse",- HasToken: true,- Fingerprint: "",- VerifySSL: false,- Status: "connected", // Always connected in mock mode- TemperatureTransport: temperatureTransportSocketProxy,+ ID: generateNodeID("pmg", i),+ Type: "pmg",+ Name: pmg.Name,+ Host: pmg.Host,+ User: "root@pam",+ HasPassword: true,+ TokenName: "pulse",+ HasToken: true,+ Fingerprint: "",+ VerifySSL: false,+ Status: "connected", // Always connected in mock mode}mockNodes = append(mockNodes, pmgNode)}@@ -1575,18 +1511,8 @@ func (h *ConfigHandlers) HandleAddNode(w http.ResponseWriter, r *http.Request) {}}- socketAvailable := h.monitor != nil && h.monitor.HasSocketTemperatureProxy()- containerSSHBlocked := isContainerSSHRestricted()-// Add to appropriate listif req.Type == "pve" {- if req.TemperatureMonitoringEnabled != nil && *req.TemperatureMonitoringEnabled {- if err := ensureTemperatureTransportAvailable(true, "", "", socketAvailable, containerSSHBlocked); err != nil {- http.Error(w, err.Error(), http.StatusBadRequest)- return- }- }-if req.Password != "" && req.TokenName == "" && req.TokenValue == "" {req.User = normalizePVEUser(req.User)}@@ -2291,9 +2217,6 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.RequestInterface("temperatureMonitoringEnabled", req.TemperatureMonitoringEnabled).Msg("Received node update request")- socketAvailable := h.monitor != nil && h.monitor.HasSocketTemperatureProxy()- containerSSHBlocked := isContainerSSHRestricted()-// Parse node IDparts := strings.Split(nodeID, "-")if len(parts) != 2 {@@ -2312,13 +2235,6 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Requestif nodeType == "pve" && index < len(h.config.PVEInstances) {pve := &h.config.PVEInstances[index]- if req.TemperatureMonitoringEnabled != nil && *req.TemperatureMonitoringEnabled {- if err := ensureTemperatureTransportAvailable(true, pve.TemperatureProxyURL, pve.TemperatureProxyToken, socketAvailable, containerSSHBlocked); err != nil {- http.Error(w, err.Error(), http.StatusBadRequest)- return- }- }-// Only update name if providedif req.Name != "" {pve.Name = req.Name@@ -2758,7 +2674,6 @@ func (h *ConfigHandlers) HandleDeleteNode(w http.ResponseWriter, r *http.Request}if deletedNodeType == "pve" && deletedNodeHost != "" {- go h.triggerPVEHostCleanup(deletedNodeHost)}w.WriteHeader(http.StatusOK)@@ -2882,28 +2797,6 @@ func (h *ConfigHandlers) HandleRefreshClusterNodes(w http.ResponseWriter, r *htt})}-func (h *ConfigHandlers) triggerPVEHostCleanup(host string) {- client := tempproxy.NewClient()- if client == nil || !client.IsAvailable() {- log.Debug().- Str("host", host).- Msg("Skipping PVE cleanup request; sensor proxy socket unavailable")- return- }-- if err := client.RequestCleanup(host); err != nil {- log.Warn().- Err(err).- Str("host", host).- Msg("Failed to queue PVE host cleanup via sensor proxy")- return- }-- log.Info().- Str("host", host).- Msg("Queued PVE host cleanup via sensor proxy")-}-// HandleTestNodeConfig tests a node connection from provided configurationfunc (h *ConfigHandlers) HandleTestNodeConfig(w http.ResponseWriter, r *http.Request) {// Limit request body to 32KB to prevent memory exhaustion@@ -3390,7 +3283,6 @@ func (h *ConfigHandlers) HandleVerifyTemperatureSSH(w http.ResponseWriter, r *htresponse.WriteString(fmt.Sprintf(" • %s\n", node))}response.WriteString("\n")- response.WriteString("For LXC deployments, consider installing pulse-sensor-proxy on the Proxmox host.\n")response.WriteString("See: https://github.com/rcourtman/Pulse/blob/main/SECURITY.md for detailed SSH configuration options.\n")}@@ -3830,7 +3722,7 @@ func (h *ConfigHandlers) HandleSetupScript(w http.ResponseWriter, r *http.RequesInt64("timestamp", timestamp).Msg("Generated unique token name for setup script")- // Get or generate SSH public keys for temperature monitoring (both proxy and sensors)+ // Get or generate SSH public key for temperature monitoringsshKeys := h.getOrGenerateSSHKeys()var script string@@ -3920,43 +3812,10 @@ case "$ENVIRONMENT" inlxc_guest)echo "Detected Proxmox LXC container environment."echo ""- LXC_CTID=$(detect_lxc_ctid)- CTID_DISPLAY="$LXC_CTID"- if [ -n "$LXC_CTID" ]; then- echo " • Container ID: $LXC_CTID"- else- CTID_DISPLAY="<your-pulse-container-id>"- echo " • Unable to auto-detect container ID."- echo " Replace '${CTID_DISPLAY}' in the commands below with your container ID."- fi- echo ""- echo "Run the following commands on your Proxmox host to continue:"- echo ""- cat <<EOF-# 1) Create or reuse the Pulse monitoring API token-pveum user add pulse-monitor@pam --comment "Pulse monitoring service"-pveum aclmod / -user pulse-monitor@pam -role PVEAuditor-pveum user token add pulse-monitor@pam "$TOKEN_NAME" --privsep 0--# 2) Install or update pulse-sensor-proxy on the host-curl -sSL "$PULSE_URL/api/install/install-sensor-proxy.sh" | bash -s -- --ctid ${CTID_DISPLAY} --pulse-server "$PULSE_URL"--# 3) Ensure the proxy socket is mounted into this container (migration-safe)-LXC_CONF="/etc/pve/lxc/${CTID_DISPLAY}.conf"-mkdir -p /run/pulse-sensor-proxy-sed -i '/^mp[0-9]\+: .*pulse-sensor-proxy/d' "$LXC_CONF"-if ! grep -q "^lxc.mount.entry: /run/pulse-sensor-proxy mnt/pulse-proxy none bind,create=dir 0 0\$" "$LXC_CONF"; then- echo 'lxc.mount.entry: /run/pulse-sensor-proxy mnt/pulse-proxy none bind,create=dir 0 0' >> "$LXC_CONF"-fi-pct stop ${CTID_DISPLAY} && sleep 2 && pct start ${CTID_DISPLAY}-pct exec ${CTID_DISPLAY} -- test -S /mnt/pulse-proxy/pulse-sensor-proxy.sock && echo "Socket OK"--EOF- echo "For the simplest experience, run this script on your Proxmox host instead:"+ echo "Run this script on the Proxmox host:"echo " curl -sSL \"$SETUP_SCRIPT_URL\" | bash"echo ""- echo "Exiting without error. Re-run after completing the host steps."- exit 0+ exit 1;;*)echo "This script requires Proxmox host tooling (pveum)."@@ -3972,18 +3831,6 @@ EOFecho ""echo " 2. In Pulse: Settings → Nodes → Add Node (enter token from above)"echo ""- echo " 3. (Optional) For temperature monitoring on containerized Pulse:"- echo ""- echo " For LXC containers, run on Proxmox host:"- echo " curl -sSL $PULSE_URL/api/install/install-sensor-proxy.sh | bash -s -- --ctid <CTID> --pulse-server $PULSE_URL"- echo ""- echo " For Docker containers, run on Proxmox host:"- echo " curl -sSL $PULSE_URL/api/install/install-sensor-proxy.sh | bash -s -- --standalone --pulse-server $PULSE_URL"- echo " Then add to docker-compose.yml:"- echo " volumes:"- echo " - /run/pulse-sensor-proxy:/run/pulse-sensor-proxy:rw"- echo " And restart: docker-compose down && docker-compose up -d"- echo ""exit 1;;esac@@ -4027,12 +3874,8 @@ if [[ $MAIN_ACTION =~ ^[2Rr]$ ]]; thenecho "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""echo "This will remove:"- echo " • pulse-sensor-proxy service and systemd unit"- echo " • pulse-sensor-proxy system user"- echo " • All SSH keys from authorized_keys (current and legacy)"- echo " • LXC bind mounts from all container configs"+ echo " • SSH keys from authorized_keys (Pulse-managed entries)"echo " • Pulse monitoring API tokens and user"- echo " • All Pulse-related files and directories"echo ""echo "⚠️ WARNING: This is a destructive operation!"echo ""@@ -4060,78 +3903,9 @@ if [[ $MAIN_ACTION =~ ^[2Rr]$ ]]; thenecho "Removing Pulse monitoring components..."echo ""- # Run cleanup helper to remove SSH keys from remote nodes- if [ -x /opt/pulse/sensor-proxy/bin/pulse-sensor-cleanup.sh ]; then- echo " • Running cleanup helper..."- /opt/pulse/sensor-proxy/bin/pulse-sensor-cleanup.sh 2>/dev/null || echo " ℹ️ Cleanup helper completed"- echo ""- elif [ -x /usr/local/bin/pulse-sensor-cleanup.sh ]; then- echo " • Running cleanup helper (legacy path)..."- /usr/local/bin/pulse-sensor-cleanup.sh 2>/dev/null || echo " ℹ️ Cleanup helper completed"- echo ""- fi# Always run manual removal for local services and filesif true; then- # Stop and remove pulse-sensor services- if command -v systemctl &> /dev/null; then- if systemctl is-active --quiet pulse-sensor-proxy 2>/dev/null; then- echo " • Stopping pulse-sensor-proxy service..."- systemctl stop pulse-sensor-proxy || true- fi- if systemctl is-enabled --quiet pulse-sensor-proxy 2>/dev/null; then- echo " • Disabling pulse-sensor-proxy service..."- systemctl disable pulse-sensor-proxy || true- fi- if systemctl is-active --quiet pulse-sensor-cleanup.path 2>/dev/null; then- echo " • Stopping pulse-sensor-cleanup.path..."- systemctl stop pulse-sensor-cleanup.path || true- fi- if systemctl is-enabled --quiet pulse-sensor-cleanup.path 2>/dev/null; then- echo " • Disabling pulse-sensor-cleanup.path..."- systemctl disable pulse-sensor-cleanup.path || true- fi- if systemctl is-enabled --quiet pulse-sensor-cleanup.service 2>/dev/null; then- echo " • Disabling pulse-sensor-cleanup.service..."- systemctl disable pulse-sensor-cleanup.service || true- fi- if [ -f /etc/systemd/system/pulse-sensor-proxy.service ] || \- [ -f /etc/systemd/system/pulse-sensor-cleanup.service ] || \- [ -f /etc/systemd/system/pulse-sensor-cleanup.path ]; then- echo " • Removing systemd unit files..."- rm -f /etc/systemd/system/pulse-sensor-proxy.service- rm -f /etc/systemd/system/pulse-sensor-cleanup.service- rm -f /etc/systemd/system/pulse-sensor-cleanup.path- systemctl daemon-reload || true- fi- fi-- # Remove pulse-sensor-proxy binaries (both new and legacy paths)- if [ -d /opt/pulse/sensor-proxy ]; then- echo " • Removing pulse-sensor-proxy installation..."- rm -rf /opt/pulse/sensor-proxy- fi- if [ -f /usr/local/bin/pulse-sensor-proxy ]; then- echo " • Removing legacy pulse-sensor-proxy binary..."- rm -f /usr/local/bin/pulse-sensor-proxy- fi- if [ -f /usr/local/bin/pulse-sensor-cleanup.sh ]; then- echo " • Removing legacy cleanup helper script..."- rm -f /usr/local/bin/pulse-sensor-cleanup.sh- fi-- # Remove pulse-sensor-proxy data directory- if [ -d /var/lib/pulse-sensor-proxy ]; then- echo " • Removing pulse-sensor-proxy data directory..."- rm -rf /var/lib/pulse-sensor-proxy- fi-- # Remove pulse-sensor-proxy user- if id -u pulse-sensor-proxy >/dev/null 2>&1; then- echo " • Removing pulse-sensor-proxy system user..."- userdel pulse-sensor-proxy 2>/dev/null || true- fi-# Remove SSH keys from authorized_keys (only Pulse-managed entries)if [ -f /root/.ssh/authorized_keys ]; thenecho " • Removing SSH keys from authorized_keys..."@@ -4153,18 +3927,6 @@ if [[ $MAIN_ACTION =~ ^[2Rr]$ ]]; thenfifi- # Remove LXC bind mounts from all container configs- if [ -d /etc/pve/lxc ]; then- echo " • Removing LXC bind mounts from container configs..."- if compgen -G "/etc/pve/lxc/*.conf" > /dev/null; then- for conf in /etc/pve/lxc/*.conf; do- if [ -f "$conf" ] && grep -q "pulse-sensor-proxy" "$conf" 2>/dev/null; then- sed -i '/pulse-sensor-proxy/d' "$conf" || true- fi- done- fi- fi-# Remove Pulse monitoring API tokens and userecho " • Removing Pulse monitoring API tokens and user..."if command -v pveum &> /dev/null; then@@ -4466,1011 +4228,132 @@ echo "Temperature Monitoring Setup (Optional)"echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo ""-if [ "$PULSE_IS_CONTAINERIZED" = true ] && [ "$SKIP_TEMPERATURE_PROMPT" != true ]; then- if [ "${SUMMARY_PROXY_INSTALLED:-false}" != "true" ]; then- echo "ℹ️ During the initial Pulse installation the host-side proxy was not installed."- echo " Enabling it now lets the Pulse container read sensors securely via the host."- echo ""- fi-fi--# SSH public keys embedded from Pulse server-# Proxy key: used for ProxyJump (unrestricted but limited to port forwarding)-# Sensors key: used for temperature collection (restricted to sensors -j command)-SSH_PROXY_PUBLIC_KEY="%s"SSH_SENSORS_PUBLIC_KEY="%s"-SSH_PROXY_KEY_ENTRY="restrict,permitopen=\"*:22\" $SSH_PROXY_PUBLIC_KEY # pulse-proxyjump"-SSH_SENSORS_KEY_ENTRY="command=\"sensors -j\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $SSH_SENSORS_PUBLIC_KEY # pulse-sensors"+SSH_SENSORS_KEY_ENTRY="command="sensors -j",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $SSH_SENSORS_PUBLIC_KEY # pulse-sensors"TEMPERATURE_ENABLED=false-TEMP_MONITORING_AVAILABLE=true-MIN_PROXY_VERSION="%s"-PULSE_VERSION_ENDPOINT="$PULSE_URL/api/version"-STANDALONE_PROXY_DEPLOYED=false-SKIP_TEMPERATURE_PROMPT=false-PROXY_SOCKET_EXISTED_AT_START=false--if [ -S /run/pulse-sensor-proxy/pulse-sensor-proxy.sock ]; then- TEMPERATURE_ENABLED=true- SKIP_TEMPERATURE_PROMPT=true- PROXY_SOCKET_EXISTED_AT_START=true-fi--version_ge() {- if command -v dpkg >/dev/null 2>&1; then- dpkg --compare-versions "$1" ge "$2"- return $?- fi- if command -v sort >/dev/null 2>&1; then- [ "$(printf '%%s\n%%s\n' "$1" "$2" | sort -V | tail -n1)" = "$1" ]- return $?- fi- [ "$1" = "$2" ]-}--# Check if temperature proxy is available and override SSH key if it is-PROXY_KEY_URL="$PULSE_URL/api/system/proxy-public-key"-TEMPERATURE_PROXY_KEY=$(curl -s -f "$PROXY_KEY_URL" 2>/dev/null || echo "")-if [ -n "$TEMPERATURE_PROXY_KEY" ] && [[ "$TEMPERATURE_PROXY_KEY" =~ ^ssh-(rsa|ed25519) ]]; then- # Proxy is available - use its key instead of container's key- SSH_SENSORS_PUBLIC_KEY="$TEMPERATURE_PROXY_KEY"- SSH_SENSORS_KEY_ENTRY="command=\"sensors -j\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $TEMPERATURE_PROXY_KEY # pulse-sensor-proxy"-fi-# Detect if Pulse is running in a container BEFORE asking about temperature monitoring-PULSE_CTID=""-PULSE_IS_CONTAINERIZED=false-if command -v pct >/dev/null 2>&1; then- # Extract Pulse IP from URL- PULSE_IP=$(echo "$PULSE_URL" | sed -E 's|^https?://([^:/]+).*|\1|')-- # Find container with this IP- if [[ "$PULSE_IP" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then- # Check all containers for matching IP- for CTID in $(pct list | awk 'NR>1 {print $1}'); do- # Verify container is running before attempting connection- # Note: status can be "running", "running (healthy)", or "running (unhealthy)"- CT_STATUS=$(pct status "$CTID" 2>/dev/null || echo "")- if ! echo "$CT_STATUS" | grep -q "running"; then- continue- fi-- # Get all container IPs (handles both IPv4 and IPv6)- CT_IPS=$(pct exec "$CTID" -- hostname -I 2>/dev/null || printf '')-- # Check if any of the container's IPs match the Pulse IP- for CT_IP in $CT_IPS; do- if [ "$CT_IP" = "$PULSE_IP" ]; then- # Validate with pct config to ensure it's the right container- if pct config "$CTID" >/dev/null 2>&1; then- PULSE_CTID="$CTID"- PULSE_IS_CONTAINERIZED=true- break 2 # Break out of both loops- fi- fi- done- done- fi-fi--# Determine if this node is standalone (not joined to a cluster)-IS_STANDALONE_NODE=false-if ! command -v pvecm >/dev/null 2>&1 || ! pvecm status >/dev/null 2>&1; then- IS_STANDALONE_NODE=true-fi--INSTALL_SUMMARY_FILE="/etc/pulse/install_summary.json"-SUMMARY_PROXY_REQUESTED="false"-SUMMARY_PROXY_INSTALLED="false"-SUMMARY_PROXY_SOCKET="false"-SUMMARY_CTID=""-if [ -f "$INSTALL_SUMMARY_FILE" ]; then- if command -v python3 >/dev/null 2>&1; then- if SUMMARY_EVAL=$(python3 <<'PY'-import json-from pathlib import Path-path = Path("/etc/pulse/install_summary.json")-try:- data = json.loads(path.read_text())-except Exception:- raise SystemExit(1)-proxy = data.get("proxy") or {}-ctid = data.get("ctid") or ""-def emit(key, value):- if isinstance(value, bool):- print(f"{key}={'true' if value else 'false'}")- else:- print(f"{key}={value}")-emit("SUMMARY_PROXY_REQUESTED", proxy.get("requested"))-emit("SUMMARY_PROXY_INSTALLED", proxy.get("installed"))-emit("SUMMARY_PROXY_SOCKET", proxy.get("hostSocketPresent"))-emit("SUMMARY_CTID", ctid)-PY- ); then- eval "$SUMMARY_EVAL"- fi- elif command -v jq >/dev/null 2>&1; then- if SUMMARY_EVAL=$(jq -r '- [- "\(.proxy.requested // false)",- "\(.proxy.installed // false)",- "\(.proxy.hostSocketPresent // false)",- "\(.ctid // \"\")"- ] | @tsv- ' "$INSTALL_SUMMARY_FILE" 2>/dev/null); then- read -r requested installed host_socket ctid <<<"$SUMMARY_EVAL"- SUMMARY_PROXY_REQUESTED=$requested- SUMMARY_PROXY_INSTALLED=$installed- SUMMARY_PROXY_SOCKET=$host_socket- SUMMARY_CTID=$ctid- fi- fi-fi--# Track whether temperature monitoring can work (may be disabled by checks above)--# For containerized Pulse, verify version supports proxy (v4.24.0+)-if [ "$PULSE_IS_CONTAINERIZED" = true ]; then- PULSE_VERSION=$(curl -s -f "$PULSE_VERSION_ENDPOINT" 2>/dev/null | awk -F'"' '/"version":/{print $4}' | head -n1)- if [ -z "$PULSE_VERSION" ]; then- echo ""- echo "⚠️ Could not determine Pulse version from $PULSE_VERSION_ENDPOINT"- echo " Temperature proxy requires Pulse $MIN_PROXY_VERSION or later."- TEMP_MONITORING_AVAILABLE=false- # Allow dev/main builds (they have latest code)- elif [[ "$PULSE_VERSION" =~ ^(0\.0\.0-main|0\.0\.0-|dev|main) || "$PULSE_VERSION" =~ -dirty$ ]]; then- # Dev/main builds have proxy support - skip version check- :- elif ! version_ge "$PULSE_VERSION" "$MIN_PROXY_VERSION"; then- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "⚠️ Pulse upgrade required for temperature proxy"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "Detected Pulse version: $PULSE_VERSION"- echo "Minimum required version: $MIN_PROXY_VERSION"- echo ""- echo "Please upgrade the Pulse container before rerunning this setup script."- echo ""- TEMP_MONITORING_AVAILABLE=false- fi-fi--# If Pulse is containerized, try to install proxy automatically (unless already present)-if [ "$TEMP_MONITORING_AVAILABLE" = true ] && [ "$PULSE_IS_CONTAINERIZED" = true ] && [ -n "$PULSE_CTID" ] && [ "$SKIP_TEMPERATURE_PROMPT" != true ]; then- # Try automatic installation - proxy keeps SSH credentials on the host for security- if true; then- # Download installer script from Pulse server- PROXY_INSTALLER="/tmp/install-sensor-proxy-$$.sh"- INSTALLER_URL="$PULSE_URL/api/install/install-sensor-proxy.sh"-- echo "Installing pulse-sensor-proxy..."- if curl --fail --silent --location \- "$INSTALLER_URL" \- -o "$PROXY_INSTALLER" 2>/dev/null; then- chmod +x "$PROXY_INSTALLER"-- # Run installer with Pulse server as fallback- INSTALL_OUTPUT=$("$PROXY_INSTALLER" --ctid "$PULSE_CTID" --pulse-server "$PULSE_URL" --quiet 2>&1)- INSTALL_STATUS=$?-- if [ -n "$INSTALL_OUTPUT" ]; then- echo "$INSTALL_OUTPUT"- fi-- if [ $INSTALL_STATUS -eq 0 ]; then- # Verify proxy health- PROXY_HEALTHY=false- if systemctl is-active --quiet pulse-sensor-proxy 2>/dev/null; then- PROXY_HEALTHY=true- echo ""- echo "✓ Secure proxy architecture enabled"- echo " SSH keys are managed on the host for enhanced security"- echo ""- else- echo ""- echo "⚠️ pulse-sensor-proxy service is not active. Check logs with:"- echo " journalctl -u pulse-sensor-proxy -n 40"- TEMP_MONITORING_AVAILABLE=false- fi-- if [ "$TEMP_MONITORING_AVAILABLE" = true ] && [ ! -S /run/pulse-sensor-proxy/pulse-sensor-proxy.sock ]; then- echo " ✗ Proxy socket not found at /run/pulse-sensor-proxy/pulse-sensor-proxy.sock"- echo " Check logs with: journalctl -u pulse-sensor-proxy -n 40"- TEMP_MONITORING_AVAILABLE=false- fi-- # Fetch the proxy's SSH public key now that it's installed and running- if [ "$TEMP_MONITORING_AVAILABLE" = true ] && [ "$PROXY_HEALTHY" = true ]; then- echo " • Fetching SSH public key from proxy..."- # Try CLI command first- TEMPERATURE_PROXY_KEY=$(/opt/pulse/sensor-proxy/bin/pulse-sensor-proxy keys 2>/dev/null | grep "Proxy Public Key:" | cut -d' ' -f4-)-- # Fallback: try to read keys directly from file- if [ -z "$TEMPERATURE_PROXY_KEY" ] && [ -f "/var/lib/pulse-sensor-proxy/ssh/id_ed25519.pub" ]; then- TEMPERATURE_PROXY_KEY=$(cat /var/lib/pulse-sensor-proxy/ssh/id_ed25519.pub)- echo " ✓ Fetched SSH key from file"- fi-- if [ -n "$TEMPERATURE_PROXY_KEY" ] && [[ "$TEMPERATURE_PROXY_KEY" =~ ^ssh-(rsa|ed25519) ]]; then- SSH_SENSORS_PUBLIC_KEY="$TEMPERATURE_PROXY_KEY"- SSH_SENSORS_KEY_ENTRY="command=\"sensors -j\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $TEMPERATURE_PROXY_KEY # pulse-sensor-proxy"- echo " ✓ SSH public key retrieved from proxy"- else- echo " ⚠️ Could not fetch SSH key from proxy (this is normal if container hasn't restarted yet)"- echo " Rerun this setup script after the Pulse container restarts"- fi- fi-- # Note: Mount configuration and container restart are handled by the installer- if [ "$TEMP_MONITORING_AVAILABLE" = true ]; then- TEMPERATURE_ENABLED=true- SKIP_TEMPERATURE_PROMPT=true- fi- else- echo ""- echo "⚠️ Proxy installation had issues - you may need to configure manually"- if [ -n "$INSTALL_OUTPUT" ]; then- echo ""- echo "$INSTALL_OUTPUT" | tail -n 40- echo ""- fi- fi-- rm -f "$PROXY_INSTALLER"- else- # Proxy installer not available - configure automatic ProxyJump instead- echo ""- echo "ℹ️ Proxy not available - configuring automatic SSH ProxyJump"- echo ""-- # Get the current Proxmox host's IP/hostname- PROXY_JUMP_HOST=$(hostname)- PROXY_JUMP_IP=$(hostname -I | awk '{print $1}')-- # We'll configure Pulse's SSH config to use this host as a jump point- # This will be done when temperature monitoring is enabled- CONFIGURE_PROXYJUMP=true- fi- fi-fi--# Check if SSH key is already configured-SSH_ALREADY_CONFIGURED=false-SSH_LEGACY_KEY=false--if [ -n "$SSH_PUBLIC_KEY" ] && [ -f /root/.ssh/authorized_keys ]; then- if grep -qF "$SSH_RESTRICTED_KEY_ENTRY" /root/.ssh/authorized_keys 2>/dev/null; then- SSH_ALREADY_CONFIGURED=true- elif grep -qF "$SSH_PUBLIC_KEY" /root/.ssh/authorized_keys 2>/dev/null; then- SSH_ALREADY_CONFIGURED=true- SSH_LEGACY_KEY=true- fi-fi--# Single temperature monitoring prompt-if [ "$SKIP_TEMPERATURE_PROMPT" = true ]; then- # Check if socket existed before this script ran (PROXY_SOCKET_EXISTED_AT_START is more reliable than SUMMARY_PROXY_INSTALLED)- if [ "$PROXY_SOCKET_EXISTED_AT_START" = true ]; then- # Socket existed before this script ran - this is a repair scenario- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "🔧 Refreshing pulse-sensor-proxy installation"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "Existing proxy detected - updating to refresh tokens and control-plane settings..."- echo ""-- # Download and run installer to refresh config- PROXY_INSTALLER="/tmp/install-sensor-proxy-repair-$$.sh"- INSTALLER_URL="$PULSE_URL/api/install/install-sensor-proxy.sh"-- if curl --fail --silent --location "$INSTALLER_URL" -o "$PROXY_INSTALLER" 2>/dev/null; then- chmod +x "$PROXY_INSTALLER"-- # Determine correct installer mode based on how it was originally deployed- # Priority: 1) PULSE_CTID from live detection, 2) SUMMARY_CTID from install_summary.json, 3) standalone check- INSTALLER_ARGS=""- DETECTED_CTID=""-- if [ "$PULSE_IS_CONTAINERIZED" = true ] && [ -n "$PULSE_CTID" ]; then- # Live container detection succeeded- DETECTED_CTID="$PULSE_CTID"- elif [ -n "$SUMMARY_CTID" ]; then- # Verify the container actually exists before using the stale ID- if command -v pct >/dev/null 2>&1 && pct status "$SUMMARY_CTID" >/dev/null 2>&1; then- DETECTED_CTID="$SUMMARY_CTID"- fi- fi-- if [ -n "$DETECTED_CTID" ]; then- # Was deployed for containerized Pulse - use --ctid mode- INSTALLER_ARGS="--ctid $DETECTED_CTID --pulse-server $PULSE_URL --quiet"- else- # Fallback to host-mode installation (works for standalone nodes and cluster nodes with external Pulse)- # We use --standalone flag to indicate host-level installation without container integration- INSTALLER_ARGS="--standalone --http-mode --pulse-server $PULSE_URL --quiet"- fi-- if [ -n "$INSTALLER_ARGS" ]; then- # Check if service is already running- if systemctl is-active --quiet pulse-sensor-proxy 2>/dev/null; then- echo "✓ pulse-sensor-proxy service is already running"- echo " Refreshing configuration and token..."- echo ""- fi-- # Run installer to refresh config and restart service- # The installer handles stopping/restarting on its own- INSTALL_OUTPUT=$("$PROXY_INSTALLER" $INSTALLER_ARGS 2>&1)- REPAIR_STATUS=$?-- if [ -n "$INSTALL_OUTPUT" ]; then- echo "$INSTALL_OUTPUT"- fi-- if [ $REPAIR_STATUS -eq 0 ]; then- # Verify proxy health (same checks as main install path)- PROXY_HEALTHY=false- if systemctl is-active --quiet pulse-sensor-proxy 2>/dev/null; then- PROXY_HEALTHY=true- echo ""- echo "✓ pulse-sensor-proxy refreshed successfully"- echo ""- else- echo ""- echo "⚠️ pulse-sensor-proxy service is not active. Check logs with:"- echo " journalctl -u pulse-sensor-proxy -n 40"- echo ""- fi-- if [ "$PROXY_HEALTHY" = true ] && [ ! -S /run/pulse-sensor-proxy/pulse-sensor-proxy.sock ]; then- echo " ✗ Proxy socket not found at /run/pulse-sensor-proxy/pulse-sensor-proxy.sock"- echo " Check logs with: journalctl -u pulse-sensor-proxy -n 40"- PROXY_HEALTHY=false- fi-- if [ "$PROXY_HEALTHY" = true ]; then- # Fetch the proxy's SSH public key- echo " • Fetching SSH public key from proxy..."- # Try CLI command first- TEMPERATURE_PROXY_KEY=$(/opt/pulse/sensor-proxy/bin/pulse-sensor-proxy keys 2>/dev/null | grep "Proxy Public Key:" | cut -d' ' -f4-)-- # Fallback: try to read keys directly from file- if [ -z "$TEMPERATURE_PROXY_KEY" ] && [ -f "/var/lib/pulse-sensor-proxy/ssh/id_ed25519.pub" ]; then- TEMPERATURE_PROXY_KEY=$(cat /var/lib/pulse-sensor-proxy/ssh/id_ed25519.pub)- echo " ✓ Fetched SSH key from file"- fi-- if [ -n "$TEMPERATURE_PROXY_KEY" ] && [[ "$TEMPERATURE_PROXY_KEY" =~ ^ssh-(rsa|ed25519) ]]; then- SSH_SENSORS_PUBLIC_KEY="$TEMPERATURE_PROXY_KEY"- SSH_SENSORS_KEY_ENTRY="command=\"sensors -j\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $TEMPERATURE_PROXY_KEY # pulse-sensor-proxy"- echo " ✓ SSH public key retrieved from proxy"- else- echo " ⚠️ Could not fetch SSH key from proxy"- fi- fi- # Note: Keep TEMPERATURE_ENABLED=true even if health checks fail, since proxy was already working- else- echo ""- echo "⚠️ Proxy repair failed - keeping existing proxy configuration"- if [ -n "$INSTALL_OUTPUT" ]; then- echo ""- echo "$INSTALL_OUTPUT" | tail -n 20- fi- echo ""- # Note: Keep TEMPERATURE_ENABLED=true since proxy was already working before repair attempt- fi-- rm -f "$PROXY_INSTALLER"- fi- # Note: Keep TEMPERATURE_ENABLED=true in all cases - proxy existed and may still be working- else- echo "⚠️ Could not download installer from $INSTALLER_URL"- echo " Keeping existing configuration"- echo ""- # Note: Keep TEMPERATURE_ENABLED=true since proxy already exists- fi- else- # Fresh install from this run - skip repair- echo "Temperature monitoring configured via pulse-sensor-proxy"- TEMPERATURE_ENABLED=true- fi-elif [ "$SSH_ALREADY_CONFIGURED" = true ]; then- TEMPERATURE_ENABLED=true- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "Temperature monitoring is currently ENABLED"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"+if [ -n "$SSH_SENSORS_PUBLIC_KEY" ]; then+ echo "📊 Enable Temperature Monitoring?"echo ""- echo "What would you like to do?"+ echo "Collect CPU and drive temperatures via secure SSH connection."echo ""- echo " [1] Keep - Leave temperature monitoring enabled (no changes)"- echo " [2] Remove - Disable and remove SSH access"- echo " [3] Skip - Skip this section"+ echo "Security:"+ echo " • SSH key authentication with forced command (sensors -j only)"+ echo " • No shell access, port forwarding, or other SSH features"+ echo " • Keys stored in Pulse service user's home directory"echo ""- echo -n "Your choice [1/2/3]: "+ echo "Enable temperature monitoring? [y/N]"+ echo -n "> "if [ -t 0 ]; then- read -p "> " -n 1 -r SSH_ACTION+ read -n 1 -r SSH_REPLYelse# When stdin is not a terminal (e.g., curl | bash), try /dev/tty first, then stdin for piped input- if read -p "> " -n 1 -r SSH_ACTION </dev/tty 2>/dev/null; then+ if read -n 1 -r SSH_REPLY </dev/tty 2>/dev/null; then:- elif read -t 2 -n 1 -r SSH_ACTION 2>/dev/null && [ -n "$SSH_ACTION" ]; then- echo "$SSH_ACTION"+ elif read -t 2 -n 1 -r SSH_REPLY 2>/dev/null && [ -n "$SSH_REPLY" ]; then+ echo "$SSH_REPLY"else- echo "(No terminal available - keeping existing configuration)"- SSH_ACTION="1"+ echo "(No terminal available - skipping temperature monitoring)"+ SSH_REPLY="n"fifiecho ""echo ""- if [[ $SSH_ACTION == "2" ]]; then- echo "Removing temperature monitoring configuration..."+ if [[ $SSH_REPLY =~ ^[Yy]$ ]]; then+ echo "Configuring temperature monitoring..."++ # Add key to root's authorized_keys+ mkdir -p /root/.ssh+ chmod 700 /root/.ssh- # Remove the SSH key from authorized_keys+ # Remove any old pulse keysif [ -f /root/.ssh/authorized_keys ]; then- grep -vF "$SSH_PUBLIC_KEY" /root/.ssh/authorized_keys > /root/.ssh/authorized_keys.tmp+ grep -vF "# pulse-" /root/.ssh/authorized_keys > /root/.ssh/authorized_keys.tmp 2>/dev/null || touch /root/.ssh/authorized_keys.tmpmv /root/.ssh/authorized_keys.tmp /root/.ssh/authorized_keys- chmod 600 /root/.ssh/authorized_keys- echo " ✓ SSH key removed from authorized_keys"fi- echo ""- echo "Temperature monitoring has been disabled."- echo "Note: lm-sensors package was NOT removed (in case you use it elsewhere)"- TEMPERATURE_ENABLED=false- elif [[ $SSH_ACTION == "3" ]]; then- echo "Temperature monitoring configuration unchanged."- else- if [ "$SSH_LEGACY_KEY" = true ]; then- echo "Updating Pulse SSH key to sensors-only access..."- TMP_AUTH_KEYS=$(mktemp)- if [ -f /root/.ssh/authorized_keys ]; then- grep -vF "$SSH_PUBLIC_KEY" /root/.ssh/authorized_keys > "$TMP_AUTH_KEYS"- fi- echo "$SSH_RESTRICTED_KEY_ENTRY" >> "$TMP_AUTH_KEYS"- mv "$TMP_AUTH_KEYS" /root/.ssh/authorized_keys- chmod 600 /root/.ssh/authorized_keys- echo " ✓ SSH key restricted to sensors -j"- else- echo "Temperature monitoring configuration unchanged."- fi- fi-elif [ "$TEMP_MONITORING_AVAILABLE" = true ]; then- # SECURITY: Block SSH-based temperature monitoring for containerized Pulse (unless dev mode)- if [ "$PULSE_IS_CONTAINERIZED" = true ]; then- # Check for dev mode override (from Pulse server environment)- DEV_MODE_RESPONSE=$(curl -s "$PULSE_URL/api/health" 2>/dev/null | grep -o '"devModeSSH"[[:space:]]*:[[:space:]]*true' || echo "")-- if [ -n "$DEV_MODE_RESPONSE" ]; then- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "⚠️ DEV MODE: SSH Temperature Monitoring"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "SSH key generation is ENABLED for testing/development."- echo ""- echo "WARNING: This grants root SSH access from the container!"- echo " NEVER use this in production environments."- echo ""- echo "To disable: Remove PULSE_DEV_ALLOW_CONTAINER_SSH from container env"- echo ""- # Allow the setup to continue- else- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "🔒 Temperature Monitoring - Security Notice"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "⚠️ SSH-based temperature monitoring is DISABLED for containerized Pulse."- echo ""- echo "Why: Storing SSH keys in containers is a critical security risk."- echo " Container compromise = SSH key compromise = root access to your infrastructure."- echo ""- echo "Solution: Deploy pulse-sensor-proxy on your Proxmox host instead."- echo ""- echo "Installation:"- echo " 1. Download: curl -o /usr/local/bin/pulse-sensor-proxy https://github.com/..."- echo " 2. Make executable: chmod +x /usr/local/bin/pulse-sensor-proxy"- echo " 3. Create systemd service (see docs)"- echo " 4. Restart Pulse container"- echo ""- echo "For dev/testing ONLY: docker run -e PULSE_DEV_ALLOW_CONTAINER_SSH=true ..."- echo "Documentation: https://github.com/rcourtman/Pulse/blob/main/SECURITY.md#critical-security-notice-for-container-deployments"- echo ""- TEMPERATURE_ENABLED=false- fi- fi-- if [ "$PULSE_IS_CONTAINERIZED" = false ] || [ -n "$DEV_MODE_RESPONSE" ]; then- echo "📊 Enable Temperature Monitoring?"- echo ""- echo "Collect CPU and drive temperatures via secure SSH connection."- echo ""- echo "Security:"- echo " • SSH key authentication with forced command (sensors -j only)"- echo " • No shell access, port forwarding, or other SSH features"- echo " • Keys stored in Pulse service user's home directory"- echo ""- echo "Enable temperature monitoring? [y/N]"- echo -n "> "+ echo "$SSH_SENSORS_KEY_ENTRY" >> /root/.ssh/authorized_keys+ chmod 600 /root/.ssh/authorized_keys+ echo " ✓ Sensors key configured (restricted to sensors -j)"- if [ -t 0 ]; then- read -n 1 -r SSH_REPLY- else- # When stdin is not a terminal (e.g., curl | bash), try /dev/tty first, then stdin for piped input- if read -n 1 -r SSH_REPLY </dev/tty 2>/dev/null; then- :- elif read -t 2 -n 1 -r SSH_REPLY 2>/dev/null && [ -n "$SSH_REPLY" ]; then- echo "$SSH_REPLY"- else- echo "(No terminal available - skipping temperature monitoring)"- SSH_REPLY="n"- fi+ # Check if this is a Raspberry Pi+ IS_RPI=false+ if [ -f /proc/device-tree/model ] && grep -qi "raspberry pi" /proc/device-tree/model 2>/dev/null; then+ IS_RPI=truefi- echo ""- echo ""-- if [[ $SSH_REPLY =~ ^[Yy]$ ]]; then- echo "Configuring temperature monitoring..."-- if [ "$IS_STANDALONE_NODE" = true ]; then- echo " • Deploying hardened pulse-sensor-proxy..."- PROXY_INSTALLER_URL="$PULSE_URL/api/install/install-sensor-proxy.sh"- PROXY_INSTALLER=$(mktemp)- if curl -fsSL "$PROXY_INSTALLER_URL" -o "$PROXY_INSTALLER" 2>/dev/null; then- chmod +x "$PROXY_INSTALLER"- if "$PROXY_INSTALLER" --standalone --http-mode --pulse-server "$PULSE_URL" --quiet; then- echo " ✓ pulse-sensor-proxy installed and registered with Pulse"- STANDALONE_PROXY_DEPLOYED=true- TEMPERATURE_ENABLED=true- else- echo " ⚠️ Proxy installer reported an error; falling back to SSH-based collector"- fi- rm -f "$PROXY_INSTALLER"- else- echo " ⚠️ Unable to download proxy installer from $PULSE_URL"- echo " Falling back to SSH-based temperature monitoring."- fi- fi-- if [ "$STANDALONE_PROXY_DEPLOYED" = true ]; then- echo ""- echo "✓ Temperature monitoring will use pulse-sensor-proxy on this host."- echo " Temperature data will appear in the dashboard within 10 seconds."- if [ -f /root/.ssh/authorized_keys ]; then- TMP_AUTH_KEYS=$(mktemp)- if grep -v '# pulse-' /root/.ssh/authorized_keys > "$TMP_AUTH_KEYS" 2>/dev/null; then- chmod --reference=/root/.ssh/authorized_keys "$TMP_AUTH_KEYS" 2>/dev/null || chmod 600 "$TMP_AUTH_KEYS"- chown --reference=/root/.ssh/authorized_keys "$TMP_AUTH_KEYS" 2>/dev/null || true- mv "$TMP_AUTH_KEYS" /root/.ssh/authorized_keys- else- rm -f "$TMP_AUTH_KEYS"- fi- fi- else-- if [ -n "$SSH_SENSORS_PUBLIC_KEY" ]; then- # Add keys to root's authorized_keys- mkdir -p /root/.ssh- chmod 700 /root/.ssh-- # Remove any old pulse keys- if [ -f /root/.ssh/authorized_keys ]; then- grep -vF "# pulse-" /root/.ssh/authorized_keys > /root/.ssh/authorized_keys.tmp 2>/dev/null || touch /root/.ssh/authorized_keys.tmp- mv /root/.ssh/authorized_keys.tmp /root/.ssh/authorized_keys- fi-- # If this node is the ProxyJump host, add the proxy key- if [ "$CONFIGURE_PROXYJUMP" = true ]; then- echo "$SSH_PROXY_KEY_ENTRY" >> /root/.ssh/authorized_keys- echo " ✓ ProxyJump key configured (restricted to port forwarding)"- fi-- # Always add the sensors key (for temperature collection)- echo "$SSH_SENSORS_KEY_ENTRY" >> /root/.ssh/authorized_keys- chmod 600 /root/.ssh/authorized_keys- echo " ✓ Sensors key configured (restricted to sensors -j)"-- # Check if this is a Raspberry Pi- IS_RPI=false- if [ -f /proc/device-tree/model ] && grep -qi "raspberry pi" /proc/device-tree/model 2>/dev/null; then- IS_RPI=true- fi-- TEMPERATURE_SETUP_SUCCESS=false- # Install lm-sensors if not present (skip on Raspberry Pi)- if ! command -v sensors &> /dev/null; then- if [ "$IS_RPI" = true ]; then- echo " ℹ️ Raspberry Pi detected - using native RPi temperature interface"- echo " Pulse will read temperature from /sys/class/thermal/thermal_zone0/temp"- TEMPERATURE_SETUP_SUCCESS=true- else- echo " ✓ Installing lm-sensors..."-- # Try to update and install, but provide helpful errors if it fails- UPDATE_OUTPUT=$(apt-get update -qq 2>&1)- if echo "$UPDATE_OUTPUT" | grep -q "Could not create temporary file\|/tmp"; then- echo ""- echo " ⚠️ APT cannot write to /tmp directory"- echo " This may be a permissions issue. To fix:"- echo " sudo chown root:root /tmp"- echo " sudo chmod 1777 /tmp"- echo ""- echo " Attempting installation anyway..."- elif echo "$UPDATE_OUTPUT" | grep -q "Failed to fetch\|GPG error\|no longer has a Release file"; then- echo " ⚠️ Some repository errors detected, attempting installation anyway..."- fi+ TEMPERATURE_SETUP_SUCCESS=false- if apt-get install -y lm-sensors > /dev/null 2>&1; then- sensors-detect --auto > /dev/null 2>&1 || true- echo " ✓ lm-sensors installed successfully"- TEMPERATURE_SETUP_SUCCESS=true- else- echo ""- echo " ⚠️ Could not install lm-sensors"- echo " Possible causes:"- echo " - Repository configuration errors"- echo " - /tmp directory permission issues"- echo " - Network connectivity problems"- echo ""- echo " To fix manually:"- echo " 1. Check /tmp permissions: ls -ld /tmp"- echo " (should be: drwxrwxrwt owned by root:root)"- echo " 2. Fix if needed: sudo chown root:root /tmp && sudo chmod 1777 /tmp"- echo " 3. Install: sudo apt-get update && sudo apt-get install -y lm-sensors"- echo ""- fi- fi- else- echo " ✓ lm-sensors package verified"+ # Install lm-sensors if not present (skip on Raspberry Pi)+ if ! command -v sensors &> /dev/null; then+ if [ "$IS_RPI" = true ]; then+ echo " ℹ️ Raspberry Pi detected - using native RPi temperature interface"+ echo " Pulse will read temperature from /sys/class/thermal/thermal_zone0/temp"TEMPERATURE_SETUP_SUCCESS=true- fi-- echo ""- if [ "$TEMPERATURE_SETUP_SUCCESS" = true ]; then- echo "✓ Temperature monitoring enabled"- if [ "$IS_RPI" = true ]; then- echo " Using Raspberry Pi native temperature interface"- fi- echo " Temperature data will appear in the dashboard within 10 seconds"- TEMPERATURE_ENABLED=trueelse- echo "✗ Temperature monitoring could not be enabled"- echo " Resolve the installation issues above and rerun this step."- fi+ echo " ✓ Installing lm-sensors..."- # Configure automatic ProxyJump if needed (for containerized Pulse)- if [ "$CONFIGURE_PROXYJUMP" = true ] && [ -n "$PROXY_JUMP_HOST" ]; then- echo ""- echo "Configuring automatic SSH ProxyJump for containerized Pulse..."-- # Get list of all cluster nodes (or just this node if standalone)- ALL_NODES="${PROXY_JUMP_HOST}"- if command -v pvecm >/dev/null 2>&1; then- CLUSTER_OUTPUT=$(pvecm nodes 2>/dev/null || true)- if [ -n "$CLUSTER_OUTPUT" ]; then- CLUSTER_NODES=$(echo "$CLUSTER_OUTPUT" | awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $3}')- if [ -n "$CLUSTER_NODES" ]; then- ALL_NODES="$CLUSTER_NODES"- fi- fi+ # Try to update and install, but provide helpful errors if it fails+ UPDATE_OUTPUT=$(apt-get update -qq 2>&1)+ if echo "$UPDATE_OUTPUT" | grep -q "Could not create temporary file\|/tmp"; then+ echo ""+ echo " ⚠️ APT cannot write to /tmp directory"+ echo " This may be a permissions issue. To fix:"+ echo " sudo chown root:root /tmp"+ echo " sudo chmod 1777 /tmp"+ echo ""+ echo " Attempting installation anyway..."+ elif echo "$UPDATE_OUTPUT" | grep -q "Failed to fetch\|GPG error\|no longer has a Release file"; then+ echo " ⚠️ Some repository errors detected, attempting installation anyway..."fi- # Create SSH config with separate aliases for proxy and sensors- # ${PROXY_JUMP_HOST}-proxy: uses proxy key for ProxyJump- # ${PROXY_JUMP_HOST}: uses sensors key for temperature collection- SSH_CONFIG="Host ${PROXY_JUMP_HOST}-proxy- HostName ${PROXY_JUMP_IP}- User root- IdentityFile ~/.ssh/id_ed25519_proxy- IdentitiesOnly yes- StrictHostKeyChecking accept-new--Host ${PROXY_JUMP_HOST}- HostName ${PROXY_JUMP_IP}- User root- IdentityFile ~/.ssh/id_ed25519_sensors- IdentitiesOnly yes- StrictHostKeyChecking accept-new-"-- # Add ProxyJump config for each cluster node- for NODE in $ALL_NODES; do- if [ "$NODE" != "$PROXY_JUMP_HOST" ]; then- # Resolve node IP address (try getent, fallback to just the hostname)- NODE_IP=$(getent hosts "$NODE" 2>/dev/null | awk '{print $1}' | head -1)- if [ -z "$NODE_IP" ]; then- NODE_IP="$NODE" # Fallback to hostname if resolution fails- fi-- SSH_CONFIG="${SSH_CONFIG}-Host ${NODE}- HostName ${NODE_IP}- ProxyJump ${PROXY_JUMP_HOST}-proxy- User root- IdentityFile ~/.ssh/id_ed25519_sensors- IdentitiesOnly yes- StrictHostKeyChecking accept-new-"- fi- done-- # Write SSH config to Pulse container- # This will be written to /home/pulse/.ssh/config inside the container- echo "$SSH_CONFIG" | curl -s -X POST "$PULSE_URL/api/system/ssh-config" \- -H "Content-Type: text/plain" \- -H "Authorization: Bearer $AUTH_TOKEN" \- --data-binary @- > /dev/null 2>&1-- if [ $? -eq 0 ]; then- echo " ✓ ProxyJump configured - temperature monitoring will work automatically"+ if apt-get install -y lm-sensors > /dev/null 2>&1; then+ sensors-detect --auto > /dev/null 2>&1 || true+ echo " ✓ lm-sensors installed successfully"+ TEMPERATURE_SETUP_SUCCESS=trueelse- echo " ⚠️ Could not configure ProxyJump automatically"+ echo ""+ echo " ⚠️ Could not install lm-sensors"+ echo " Possible causes:"+ echo " - Repository configuration errors"+ echo " - /tmp directory permission issues"+ echo " - Network connectivity problems"+ echo ""+ echo " To fix manually:"+ echo " 1. Check /tmp permissions: ls -ld /tmp"+ echo " (should be: drwxrwxrwt owned by root:root)"+ echo " 2. Fix if needed: sudo chown root:root /tmp && sudo chmod 1777 /tmp"+ echo " 3. Install: sudo apt-get update && sudo apt-get install -y lm-sensors"+ echo ""fifielse- echo ""- echo "⚠️ Temperature monitoring cannot be configured yet"- echo ""- if [ "$PULSE_IS_CONTAINERIZED" = true ]; then- echo "Pulse is running in a container, which requires pulse-sensor-proxy."- echo ""- echo "Current status:"- echo " • pulse-sensor-proxy: Not installed or not providing SSH key"- echo " • Container socket mount: Unknown (check docker-compose.yml)"- echo ""- echo "Next steps:"- echo " 1. If the proxy was just installed, restart the Pulse container:"- echo " docker-compose restart pulse"- echo ""- echo " 2. Verify the socket is mounted in the container:"- echo " docker exec pulse ls -la /run/pulse-sensor-proxy/pulse-sensor-proxy.sock"- echo ""- echo " 3. Rerun this setup script - it will automatically fetch the SSH key"- echo ""- echo "Documentation:"- echo " https://github.com/rcourtman/Pulse/blob/main/docs/TEMPERATURE_MONITORING.md#quick-start-for-docker-deployments"- else- echo "For bare-metal Pulse deployments:"- echo " • SSH keys should be auto-generated on first use"- echo " • Check Pulse logs for SSH key generation errors"- echo " • Verify the Pulse service user has write access to ~/.ssh/"- echo ""- echo "If problems persist, check:"- echo " journalctl -u pulse -n 100 | grep -i ssh"- fi- fi- fi # End hardened proxy branch- else- echo "Temperature monitoring skipped."+ echo " ✓ lm-sensors package verified"+ TEMPERATURE_SETUP_SUCCESS=truefi- fi # End of non-containerized temperature monitoring-fi # End of TEMP_MONITORING_AVAILABLE--# Offer to configure other Proxmox cluster nodes if temperature monitoring is enabled here-if [ "$TEMPERATURE_ENABLED" = true ] && command -v pvecm >/dev/null 2>&1 && command -v ssh >/dev/null 2>&1; then- CLUSTER_OUTPUT=$(pvecm nodes 2>/dev/null || true)- if [ -n "$CLUSTER_OUTPUT" ]; then- LOCAL_NODE=$(hostname -s 2>/dev/null || hostname)- CLUSTER_NODES=$(echo "$CLUSTER_OUTPUT" | awk 'NR>1 && $1 ~ /^[0-9]+$/ {print $3}')-- if [ -n "$CLUSTER_NODES" ]; then- OTHER_NODES_LIST=()- while read -r NODE_NAME; do- if [ -n "$NODE_NAME" ] && [ "$NODE_NAME" != "$LOCAL_NODE" ]; then- # Avoid duplicates- SKIP_NODE=false- for EXISTING in "${OTHER_NODES_LIST[@]}"; do- if [ "$EXISTING" = "$NODE_NAME" ]; then- SKIP_NODE=true- break- fi- done- if [ "$SKIP_NODE" = false ]; then- OTHER_NODES_LIST+=("$NODE_NAME")- fi- fi- done <<< "$CLUSTER_NODES"-- if [ ${#OTHER_NODES_LIST[@]} -gt 0 ]; then- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "Cluster Node Configuration"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "Detected additional Proxmox nodes in cluster:"- for NODE in "${OTHER_NODES_LIST[@]}"; do- echo " • $NODE"- done- echo ""- echo "Configure temperature monitoring on these nodes as well?"- echo -n "[y/N]: "-- if [ -t 0 ]; then- read -p "> " -n 1 -r REMOTE_REPLY- else- if read -p "> " -n 1 -r REMOTE_REPLY </dev/tty 2>/dev/null; then- :- else- echo "(No terminal available - skipping remote configuration)"- REMOTE_REPLY="n"- fi- fi- echo ""- echo ""-- if [[ $REMOTE_REPLY =~ ^[Yy]$ ]]; then- for NODE in "${OTHER_NODES_LIST[@]}"; do- echo "Configuring temperature monitoring on $NODE..."- if ssh -o BatchMode=yes -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o LogLevel=ERROR root@"$NODE" "bash -s" <<EOF-set -e-SSH_SENSORS_PUBLIC_KEY='$SSH_SENSORS_PUBLIC_KEY'-SSH_SENSORS_KEY_ENTRY='$SSH_SENSORS_KEY_ENTRY'-mkdir -p /root/.ssh-chmod 700 /root/.ssh-AUTH_KEYS=/root/.ssh/authorized_keys-# Remove any old pulse keys-if [ -f "\$AUTH_KEYS" ]; then- grep -vF "# pulse-" "\$AUTH_KEYS" > "\$AUTH_KEYS.tmp" 2>/dev/null || touch "\$AUTH_KEYS.tmp"- mv "\$AUTH_KEYS.tmp" "\$AUTH_KEYS"-fi-# Add sensors key (cluster nodes only need sensors key, not proxy key)-echo "\$SSH_SENSORS_KEY_ENTRY" >> "\$AUTH_KEYS"-chmod 600 "\$AUTH_KEYS"-if ! command -v sensors >/dev/null 2>&1; then- echo " - Installing lm-sensors..."- export DEBIAN_FRONTEND=noninteractive- APT_LOG=$(mktemp)- if ! apt-get update -qq >"$APT_LOG" 2>&1; then- echo " ! apt-get update failed."- if grep -qi "enterprise.proxmox.com" "$APT_LOG"; then- echo " - Detected Proxmox enterprise repository without subscription; switching to no-subscription repository."- if [ -f /etc/apt/sources.list.d/pve-enterprise.list ]; then- cp /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.pulsebak 2>/dev/null || true- if grep -q "^[[:space:]]*deb" /etc/apt/sources.list.d/pve-enterprise.list; then- sed -i 's|^[[:space:]]*deb|# Pulse auto-disabled: deb|' /etc/apt/sources.list.d/pve-enterprise.list- fi- fi- if [ ! -f /etc/apt/sources.list.d/pve-no-subscription.list ]; then- CODENAME=$(. /etc/os-release 2>/dev/null && echo "$VERSION_CODENAME")- if [ -z "$CODENAME" ]; then- CODENAME=$(lsb_release -cs 2>/dev/null || echo "bookworm")- fi- echo "deb http://download.proxmox.com/debian/pve $CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list- fi- if apt-get update -qq >>"$APT_LOG" 2>&1; then- echo " ✓ Switched to no-subscription repository."- else- echo " ! apt-get update still failed after switching repositories."++ echo ""+ if [ "$TEMPERATURE_SETUP_SUCCESS" = true ]; then+ echo "✓ Temperature monitoring enabled"+ if [ "$IS_RPI" = true ]; then+ echo " Using Raspberry Pi native temperature interface"fi+ echo " Temperature data will appear in the dashboard within 10 seconds"+ TEMPERATURE_ENABLED=trueelse- echo " ! apt-get update error was not recognized. Please review apt configuration on this node."+ echo "⚠️ Temperature monitoring setup incomplete"+ echo " You can re-run this script after installing lm-sensors"fi- fi- if apt-get install -y -qq lm-sensors >/dev/null 2>&1; then- sensors-detect --auto >/dev/null 2>&1 || true- echo " ✓ lm-sensors installed"else- echo " ! Failed to install lm-sensors automatically. Please resolve apt issues and rerun this script."+ echo "Skipping temperature monitoring."fi- rm -f "$APT_LOG"else- echo " ✓ lm-sensors package verified"-fi-EOF- then- echo " ✓ Temperature monitoring enabled on $NODE"- else- echo " ✗ Failed to configure $NODE (check SSH/cluster connectivity)"- fi- echo ""- done-- # Verify that Pulse can actually SSH to the configured nodes- echo ""- # Check if we're using the temperature proxy- # If proxy key was detected earlier, we're using proxy-based temperature monitoring- if [ -n "$TEMPERATURE_PROXY_KEY" ]; then- # Using proxy - verification not needed, proxy handles SSH- echo "✓ Temperature monitoring configured via pulse-sensor-proxy"- echo " Temperature data will appear in the dashboard within 10 seconds"- echo ""- elif [ "$PULSE_IS_CONTAINERIZED" != true ]; then- # Non-containerized Pulse - can verify SSH directly- echo "Verifying temperature monitoring connectivity from Pulse..."- echo ""-- CONFIGURED_NODES="${OTHER_NODES_LIST[@]}"- if [ "$TEMPERATURE_ENABLED" = true ]; then- # Add current node to the list- CONFIGURED_NODES="$(hostname) ${CONFIGURED_NODES}"- fi-- VERIFY_RESPONSE=$(curl -s -X POST "$PULSE_URL/api/system/verify-temperature-ssh" \- -H "Content-Type: application/json" \- -H "Authorization: Bearer $AUTH_TOKEN" \- -d "{\"nodes\": \"$CONFIGURED_NODES\"}" 2>/dev/null || echo "")-- if [ -n "$VERIFY_RESPONSE" ]; then- echo "$VERIFY_RESPONSE"- else- echo "⚠️ Unable to verify SSH connectivity."- echo " Temperature data will appear once SSH connectivity is configured."- fi- echo ""- else- # Containerized without proxy - temperature data will appear automatically- echo "✓ Temperature monitoring configured"- echo " Note: Container cannot directly SSH to nodes"- echo " Temperature data will appear once proxy is configured on the host"- echo ""- fi- fi- fi- fi- fi-fi--# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━-# Standalone Node Configuration (for non-cluster nodes)-# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━--# If standalone and temperature monitoring was enabled via SSH fallback, ensure proxy key is configured-if [ "$IS_STANDALONE_NODE" = true ] && [ "$TEMPERATURE_ENABLED" = true ] && [ "$STANDALONE_PROXY_DEPLOYED" != true ]; then- echo ""- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo "Standalone Node Temperature Setup"- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"- echo ""- echo "Detected: This is a standalone node (not in a Proxmox cluster)"- echo ""- echo "For enhanced security with containerized Pulse, we'll fetch the"- echo "temperature proxy's SSH key directly from your Pulse server."- echo ""-- # Try to fetch the proxy's public key from Pulse server- PROXY_KEY_URL="$PULSE_URL/api/system/proxy-public-key"- echo "Fetching temperature proxy public key..."-- PROXY_PUBLIC_KEY=$(curl -s -f "$PROXY_KEY_URL" 2>/dev/null || echo "")-- if [ -n "$PROXY_PUBLIC_KEY" ] && [[ "$PROXY_PUBLIC_KEY" =~ ^ssh-(rsa|ed25519) ]]; then- echo " ✓ Retrieved proxy public key"-- # Build the forced command entry for the proxy key- PROXY_RESTRICTED_KEY="command=\"sensors -j\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $PROXY_PUBLIC_KEY # pulse-proxy-key"-- # Check if key already exists- if [ -f /root/.ssh/authorized_keys ] && grep -qF "$PROXY_PUBLIC_KEY" /root/.ssh/authorized_keys 2>/dev/null; then- echo " ✓ Proxy key already configured"- else- # Add the proxy key- mkdir -p /root/.ssh- chmod 700 /root/.ssh-- # Remove any old pulse-proxy-key entries first- if [ -f /root/.ssh/authorized_keys ]; then- grep -v '# pulse-proxy-key' /root/.ssh/authorized_keys > /root/.ssh/authorized_keys.tmp 2>/dev/null || true- mv /root/.ssh/authorized_keys.tmp /root/.ssh/authorized_keys- fi-- # Add the new proxy key- echo "$PROXY_RESTRICTED_KEY" >> /root/.ssh/authorized_keys- chmod 600 /root/.ssh/authorized_keys- echo " ✓ Temperature proxy key installed (restricted to sensors -j)"- fi-- echo ""- echo "✓ Standalone node temperature monitoring configured"- echo " The Pulse temperature proxy can now collect temperature data"- echo " from this node using secure SSH with forced commands."- echo ""- else- echo " ℹ️ Using standard SSH key (proxy key not available)"- echo " (This is normal for non-containerized Pulse)"- echo ""- fi+ echo "Temperature monitoring keys are not available from Pulse."fi+echo ""echo ""echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"echo "Setup Complete"@@ -5499,7 +4382,7 @@ fipulseIP,authToken,storagePerms,- sshKeys.ProxyPublicKey, sshKeys.SensorsPublicKey, minProxyReadyVersion)+ sshKeys.SensorsPublicKey)} else { // PBSscript = fmt.Sprintf(`#!/bin/bash@@ -6784,15 +5667,14 @@ func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, _ *http}-// SSHKeyPair holds both proxy and sensors SSH keypairs+// SSHKeyPair holds the sensors SSH public key for temperature monitoring.type SSHKeyPair struct {- ProxyPublicKey stringSensorsPublicKey string}-// getOrGenerateSSHKeys returns both SSH public keys (proxy + sensors) for temperature monitoring+// getOrGenerateSSHKeys returns the SSH public key for temperature monitoring// If keys don't exist, they are generated automatically-// SECURITY: Blocks key generation when running in containers - use pulse-sensor-proxy instead+// SECURITY: Blocks key generation when running in containers unless dev mode override is enabledfunc (h *ConfigHandlers) getOrGenerateSSHKeys() SSHKeyPair {// CRITICAL SECURITY CHECK: Never generate SSH keys in containers (unless dev mode)// Container compromise = SSH key compromise = root access to Proxmox@@ -6801,7 +5683,7 @@ func (h *ConfigHandlers) getOrGenerateSSHKeys() SSHKeyPair {if isContainer && !devModeAllowSSH {log.Error().Msg("SECURITY BLOCK: SSH key generation disabled in containerized deployments")- log.Error().Msg("For temperature monitoring in containers, deploy pulse-sensor-proxy on the Proxmox host")+ log.Error().Msg("Temperature monitoring via SSH is disabled in containerized deployments")log.Error().Msg("See: https://github.com/rcourtman/Pulse/blob/main/SECURITY.md#critical-security-notice-for-container-deployments")log.Error().Msg("To test SSH keys in dev/lab only: PULSE_DEV_ALLOW_CONTAINER_SSH=true (NEVER in production!)")return SSHKeyPair{}@@ -6820,18 +5702,12 @@ func (h *ConfigHandlers) getOrGenerateSSHKeys() SSHKeyPair {sshDir := filepath.Join(homeDir, ".ssh")- // Generate/load proxy key (for ProxyJump)- proxyPrivPath := filepath.Join(sshDir, "id_ed25519_proxy")- proxyPubPath := filepath.Join(sshDir, "id_ed25519_proxy.pub")- proxyKey := h.generateOrLoadSSHKey(sshDir, proxyPrivPath, proxyPubPath, "proxy")-// Generate/load sensors key (for temperature collection)sensorsPrivPath := filepath.Join(sshDir, "id_ed25519_sensors")sensorsPubPath := filepath.Join(sshDir, "id_ed25519_sensors.pub")sensorsKey := h.generateOrLoadSSHKey(sshDir, sensorsPrivPath, sensorsPubPath, "sensors")return SSHKeyPair{- ProxyPublicKey: proxyKey,SensorsPublicKey: sensorsKey,}}diff --git a/internal/api/config_handlers_setup_script_test.go b/internal/api/config_handlers_setup_script_test.goindex b299cde971..3f61e1472a 100644--- a/internal/api/config_handlers_setup_script_test.go+++ b/internal/api/config_handlers_setup_script_test.go@@ -75,21 +75,6 @@ func TestPVESetupScriptArgumentAlignment(t *testing.T) {contains stringdesc string}{- {- name: "repair_installer_url",- contains: `INSTALLER_URL="$PULSE_URL/api/install/install-sensor-proxy.sh"`,- desc: "Repair block INSTALLER_URL should use $PULSE_URL bash variable",- },- {- name: "repair_ctid_pulse_server",- contains: `--pulse-server $PULSE_URL`,- desc: "Repair --ctid --pulse-server should use $PULSE_URL bash variable",- },- {- name: "runtime_auth_token_ssh_config",- contains: `-H "Authorization: Bearer $AUTH_TOKEN"`,- desc: "SSH config Authorization header should use runtime $AUTH_TOKEN variable",- },{name: "token_id_uses_tokenname",contains: `Token ID: $PULSE_TOKEN_ID`,diff --git a/internal/api/rate_limit_config.go b/internal/api/rate_limit_config.goindex 39ec819b20..20a6b8b855 100644--- a/internal/api/rate_limit_config.go+++ b/internal/api/rate_limit_config.go@@ -108,7 +108,6 @@ func GetRateLimiterForEndpoint(path string, method string) *RateLimiter {strings.Contains(path, "/api/version") ||strings.Contains(path, "/api/security/status") ||strings.Contains(path, "/api/security/validate-bootstrap-token") ||- strings.Contains(path, "/api/temperature-proxy/authorized-nodes") ||strings.Contains(path, "/metrics") {return globalRateLimitConfig.PublicEndpoints}diff --git a/internal/api/rate_limit_config_test.go b/internal/api/rate_limit_config_test.goindex 4be9e6192f..bdce9f8ef2 100644--- a/internal/api/rate_limit_config_test.go+++ b/internal/api/rate_limit_config_test.go@@ -222,13 +222,6 @@ func TestGetRateLimiterForEndpoint(t *testing.T) {wantLimiterPtr: &globalRateLimitConfig.PublicEndpoints,wantLimiterNm: "PublicEndpoints",},- {- name: "temperature proxy authorized nodes",- path: "/api/temperature-proxy/authorized-nodes",- method: http.MethodGet,- wantLimiterPtr: &globalRateLimitConfig.PublicEndpoints,- wantLimiterNm: "PublicEndpoints",- },{name: "metrics endpoint",path: "/metrics",diff --git a/internal/api/system_settings.go b/internal/api/system_settings.goindex c2ec5adfb0..8bbb6d56f2 100644--- a/internal/api/system_settings.go+++ b/internal/api/system_settings.go@@ -36,7 +36,6 @@ type SystemSettingsHandler struct {EnableTemperatureMonitoring()DisableTemperatureMonitoring()GetNotificationManager() *notifications.NotificationManager- HasSocketTemperatureProxy() bool}}@@ -48,7 +47,6 @@ func NewSystemSettingsHandler(cfg *config.Config, persistence *config.ConfigPersEnableTemperatureMonitoring()DisableTemperatureMonitoring()GetNotificationManager() *notifications.NotificationManager- HasSocketTemperatureProxy() bool}, reloadSystemSettingsFunc func(), reloadMonitorFunc func() error) *SystemSettingsHandler {return &SystemSettingsHandler{config: cfg,@@ -68,7 +66,6 @@ func (h *SystemSettingsHandler) SetMonitor(m interface {EnableTemperatureMonitoring()DisableTemperatureMonitoring()GetNotificationManager() *notifications.NotificationManager- HasSocketTemperatureProxy() bool}) {h.monitor = m}@@ -610,34 +607,6 @@ func (h *SystemSettingsHandler) HandleUpdateSystemSettings(w http.ResponseWritersettings.BackupPollingEnabled = updates.BackupPollingEnabled}if _, ok := rawRequest["temperatureMonitoringEnabled"]; ok {- if updates.TemperatureMonitoringEnabled {- socketAvailable := false- if h.monitor != nil {- socketAvailable = h.monitor.HasSocketTemperatureProxy()- }- if !socketAvailable {- missing := make([]string, 0)- if h.config != nil {- for _, inst := range h.config.PVEInstances {- if strings.TrimSpace(inst.TemperatureProxyURL) == "" || strings.TrimSpace(inst.TemperatureProxyToken) == "" {- name := strings.TrimSpace(inst.Name)- if name == "" {- name = strings.TrimSpace(inst.Host)- }- if name == "" {- name = "unnamed node"- }- missing = append(missing, name)- }- }- }- if len(missing) > 0 {- message := fmt.Sprintf("Cannot enable temperature monitoring: proxy socket is not available and the following nodes do not have HTTPS proxies configured: %s", strings.Join(missing, ", "))- http.Error(w, message, http.StatusBadRequest)- return- }- }- }settings.TemperatureMonitoringEnabled = updates.TemperatureMonitoringEnabledtempToggleRequested = true}diff --git a/internal/api/system_settings_handlers_test.go b/internal/api/system_settings_handlers_test.goindex 2090f8ba19..98d17e5ef9 100644--- a/internal/api/system_settings_handlers_test.go+++ b/internal/api/system_settings_handlers_test.go@@ -20,7 +20,6 @@ import (// MockMonitor implementationtype mockMonitor struct {- hasSocketProxy bool}func (m *mockMonitor) GetDiscoveryService() *discovery.Service { return nil }@@ -30,7 +29,6 @@ func (m *mockMonitor) StopDiscoveryService()func (m *mockMonitor) EnableTemperatureMonitoring() {}func (m *mockMonitor) DisableTemperatureMonitoring() {}func (m *mockMonitor) GetNotificationManager() *notifications.NotificationManager { return nil }-func (m *mockMonitor) HasSocketTemperatureProxy() bool { return m.hasSocketProxy }func TestHandleGetSystemSettings(t *testing.T) {tempDir := t.TempDir()