feat(go): port FIM/pkgdb/rootcheck integrity engines and add go-sidecar dashboard consumer

Adds sidecar-only, --state-dir-gated FIM, package-DB-anchor, and rootcheck
engines to the Go migration sidecar, wired into agent.Sweep/Initialize
behind the existing baseline lifecycle. Adds a read-only, schema-checked
Python dashboard consumer (go_sidecar_state_dir, /api/go-sidecar/*, Sidecar
tab) that never starts, stops, or mutates the Go sidecar's state.

Also fixes drift found while reconciling this work: enodia_sentinel/web.py
had reinvented local schema constants instead of using the canonical
enodia_sentinel/schemas.py catalog (now registers enodia.go.sidecar.v1
there and reuses ALERT_SNAPSHOT_V1/INCIDENT_V1); docs/RULES.md had drifted
from what `rules docs` actually generates for SIDs 100069-100078 (ruleops.py
was missing metadata for four SIDs and had stale drill text for four more),
now back in sync with a regression test pinning them together.

Updates CLAUDE.md, README.md, go-agent/README.md, and docs/{ROADMAP,
GO_PORT_HANDOFF,SURICATA_ASSIMILATION,THREAT_MODEL,OPERATIONS,SCHEMAS,
COMMAND_REFERENCE}.md to reflect the landed work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NQivSKBqQJsayz1xcYqWzZ
This commit is contained in:
Luna 2026-07-24 09:59:09 -07:00
parent 1d1dee7f6e
commit d835386381
No known key found for this signature in database
43 changed files with 3419 additions and 72 deletions

View file

@ -27,9 +27,12 @@ import (
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/ebpfsource"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/eventlog"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/events"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/fim"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/health"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/incident"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/model"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/pkgdb"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/rootcheck"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/schema"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/sdnotify"
"codeberg.org/anassaeneroi/enodia-sentinal/go-agent/internal/snapshot"
@ -203,6 +206,21 @@ func run() error {
runner.Lifecycle = baseline.New(cfg, func() []string {
return system.ScanSUIDBinaries(*suidRoot, cfg.SUIDScanExtraDirs)
})
// The FIM engine shares only the sidecar's explicitly selected state
// directory. It never reads or rewrites Python's production baseline.
if cfg.FIMEnabled {
runner.FIM = fim.New(cfg)
}
if cfg.PackageDBVerify {
// The anchor resides in the same selected sidecar tree as its FIM
// baseline; it never reads or updates Python's production anchor.
runner.PackageDB = pkgdb.New(cfg)
}
if cfg.RootcheckEnabled {
// Rootcheck has no persistent baseline, but remains sidecar-only too:
// fixture and parity runs must stay hermetic and free of host probes.
runner.Rootcheck = rootcheck.New(cfg)
}
}
if *host != "" {
runner.Host = func() (string, error) { return *host, nil }
@ -265,6 +283,9 @@ func run() error {
); err != nil {
return err
}
// Persist only settings for actually-attached integrity engines. The slow
// enrichment worker remains observational and never runs an engine.
snapshotStore.ConfigureIntegrity(cfg, runner.FIM != nil, runner.Rootcheck != nil)
snapshotStore.EnableSlowEnrichment()
defer snapshotStore.Close()
}