state

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MachineUUIDFromOS

func MachineUUIDFromOS() (string, bool)

MachineUUIDFromOS returns a UUID derived from the host D-Bus/machine ID when available.

We do not use github.com/shirou/gopsutil/v4/host.HostID (see host_linux.go): that API tries /sys/class/dmi/id/product_uuid first, then /etc/machine-id, then /proc/sys/kernel/random/boot_id. For Ghostpsy we need (1) stable OS identity from /etc/machine-id (e.g. Docker audit entrypoint may seed it), not DMI product UUID, and (2) never boot_id, which changes every reboot and would create a new machine row after each boot. Linux writes 32 lowercase hex bytes to /etc/machine-id (or /var/lib/dbus/machine-id). The value is formatted as a standard UUID string for ingest (backend stores uuid.UUID).

func Save

func Save(s *AgentState) error

Save writes state (creates directory).

Types

type AgentState

type AgentState struct {
	MachineUUID string `json:"machine_uuid"`
	ClaimCode   string `json:"claim_code"`
	ScanSeq     int    `json:"scan_seq"`
}

AgentState is persisted after the first successful `scan` setup (machine identity on this host).

func Load

func Load() (*AgentState, error)

Load reads ~/.config/ghostpsy/agent.json

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL