Add file integrity monitoring (Tripwire-style), auto-refreshed via pacman hook
Detects binary/config tampering by content hash — catching a malicious swap even when mtime is preserved (the gap in mtime-based persistence checks). Two engines split by file ownership: - fim.py hash baseline: SHA-256 (+ mode/uid/gid/size) of security-critical files the package manager doesn't track (/usr/local, /etc configs, systemd units, SSH keys). The baseline refreshes ONLY via fim-update / the pacman hook, so a flagged change stays flagged until acknowledged (Tripwire semantics). Alerts: fim_modified 100017 / fim_added 100018 / fim_removed 100019. - package verification: `pacman -Qkk` checks package-owned binaries against the distro's own signed checksums — no baseline to maintain, implicitly current because the package DB updates on every upgrade. fim_pkg_modified 100020. Auto-update on system updates: a pacman PostTransaction hook runs `enodia-sentinel fim-update` after every install/upgrade/remove, so legitimate package changes never alert — no manual `tripwire --update`. - daemon: backgrounded FIM scan + optional pkg-verify on slow cadences, feeding the normal alert/snapshot/push pipeline; baseline loaded/built at startup - cli: fim-baseline / fim-update / fim-check [--packages] - config: fim_enabled, fim_paths, fim_scan_interval, fim_pkg_verify[_interval] - packaging: ship + install the pacman hook (Makefile + PKGBUILD) - tests: +7 (hashing, diff incl. mtime-preserving tamper, pacman -Qkk parse). 72/72 pass. Verified end-to-end: a content swap with preserved mtime is caught. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
07f5261d59
commit
5d577b624f
12 changed files with 467 additions and 3 deletions
34
README.md
34
README.md
|
|
@ -74,6 +74,9 @@ enodia_sentinel/
|
|||
├── alert.py Alert / Severity (with Snort-style sid + classtype)
|
||||
├── web.py read-only dashboard: stdlib http server + JSON API + auth
|
||||
├── static/ the self-contained dashboard SPA
|
||||
├── fim.py file integrity monitoring (hash baseline + pacman verify)
|
||||
├── triage.py false-positive classification
|
||||
├── provenance.py package-ownership lookups (pacman/dpkg/rpm)
|
||||
├── detectors/ poll detectors — one module per signature, each a pure
|
||||
│ function: detect(state, cfg) -> Iterable[Alert]
|
||||
├── notify/ outbound push — ntfy / Pushover / webhook backends
|
||||
|
|
@ -236,6 +239,33 @@ notify_ntfy_url = "https://ntfy.sh"
|
|||
notify_ntfy_topic = "enodia-7Hq2x" # keep this secret — it's the access control
|
||||
```
|
||||
|
||||
## File integrity monitoring (Tripwire-style)
|
||||
|
||||
Detects tampering with binaries and critical configs by **content hash**, so it
|
||||
catches a malicious swap even when the timestamp is preserved (the weakness of
|
||||
mtime-based checks). Two engines, split by who owns the file:
|
||||
|
||||
- **Package verification** — `pacman -Qkk` checks package-owned binaries against
|
||||
the distro's *own signed checksums*. No baseline to maintain, and it's
|
||||
implicitly current because the package DB updates on every `pacman -Syu`. A
|
||||
trojaned `/usr/bin/ssh` surfaces as a checksum mismatch (CRITICAL, `sid 100020`).
|
||||
- **Hash baseline** — a SHA-256 baseline of the files pacman *doesn't* track
|
||||
(`/usr/local`, `/etc` configs, systemd units, SSH keys). A pacman
|
||||
`PostTransaction` **hook** runs `fim-update` after every upgrade, so legitimate
|
||||
package changes never alert — no manual `tripwire --update` ritual.
|
||||
|
||||
```bash
|
||||
enodia-sentinel fim-baseline # establish the baseline
|
||||
enodia-sentinel fim-check # report changes vs baseline
|
||||
enodia-sentinel fim-check --packages # also verify package-owned files
|
||||
```
|
||||
|
||||
The baseline is **only** refreshed by `fim-update` / the pacman hook — a flagged
|
||||
change stays flagged until you acknowledge it, exactly like Tripwire. The daemon
|
||||
runs the scan on a slow background cadence (`fim_scan_interval`) and routes any
|
||||
change into the normal alert/snapshot/push pipeline (`fim_modified` `sid 100017`,
|
||||
`fim_added` `100018`, `fim_removed` `100019`).
|
||||
|
||||
## False positives & triage
|
||||
|
||||
A host IDS that cries wolf gets ignored, so Sentinel ships explicit tooling to
|
||||
|
|
@ -319,6 +349,10 @@ regression suite for both.
|
|||
|
||||
## Project status
|
||||
|
||||
v0.5 — adds **file integrity monitoring** (SHA-256 baseline + `pacman -Qkk`
|
||||
verification, auto-refreshed by a pacman hook) and **false-positive triage**
|
||||
via package-ownership provenance.
|
||||
|
||||
v0.4 — adds a read-only **web dashboard** (stdlib server, Tailscale-bound,
|
||||
token-auth) and **phone push** (ntfy / Pushover / webhook), both zero-dependency.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue