Pulse/cmd
rcourtman 611ae5b9f8 Add --agent-id-file so containerized agents keep a stable identity
Pulse agents derive their identity from /etc/machine-id by default. In
Docker containers (especially nested in LXCs), /etc/machine-id is not
guaranteed stable across container recreation: a fresh image instance
gets a new machine-id, and the resulting AgentID drift causes the
server to reject reports with 401 because the API token is bound to
the original AgentID via the bound_agent_id token-metadata check
(internal/api/router.go:1448-1458). Refs #1447.

Add a --agent-id-file (and PULSE_AGENT_ID_FILE env var) flag that:

  1. Reads the persisted AgentID from the file on start, when present,
     and short-circuits machine-id detection. The user mounts the file
     as a Docker volume (e.g. -v pulse-agent-id:/var/lib/pulse-agent)
     so it survives container recreation.
  2. On first start (or when the file is missing/empty), the existing
     machine-id derivation runs and the resolved ID is written to the
     file atomically (tmp + rename, 0600 perms, parent dir created).

Subsequent restarts of the container — even after `docker rm -f` and
a fresh `docker run` — read the same ID from the volume and the
server keeps recognising the agent.

Default is no flag set, which preserves the current
/etc/machine-id-derived behaviour for non-containerized installs.
2026-04-30 11:50:08 +01:00
..
eval fix: address linting issues and test adjustments 2026-02-01 23:27:11 +00:00
hashpw feat: remove Enterprise badges, simplify Pro upgrade prompts 2026-01-09 16:51:08 +00:00
pulse fix(server): fail fast on frontend bind errors 2026-03-03 15:43:22 +00:00
pulse-agent Add --agent-id-file so containerized agents keep a stable identity 2026-04-30 11:50:08 +01:00
pulse-host-agent fix: Update runtime config when toggling Docker update actions setting 2026-01-03 11:14:17 +00:00