mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 14:27:21 +01:00
A 2026-09-14 posture audit found the box well guarded (default-deny ufw, keys-only SSH, fail2ban, unattended upgrades, offsite restic) but blind: no intrusion or integrity detection at all, and the GitHub org with secret scanning off on all 48 repos and every marketplace action allowed with the box's root SSH key in an org secret. This adds the detection layer on the existing alert channel, so a break-in becomes one Telegram message within five minutes instead of a discovery months later. - install-security-watch.sh: security-check.sh (5-min timer) alerts on CHANGE only — guards down, sshd drift, edits to the files an intruder touches (sshd/sudoers/authorized_keys/cron/PAM/ld.so.preload/Caddy/ufw/ monitoring/units), new internet-facing ports, new privileged accounts, SSH logins from never-seen IPs that are not GitHub runners, processes from /tmp or miners, new setuid binaries, new containers, stale offsite backup, week-old pending reboot. Baselines seed silently; one grouped message per tick; every message ends with what to do. - github-security-check.sh (daily): new secret-scanning alert, new critical dependency alert, repo turning public, new member/collaborator/deploy key, Actions allowlist loosened. Every API call guarded: a failed call skips its check and keeps the baseline (the first version paged an error body as a policy change, and a wiped baseline would flood "new" next day). - Caddy JSON access log on every vhost (snippet + sync-infra template) and a fail2ban caddy-scan jail: 8 probes for /.env, /.git, wp-login, cgi-bin … in 10 min = 24h ban. Proven by scanning orangecat.ch from the laptop (tenth request refused); a real scanner was banned within minutes. - sshd drop-in: 3 tries, no X11, dead-peer detection, AllowUsers root ubuntu. - scripts/local/laptop-security-check (user timer, 30 min): new network listener, sshd running, screen lock off, upgrades off, ~/.ssh changes, new login account, gh identity change, week-old reboot; delivered through the box's lib-alert over SSH, desktop notification as fallback. - test-security-check.sh (test:ops): 39 assertions extracting the shipped heredocs; the property under test is "speaks once on change, never when nothing changed". - docs/telegram-notifications.md: every new message registered. Applied outside the repo in the same session: secret scanning + push protection on 41/44 active repos (3 private repos are not eligible on the plan) and as org defaults; Dependabot alerts + automated security fixes on all 44; org Actions policy = GitHub-owned + verified + an explicit allowlist of the 11 third-party actions the fleet uses. Claude-Session: https://claude.ai/code/session_01G6ax7X9GfarifcZUiqsVJm Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>