- Go Agent (FreeBSD/amd64) fuer OPNsense - Go Backend (Linux/amd64) mit REST API + SQLite - Collector: Hardware, CPU, Memory, Disks, Network, Services, WireGuard, DHCP (KEA/ISC/dnsmasq), Routes, Gateways, Certificates, Plugins, Updates - Persistente Agent-ID - TLS + API-Key Auth - WebSocket-Infrastruktur (WIP): bidirektionaler Command-Kanal, TCP-Tunnel fuer Remote-Zugriff auf Firewall-WebUI - Lastenheft und README
165 lines
5.0 KiB
Go
165 lines
5.0 KiB
Go
package models
|
|
|
|
// SystemData - Alle Systemdaten die der Agent sendet
|
|
type SystemData struct {
|
|
AgentID string `json:"agent_id"`
|
|
Hostname string `json:"hostname"`
|
|
OPNsenseVersion string `json:"opnsense_version"`
|
|
FreeBSDVersion string `json:"freebsd_version"`
|
|
UptimeSeconds int64 `json:"uptime_seconds"`
|
|
Hardware HardwareInfo `json:"hardware"`
|
|
CPU CPUInfo `json:"cpu"`
|
|
Memory MemoryInfo `json:"memory"`
|
|
Disks []DiskInfo `json:"disks"`
|
|
NetworkInterfaces []NetworkInterface `json:"network_interfaces"`
|
|
Services []ServiceInfo `json:"services"`
|
|
WireGuard []WireGuardTunnel `json:"wireguard,omitempty"`
|
|
DHCP *DHCPInfo `json:"dhcp,omitempty"`
|
|
Routes []Route `json:"routes,omitempty"`
|
|
Gateways []GatewayInfo `json:"gateways,omitempty"`
|
|
Certificates []CertificateInfo `json:"certificates,omitempty"`
|
|
Plugins []PluginInfo `json:"plugins,omitempty"`
|
|
Updates *UpdateInfo `json:"updates,omitempty"`
|
|
}
|
|
|
|
type WireGuardTunnel struct {
|
|
Interface string `json:"interface"`
|
|
PublicKey string `json:"public_key"`
|
|
ListenPort int `json:"listen_port"`
|
|
Peers []WireGuardPeer `json:"peers"`
|
|
}
|
|
|
|
type WireGuardPeer struct {
|
|
PublicKey string `json:"public_key"`
|
|
Endpoint string `json:"endpoint"`
|
|
AllowedIPs []string `json:"allowed_ips"`
|
|
LatestHandshake int64 `json:"latest_handshake_epoch"`
|
|
HandshakeAge string `json:"handshake_age"`
|
|
TransferRx int64 `json:"transfer_rx_bytes"`
|
|
TransferTx int64 `json:"transfer_tx_bytes"`
|
|
Keepalive int `json:"persistent_keepalive"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type DHCPInfo struct {
|
|
Server string `json:"server"`
|
|
Leases []DHCPLease `json:"leases"`
|
|
}
|
|
|
|
type DHCPLease struct {
|
|
IP string `json:"ip"`
|
|
MAC string `json:"mac"`
|
|
Hostname string `json:"hostname"`
|
|
Start string `json:"start,omitempty"`
|
|
End string `json:"end,omitempty"`
|
|
Status string `json:"status"`
|
|
Pool string `json:"pool,omitempty"`
|
|
}
|
|
|
|
type HardwareInfo struct {
|
|
Manufacturer string `json:"manufacturer"`
|
|
Model string `json:"model"`
|
|
Serial string `json:"serial"`
|
|
BIOSVersion string `json:"bios_version"`
|
|
}
|
|
|
|
type CPUInfo struct {
|
|
Model string `json:"model"`
|
|
Cores int `json:"cores"`
|
|
Threads int `json:"threads"`
|
|
FreqMHz int `json:"freq_mhz"`
|
|
UsagePercent float64 `json:"usage_percent"`
|
|
}
|
|
|
|
type MemoryInfo struct {
|
|
TotalBytes int64 `json:"total_bytes"`
|
|
UsedBytes int64 `json:"used_bytes"`
|
|
FreeBytes int64 `json:"free_bytes"`
|
|
}
|
|
|
|
type DiskInfo struct {
|
|
Filesystem string `json:"filesystem"`
|
|
TotalBytes int64 `json:"total_bytes"`
|
|
UsedBytes int64 `json:"used_bytes"`
|
|
FreeBytes int64 `json:"free_bytes"`
|
|
MountPoint string `json:"mount_point"`
|
|
}
|
|
|
|
type NetworkInterface struct {
|
|
Name string `json:"name"`
|
|
Role string `json:"role"`
|
|
IP string `json:"ip"`
|
|
MAC string `json:"mac"`
|
|
Status string `json:"status"`
|
|
RxBytes int64 `json:"rx_bytes"`
|
|
TxBytes int64 `json:"tx_bytes"`
|
|
}
|
|
|
|
type ServiceInfo struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type Route struct {
|
|
Destination string `json:"destination"`
|
|
Gateway string `json:"gateway"`
|
|
Flags string `json:"flags"`
|
|
Interface string `json:"interface"`
|
|
}
|
|
|
|
type GatewayInfo struct {
|
|
Name string `json:"name"`
|
|
Address string `json:"address"`
|
|
Status string `json:"status"`
|
|
Loss string `json:"loss,omitempty"`
|
|
Delay string `json:"delay,omitempty"`
|
|
Stddev string `json:"stddev,omitempty"`
|
|
Monitor string `json:"monitor,omitempty"`
|
|
}
|
|
|
|
type CertificateInfo struct {
|
|
Name string `json:"name"`
|
|
Subject string `json:"subject"`
|
|
Issuer string `json:"issuer"`
|
|
NotBefore string `json:"not_before"`
|
|
NotAfter string `json:"not_after"`
|
|
DaysLeft int `json:"days_left"`
|
|
Serial string `json:"serial"`
|
|
SAN string `json:"san,omitempty"`
|
|
KeyUsage string `json:"key_usage,omitempty"`
|
|
IsCA bool `json:"is_ca"`
|
|
Status string `json:"status"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
type PluginInfo struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
type UpdateInfo struct {
|
|
UpdateAvailable bool `json:"update_available"`
|
|
PendingCount int `json:"pending_count"`
|
|
Updates []PendingUpdateInfo `json:"updates"`
|
|
OPNsenseUpdate string `json:"opnsense_update,omitempty"`
|
|
}
|
|
|
|
type PendingUpdateInfo struct {
|
|
Package string `json:"package"`
|
|
CurrentVer string `json:"current_version"`
|
|
NewVer string `json:"new_version"`
|
|
}
|
|
|
|
// HeartbeatRequest
|
|
type HeartbeatRequest struct {
|
|
AgentID string `json:"agent_id"`
|
|
SystemData SystemData `json:"system_data"`
|
|
}
|
|
|
|
// HeartbeatResponse
|
|
type HeartbeatResponse struct {
|
|
Message string `json:"message"`
|
|
}
|