RousselTMLEARNING

Article · CrowdSec: From Discovery to Expertise

CrowdSec: the collaborative firewall

1. What CrowdSec is #

The principle in a few minutes.

The problem #

Expose a server on the Internet: within minutes, bots try SSH passwords, look for a .env file or test a known flaw. These attacks show up in your logs, but nobody reads them continuously.

CrowdSec reads these logs for you, recognizes attack behaviors and has the addresses blocked. Its engine is free software (MIT license), written in Go.

Two strong ideas #

  • Separate detection from blocking. The engine decides; other components, the bouncers, enforce the decision where it is useful: firewall, reverse proxy, CDN or application.
  • Share intelligence. Each installation can report the attacks it faces and receive in return a list of addresses recognized as malicious.

2. The architecture #

The components and their role.

Overview #

CrowdSec architecture: logs go through parsers, scenarios, the Local API, then bouncers enforce

ComponentRole
Security EngineThe crowdsec service: it reads logs and detects attacks.
ParsersTurn a log line into a structured event.
ScenariosRecognize a behavior, such as too many failed logins.
Local API (LAPI)Stores alerts and decisions. It listens on port 8080 by default.
Central API (CAPI)CrowdSec's service: receives signals, returns community reputation.
ProfilesTurn an alert into a decision: 4 h ban by default.
BouncersEnforce decisions. They are also called remediation components.
HubCatalog of ready-to-use collections, parsers and scenarios.
cscliThe command-line tool to manage everything.

The full cycle #

Attack cycle: log line, event, bucket, alert, decision, block

Classic mistake. Installing the crowdsec package blocks nothing: you need at least one bouncer. Without it, decisions have no effect.

3. Collaborative intelligence #

What is shared, and how the list stays reliable.

What is sent #

When a scenario triggers, CrowdSec sends a signal to the CAPI: the attacker's address, the scenario and the timestamp. Your logs do not leave your server. In return, the LAPI downloads a list of addresses, visible with the CAPI origin in decisions.

cscli capi status
cscli decisions list --origin CAPI

Avoiding poisoning #

A participatory list could be polluted by false signals. CrowdSec therefore cross-checks signals from many participants and assesses their reliability before publishing an address. Well-known legitimate addresses, such as large DNS resolvers, are excluded through allow lists, for example the crowdsecurity/whitelist-good-actors collection.

Optional. You can turn this sharing off: DISABLE_ONLINE_API=true in Docker, or with no CAPI credentials. Local detection keeps working, without the community list.

Sources #

📄 CrowdSec: understanding the collaborative firewall →

My progress

  • ⏱ Estimated time : ≈ 3 min

Sign in to track your progress and take notes. Sign in

💬 Ask a question

Recommended Articles

CrowdSec bouncers: principles and firewall bouncer

Understanding CrowdSec bouncers: where to block, live and stream modes, API keys, decisions API, ...

CrowdSec bouncers: Cloudflare, network devices, Kubernetes and custom bouncer

Block at the CDN with Cloudflare Workers, feed pfSense or MikroTik with Blocklist Mirror, protect...

CrowdSec collections, parsers and scenarios

The Hub, collections, the parser pipeline and scenarios: install, understand with cscli explain, ...

CrowdSec in production: best practices

Good habits for running CrowdSec in production: LAPI, keys, false positives, database, upgrades a...

CrowdSec or Fail2ban: what are the differences?

Comparing CrowdSec and Fail2ban: detection, blocking, sharing, performance, multi-server, and how...

Protecting Traefik with CrowdSec: the bouncer plugin

Setting up the CrowdSec bouncer in Traefik: plugin, middleware, stream and live modes, real IP be...

CrowdSec bouncers for Nginx, Apache and HAProxy

Setting up CrowdSec bouncers for Nginx, OpenResty, Apache and HAProxy SPOA: configuration, block ...

Installing and configuring CrowdSec: packages, Docker, acquisition

Install CrowdSec with packages or Docker, understand its files, declare the logs to read, enroll ...

Les plugins Traefik : l'exemple de CrowdSec pour bloquer les attaques

Étendre Traefik avec des plugins (catalogue officiel, interpréteur Yaegi), puis protéger ses appl...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!