feat(insights): push ban decisions to insights - #193
Draft
gsanchietti wants to merge 1 commit into
Draft
Conversation
Each node only bans what it saw itself, so the fleet has no shared memory of a scanner hitting many machines. Send every ban decision to nethesis-insights, where a later project can turn them into a global blacklist. Delivery reuses CrowdSec's own http notification plugin, the same way email alerts already work: no polling, no cursor, no extra timer. Decisions within 30 seconds go out in one request. Identity is the node subscription, read fresh from Redis at every render. Nothing is stored in the module environment, so a configured webhook cannot be aimed at another tenant, and a node that subscribes later starts working on its next reload. Delivery is best effort. A decision made while the service restarts is not retried. The receiving endpoint does not exist yet. Assisted-by: Claude Code:claude-opus-5[1m]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Each node only bans what it saw itself, so the fleet has no shared memory of a scanner hitting many machines. This sends every ban decision to nethesis-insights, where a later project can turn them into a global blacklist. Building that blacklist is not part of this PR.
Delivery reuses CrowdSec's own
notification-httpplugin, the same mechanism the email alerts already use — no polling, no cursor, no extra timer. Decisions fired within 30 seconds go out in one request. It is best effort: a decision made while the service is restarting is not retried.Identity is the node's subscription, read fresh from Redis every time the config is written. Nothing is stored in the module environment, so a configured webhook cannot be aimed at another tenant, and a node that subscribes later starts working on its next reload. A terminated subscription clears the config.
The receiving endpoint does not exist yet, so nothing works end to end until
nethesis-insightsimplementsPOST /v1/blocklist-evidence. The body it will receive:{ "schema_version": 1, "system_id": "<system_id>", "decisions": [ { "id": 1234, "value": "203.0.113.7", "scope": "Ip", "type": "ban", "scenario": "crowdsecurity/ssh-bf", "origin": "crowdsec", "duration": "3h59m59s", "created_at": "2026-08-07T14:00:00Z" } ] }Auth is
Authorization: Basic base64(system_id:auth_token), same as the existing/v1/bundles. Configuration input matchesns8-loki#70.How to test
Reload must not drop the container, and no token should appear in
journalctl -u crowdsec1or inmodule/crowdsec1/environment.Not done yet
pkg/models, verified only by executing the Go template against synthetic decisions locally.