Skip to content

Add Guezli/mailcow-f2b-feed parser + scenario#1807

Open
Guezli wants to merge 1 commit into
crowdsecurity:masterfrom
Guezli:add-Guezli-mailcow-f2b-feed
Open

Add Guezli/mailcow-f2b-feed parser + scenario#1807
Guezli wants to merge 1 commit into
crowdsecurity:masterfrom
Guezli:add-Guezli-mailcow-f2b-feed

Conversation

@Guezli
Copy link
Copy Markdown
Contributor

@Guezli Guezli commented May 26, 2026

Description

Adds a parser + scenario pair that propagates Mailcow's internal F2B bans
(from the netfilter-mailcow container) into the local Crowdsec LAPI, so the
host-side nftables-bouncer sees and acts on bans that Crowdsec wouldn't catch
on its own (SOGo webmail UI, rspamd admin UI, Mailcow-specific dovecot/postfix
patterns).

Two artefacts in one PR:

  • parsers/s01-parse/Guezli/mailcow-f2b-bans.yaml — parses both auto-bans
    (Banning <IP>/<N> for <M> minutes) and manual perm-bans
    (Added host/network <IP> to denylist) from the netfilter-mailcow stdout.
  • scenarios/Guezli/mailcow-f2b-feed.yaml — trigger-style scenario that turns
    each parsed ban into a Crowdsec LAPI decision.

Acquisition: netfilter-mailcow docker container with labels.type: mailcow-f2b
(snippet in the rendered .md).

Checklist

  • Parser YAML with pattern_syntax + grok extraction (source_ip, ban_duration_min, evt.StrTime)
  • Scenario YAML with required labels (classification, spoofable, confidence, behavior, label, service, remediation)
  • Hub-rendered .md documentation for both parser and scenario, including acquisition example
  • hubtest under .tests/mailcow-f2b-feed/ passing locally (cscli hubtest run mailcow-f2b-feed --clean -> all tests passed)
  • hublint check clean (0 warnings, 0 errors)
  • Test fixture uses RFC 5737 IPs (198.51.100.0/24, 203.0.113.0/24)

AI assistance

  • AI was used to generate any/all content of this PR

Claude Code was used to port the parser + scenario from my personal repo
(https://github.com/Guezli/crowdsec-mailcow-f2b-feed) into Hub format, add the
timestamp extraction needed for hubtest forensic mode, generate the hubtest
assertions, and structure the documentation. The detection logic and
Mailcow-internal-F2B mapping are my own work; I can explain every part of the
contribution.

Propagates Mailcow's internal F2B bans (from the netfilter-mailcow
container) into the local Crowdsec LAPI so the host-side nftables-bouncer
acts on SOGo/rspamd/admin-UI bans that Crowdsec wouldn't catch on its own.

Two artefacts in one PR:

- parsers/s01-parse/Guezli/mailcow-f2b-bans.yaml
  Parses both "Banning <IP>/<N> for <M> minutes" (auto-ban) and
  "Added host/network <IP> to denylist" (manual F2B_BLACKLIST entry)
  log lines, extracting source_ip plus ban_duration_min and the
  ISO-8601 timestamp as evt.StrTime.

- scenarios/Guezli/mailcow-f2b-feed.yaml
  Trigger-style scenario keyed off log_type=mailcow_f2b_ban produced
  by the parser, blackhole 1h to dedupe ban-renew lines.

Acquisition is the netfilter-mailcow docker container with
labels.type=mailcow-f2b; see the rendered .md files for snippets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant