gitmdm

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package gitmdm defines shared data structures for gitMDM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidCheckName

func IsValidCheckName(name string) bool

IsValidCheckName validates that a check name contains only safe characters.

Types

type Check

type Check struct {
	Timestamp   time.Time       `json:"-"`                     // Not stored in JSON, set from file mtime
	Outputs     []CommandOutput `json:"outputs"`               // All command outputs for this check
	Status      string          `json:"status"`                // "pass", "fail", or "n/a"
	Reason      string          `json:"reason"`                // Human-readable explanation of the status
	Remediation []string        `json:"remediation,omitempty"` // Steps to fix if failed
}

Check represents a compliance check result, potentially with multiple command outputs.

type CommandOutput

type CommandOutput struct {
	Command     string   `json:"command,omitempty"`      // Command that was executed
	File        string   `json:"file,omitempty"`         // File that was read
	Stdout      string   `json:"stdout,omitempty"`       // Command stdout or file contents
	Stderr      string   `json:"stderr,omitempty"`       // Command stderr
	FailReason  string   `json:"fail_reason,omitempty"`  // Why this specific check failed
	Remediation []string `json:"remediation,omitempty"`  // Remediation steps for this failure
	ExitCode    int      `json:"exit_code,omitempty"`    // Command exit code
	FileMissing bool     `json:"file_missing,omitempty"` // True if file doesn't exist
	Skipped     bool     `json:"skipped,omitempty"`      // True if command was skipped (not found)
	Failed      bool     `json:"failed,omitempty"`       // True if this specific check failed
}

CommandOutput represents the output from a single command or file check.

type Device

type Device struct {
	LastSeen   time.Time        `json:"last_seen"`
	LastIP     string           `json:"last_ip"`
	Checks     map[string]Check `json:"checks"`
	HardwareID string           `json:"hardware_id"`
	Hostname   string           `json:"hostname"`
	User       string           `json:"user"`
	// In-memory only fields (not persisted to git)
	OS            string `json:"-"`
	Architecture  string `json:"-"`
	Version       string `json:"-"`
	SystemUptime  string `json:"-"`
	CPULoad       string `json:"-"`
	LoggedInUsers string `json:"-"`
}

Device represents a monitored device with its compliance status.

type DeviceReport

type DeviceReport struct {
	Timestamp     time.Time        `json:"timestamp"`
	Checks        map[string]Check `json:"checks"`
	HardwareID    string           `json:"hardware_id"`
	Hostname      string           `json:"hostname"`
	User          string           `json:"user"`
	OS            string           `json:"os,omitempty"`
	Architecture  string           `json:"architecture,omitempty"`
	Version       string           `json:"version,omitempty"`
	SystemUptime  string           `json:"system_uptime,omitempty"`
	CPULoad       string           `json:"cpu_load,omitempty"`
	LoggedInUsers string           `json:"logged_in_users,omitempty"`
}

DeviceReport represents a compliance report sent by an agent.

Jump to

Keyboard shortcuts

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