Add container detection warning to pulse-sensor-proxy startup (related to #628)

When pulse-sensor-proxy runs inside a container (Docker/LXC), it cannot
complete SSH workflows properly, leading to continuous [preauth] log floods
on the Proxmox host. This happens because the proxy is meant to run on the
host, not inside the container.

Changes:
- Import internal/system for InContainer() detection
- Add startup warning when running in containerized environment
- Point users to docs/TEMPERATURE_MONITORING.md for correct setup
- Allow suppression via PULSE_SENSOR_PROXY_SUPPRESS_CONTAINER_WARNING=true

This catches the misconfiguration early and directs users to supported
installation methods, preventing the SSH spam reported in discussion #628.
This commit is contained in:
rcourtman 2025-11-06 23:41:29 +00:00
parent 6a48c759e8
commit b5ef239973

View file

@ -19,6 +19,7 @@ import (
"time"
"github.com/rcourtman/pulse-go-rewrite/internal/ssh/knownhosts"
"github.com/rcourtman/pulse-go-rewrite/internal/system"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
@ -370,6 +371,12 @@ func runProxy() {
Str("version", Version).
Msg("Starting pulse-sensor-proxy")
// Warn if running inside a container - this is an unsupported configuration
// Container environments cannot complete SSH workflows, causing [preauth] log floods
if system.InContainer() && os.Getenv("PULSE_SENSOR_PROXY_SUPPRESS_CONTAINER_WARNING") != "true" {
log.Warn().Msg("pulse-sensor-proxy is running inside a container - this is unsupported and will cause SSH [preauth] log floods. Install on the Proxmox host instead. See docs/TEMPERATURE_MONITORING.md for setup instructions. Set PULSE_SENSOR_PROXY_SUPPRESS_CONTAINER_WARNING=true to suppress this warning.")
}
knownHostsManager, err := knownhosts.NewManager(filepath.Join(sshKeyPath, "known_hosts"))
if err != nil {
log.Fatal().Err(err).Msg("Failed to initialize known hosts manager")