All checks were successful
release / build (push) Successful in 4m3s
One view from /v1/posture, /v1/alerts, /v1/queue and /v1/backups: per host the active flags ranked by weight, how long each has been open, a short next step, the suggested approval actions with their newest queue entry, and flagged backup jobs. Flags on every fresh host are shown once as fleet-wide. alerts, queue and backups degrade on 404; posture is required. Exit 0 when clean, 1 on any flag or stale host, 2 config, 3 transport.
54 lines
2.7 KiB
Go
54 lines
2.7 KiB
Go
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package fleet
|
|
|
|
import "strings"
|
|
|
|
// flagHints is one short imperative line per known flag. Generic wording only.
|
|
var flagHints = map[string]string{
|
|
"security_updates_pending": "apply package updates (update playbook, human-run)",
|
|
"third_party_updates_pending": "apply package updates (update playbook, human-run)",
|
|
"updates_kept_back": "review held-back packages, then update (human-run)",
|
|
"auto_updates_not_enabled": "enable unattended security updates",
|
|
"disk_space_low": "find what grew: du / docker system df",
|
|
"disk_space_critical": "free space now: du / docker system df",
|
|
"edr_rules_stale": "check the rule feed timer",
|
|
"edr_daemon_down": "restart the EDR daemon, then check its log",
|
|
"edr_backend_degraded": "check the EDR backend and its log",
|
|
"edr_finding_high": "review the EDR finding on the host",
|
|
"edr_finding_critical": "review the EDR finding on the host now",
|
|
"ssh_root_login_not_disabled": "queue remediate-ssh-root-login-host",
|
|
"ssh_password_auth_enabled": "disable ssh password login (hardening action)",
|
|
"firewall_not_detected": "enable and verify the host firewall",
|
|
"fail2ban_missing_or_inactive": "install or start fail2ban",
|
|
"extra_uid0_accounts_present": "inspect accounts with uid 0 and remove extras",
|
|
"nopasswd_sudo_present": "review sudoers for NOPASSWD entries",
|
|
"backup_stale": "check the backup job (hub backups)",
|
|
"vulnerable_package_detected": "update the affected package",
|
|
"known_exploited_vulnerable_package": "update the affected package now",
|
|
"vulnerability_coverage_incomplete": "check the vulnerability scan coverage",
|
|
"tls_cert_expiring": "renew the certificate",
|
|
"collector_failed": "see the host report: a collector failed",
|
|
}
|
|
|
|
// flagHintPrefixes cover flag families that share a hint.
|
|
var flagHintPrefixes = []struct{ prefix, hint string }{
|
|
{"backup_failed:", "check the backup job (hub backups)"},
|
|
{"compose_", "check the compose services on the host (docker compose ps)"},
|
|
{"ctf_", "check the lab watcher on the host"},
|
|
{"ci_runner_", "check the CI runner service on the host"},
|
|
{"forgejo_", "check the Forgejo update timer and status"},
|
|
}
|
|
|
|
// FlagHint returns the next-step hint for a flag.
|
|
func FlagHint(flag string) string {
|
|
if h, ok := flagHints[flag]; ok {
|
|
return h
|
|
}
|
|
for _, p := range flagHintPrefixes {
|
|
if strings.HasPrefix(flag, p.prefix) {
|
|
return p.hint
|
|
}
|
|
}
|
|
return "see the host report"
|
|
}
|