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.
64 lines
2.2 KiB
Go
64 lines
2.2 KiB
Go
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package fleet
|
|
|
|
import "strings"
|
|
|
|
// flagWeights is a copy of SEVERITY_BY_FLAG in the Security Hub triage script. Unknown flags weigh 1 and
|
|
// `backup_failed:<job>` weighs 3 (see FlagWeight).
|
|
var flagWeights = map[string]int{
|
|
"auto_updates_not_enabled": 2,
|
|
"backup_stale": 3,
|
|
"ci_runner_down": 3,
|
|
"ci_runner_probe_stale": 2,
|
|
"ci_runner_restart_loop": 3,
|
|
"ci_runner_unregistered": 2,
|
|
"ci_runner_wrong_server": 3,
|
|
"collector_failed": 3,
|
|
"compose_privileged_container": 3,
|
|
"compose_restart_loop": 2,
|
|
"compose_service_missing": 3,
|
|
"compose_service_unhealthy": 3,
|
|
"compose_unexpected_port": 3,
|
|
"ctf_auto_restart_suppressed": 4,
|
|
"ctf_auto_restarted": 2,
|
|
"ctf_cpu_sustained": 3,
|
|
"ctf_outbound_connections": 3,
|
|
"ctf_process_unexpected": 3,
|
|
"ctf_watch_stale": 2,
|
|
"disk_space_critical": 5,
|
|
"disk_space_low": 2,
|
|
"edr_backend_degraded": 2,
|
|
"edr_daemon_down": 3,
|
|
"edr_finding_critical": 4,
|
|
"edr_finding_high": 3,
|
|
"edr_rules_stale": 2,
|
|
"extra_uid0_accounts_present": 5,
|
|
"fail2ban_missing_or_inactive": 3,
|
|
"firewall_not_detected": 4,
|
|
"forgejo_snapshot_stale": 3,
|
|
"forgejo_status_stale": 2,
|
|
"forgejo_timer_disabled": 2,
|
|
"forgejo_update_failed": 3,
|
|
"known_exploited_vulnerable_package": 5,
|
|
"nopasswd_sudo_present": 5,
|
|
"security_updates_pending": 3,
|
|
"ssh_password_auth_enabled": 4,
|
|
"ssh_root_login_not_disabled": 4,
|
|
"third_party_updates_pending": 3,
|
|
"tls_cert_expiring": 3,
|
|
"updates_kept_back": 2,
|
|
"vulnerability_coverage_incomplete": 2,
|
|
"vulnerable_package_detected": 4,
|
|
}
|
|
|
|
// FlagWeight returns the severity weight of a flag.
|
|
func FlagWeight(flag string) int {
|
|
if w, ok := flagWeights[flag]; ok {
|
|
return w
|
|
}
|
|
if strings.HasPrefix(flag, "backup_failed:") {
|
|
return 3
|
|
}
|
|
return 1
|
|
}
|