Bookmarks

    Nothing saved yet. Use the bookmark on any article. Bookmarks are kept on this device only: they stay private and work without an account.

    Settings

    Appearance

    Reading mode

    Font size

    Content width

    Line spacing

    Keyboard shortcuts

    /
    Search
    j k
    Next / previous story
    ← →
    Previous / next section (columns)
    b
    Bookmarks
    s
    Settings
    r
    Columns / scroll
    t
    Light / dark

    Saved in this browser only.

    Ping2Prompt
    Subscribe to the Weekly Brief Sign in
    A server rack front showing rows of hot-swap SAS drive bays with green status lights and orange drive indicators.
    Photo by Domaintechnik on Unsplash

    CrowdSec bouncers vs Fail2Ban regex parsing: how each one blocks attackers

    Automated source check

    The problem they solve

    CrowdSec and Fail2Ban both read logs to spot offenders and then act to block them. Fail2Ban scans log files or journals with regular expressions called filter rules. When a source racks up too many matching failures, it runs a configured action, such as updating system firewall rules to reject new connections for a set time.

    CrowdSec analyzes logs and HTTP requests with behavior-based patterns it calls scenarios. It then enforces blocks through optional remediation components, which most people call bouncers.

    If you expose SSH, a web app or a reverse proxy, both tools aim at the same chore: keeping brute-force noise away from those services. The difference is how many moving parts each one uses to get there.

    How CrowdSec does it

    Detection lives in the CrowdSec Log Processor. It analyzes logs from various data sources, plus HTTP requests from compatible web servers. The Appsec feature is part of the Log Processor and filters HTTP requests from those web servers.

    The Local API sits in the middle, between the Log Processors and the components that enforce decisions. It also talks to the Central API, to share alerts and to receive blocklists. Enforcement belongs to the bouncers, which block malicious IPs at a level you choose.

    The documented levels are IpTables, firewalls, web servers and reverse proxies. The CrowdSec Hub carries the full list of bouncers. The docs describe the design as API-centric, with every component talking over an HTTP API.

    That is what makes multi-machine setups practical. You manage it through the CrowdSec Console or the cscli command-line tool. It exposes detailed Prometheus metrics and can analyze live or cold logs for forensics.

    The sources we reviewed do not say what a CrowdSec false positive looks like, or how to tune scenario thresholds, whitelist an address or remove a decision. They also do not confirm whether a Cloudflare bouncer exists, so check the Hub before you plan around one.

    How Fail2Ban does it

    Fail2Ban works from jails. A jail specifies the failregex or filter rules that get matched against log lines. Each match is written to fail2ban.log as a Found line with the jail name and the IP.

    A ban is logged the same way, as a Ban line. An address is banned after maxretry failures within findtime seconds. The stated defaults are maxretry of 5 and findtime of 10 minutes.

    It ships ready to read many standard logs, such as sshd and Apache, and can be pointed at any log file. Actions are configurable, and they can ban things other than a host, such as a user or an e-mail address. With an iptables-based action, you can verify a ban by looking for a chain named after the jail with an f2b- prefix.

    That chain should hold a rule for the banned IP. A false positive here is a legitimate user who tripped the thresholds. According to the project wiki, raising findtime or lowering maxretry makes mistaken bans more likely.

    The wiki offers fail2ban-regex for checking a failregex and fail2ban-client -d for dumping the merged configuration. The page we read does not say whether this tool can share bans between hosts on its own.

    What each one trusts

    CrowdSec spreads its trust across several pieces. Log Processors detect, the Local API sits between them and the enforcing components, and bouncers carry out the block. Because the Local API is the middle piece, it is worth keeping off untrusted networks.

    The docs do not spell out what a compromise of each piece would mean. Sharing is the other trust decision. When you participate, you share the attacks you detect and block.

    In return, the engine downloads a curated community blocklist of validated attackers. The sources do not list which fields leave your network, whether addresses, scenarios or timestamps are included, or how the data is anonymized. They also give no steps for opting out of sharing while keeping the blocklists, so read the full privacy documentation before you enable it.

    Fail2Ban acts on matches from the logs or journals it scans, using its filter rules. That makes your log sources the boundary you have to protect. The wiki we read describes no external service that this tool reports to, and it says nothing about key custody.

    Failure modes and cost

    Fail2Ban detection can fail silently for several reasons. The jail may not be enabled, or the backend, logpath or journalmatch may be wrong. A wrong datepattern, an unescaped percent sign in the config, or a failregex that matches poorly can also break it.

    Log timestamps are converted using the system time zone, so they may look too old to count. A ban can also be logged without blocking anyone. Causes include an action that is not IPv6 capable, an action that fails to run, or a port-based action using the wrong port.

    If sshd listens on 2222 while the jail keeps the default 22, the ban does nothing useful. Repeated already-banned notices in the log are a symptom of this. The fix for the port case is to set port = 2222 in the jail.

    For CrowdSec, the docs call the Security Engine open-source and lightweight. The sources give no CPU, RAM or disk figures for either tool, so you will need to measure on your own hardware. CrowdSec offers more deployment options: a single machine, multiple machines, centralized logs, Kubernetes with a Helm chart, containers, and WAF-only use through AppSec.

    Each of those adds something to run and monitor, and Prometheus metrics help with that. The sources do not document the size, refresh rate or false-positive rate of the community blocklist.

    Which one, for whom

    If you run one box with SSH and a couple of web services, start with the regex-jail tool. It has one config model and one log file to read, and the wiki gives you tools to debug it. Test every jail with the bundled regex checker and check that the firewall chain really exists.

    If you run several machines, or a reverse proxy in front of many services, CrowdSec's split design fits better. You can detect in one place and enforce at the proxy or firewall level through bouncers. If you care about what leaves your network, hold off on enabling sharing until you have read the vendor's data documentation.

    The sources we reviewed do not give an explicit recommendation for either size of setup, so treat this advice as our judgment. Whichever you pick, run a test ban from a spare address before you trust it.

    Sources

    Image: Photo by Domaintechnik on Unsplash


    This story was produced with AI assistance from the sources listed above and fact-checked against them before publication. Read our editorial methodology and the corrections log. Spotted an error? Email [email protected].

    Continue

    Share on Bluesky · Mastodon · Email ·

    Discussion