monitoring: watch peers, devices, accounts and logins
All checks were successful
deploy / ansible (push) Successful in 8m12s
All checks were successful
deploy / ansible (push) Successful in 8m12s
Monitoring covered availability only: a new WireGuard peer, a machine on the private network, an extra account or key, or a login from outside the VPN would have gone unnoticed. security-metrics runs every minute on both hosts and exports what it finds for node_exporter: WireGuard peers and where they connect from, addresses answering a ping sweep of the VPC, login accounts, sudo and docker members, listening ports, containers with host-level access, and fingerprints of the account, sudoers, sshd, WireGuard and authorized_keys files. Each item is compared with a baseline in the role defaults and host_vars and exported with known="true|false", so a deliberate change has to update the baseline with it. On ops it also counts Forgejo users, keys and runners. Grafana gets a Security dashboard and an alert group for anything unknown, a changed access file, an SSH login from outside WireGuard, failed-login bursts on SSH, Forgejo, Grafana and the asxp.io admin, a new container, and for logs or the collector itself going quiet, which would otherwise blind the rest. It never reads `wg show dump`, which prints preshared keys. Assisted-by: Claude:fable-5-2
This commit is contained in:
parent
1c8eec8520
commit
56dd0255dc
1 changed files with 2961 additions and 1 deletions
|
|
@ -61,6 +61,32 @@ service to answer.
|
|||
[traefik-crawlers-statistics](https://git.asxp.io/asxpi/traefik-crawlers-statistics);
|
||||
update `roles/crawler_alert/files/` from there.
|
||||
|
||||
## Security monitoring
|
||||
|
||||
`security-metrics` (role `monitoring_agent`, every minute on both hosts)
|
||||
exports WireGuard peers, devices answering on the VPC, login accounts,
|
||||
sudo/docker members, listening ports and containers with host access, each
|
||||
with `known="true|false"` against a baseline, plus fingerprints of the
|
||||
account, sudoers, sshd, WireGuard and `authorized_keys` files. Grafana
|
||||
(dashboard Security, alert group `security`) mails on anything unknown, a
|
||||
changed file, an SSH login from outside WireGuard, failed-login bursts
|
||||
(SSH, Forgejo, Grafana, asxp.io admin), new Forgejo users, keys or
|
||||
runners, and logs or the collector going quiet.
|
||||
|
||||
A deliberate change needs its baseline updated in the same commit, or it
|
||||
alerts until it is:
|
||||
|
||||
| Change | Variable |
|
||||
|---|---|
|
||||
| WireGuard client | `wireguard_clients` (`group_vars/all/wireguard.yaml`) |
|
||||
| Server on the VPC | `security_vpc_hosts` |
|
||||
| Account, sudo or docker member | `security_login_users`, `security_sudo_users`, `security_docker_users` |
|
||||
| Published or listening port | `security_ports_extra` (host_vars) |
|
||||
| Privileged container, host network, Docker socket | `security_containers_extra` (host_vars) |
|
||||
|
||||
Defaults are in `roles/monitoring_agent/defaults/main.yaml`. The VPC check
|
||||
is a ping sweep: a device that drops ICMP is not seen.
|
||||
|
||||
## Bootstrap playbooks
|
||||
|
||||
| Playbook | Purpose |
|
||||
|
|
|
|||
Loading…
Reference in a new issue