CrowdSec – Intelligent Linux Server Protection Against Botnets, Brute-Force Attacks and Internet Scanning

If you run a Linux server with Nginx, SSH, or WordPress, you probably already know Fail2Ban. It is a solid tool, but it works locally — it blocks only the IP addresses that attacked your server.

CrowdSec works in a completely different way. It is a protection system based on shared IP reputation. If thousands of servers worldwide detect a malicious IP address, your server can block it before an attack even happens.

How Does CrowdSec Work?

  • analyzes system logs (nginx, ssh, wordpress)
  • detects suspicious behavior
  • shares attacker IP intelligence with other servers
  • blocks traffic at the firewall level

The result? Most bots and internet scanners never even reach your Nginx server.

Installing CrowdSec on Debian / Ubuntu

CrowdSec installation is very simple and available directly from Debian repositories.

During installation, CrowdSec automatically:

  • creates a local API (LAPI)
  • registers the server in CrowdSec Central API
  • downloads default security scenarios

Installing Firewall Bouncer

CrowdSec detects threats, but it requires an enforcement component — called a bouncer — which blocks traffic at the firewall level.

By default, the bouncer uses nftables and automatically adds blocking rules for malicious IP addresses.

Installing Security Collections

Collections include log parsers and attack detection scenarios.

Reload configuration after installation:

Configuring Nginx Logs

To allow CrowdSec to analyze HTTP traffic, you must specify Nginx log files.

Edit the file:

Add the following configuration:

Then restart the service:

Verifying CrowdSec Operation

Service status:

Active bans list:

Operational metrics:

Final Result

After proper CrowdSec installation:

  • the server automatically blocks known botnets
  • WordPress attacks and SSH brute-force attempts are stopped at the firewall
  • Nginx handles significantly less malicious traffic
  • server CPU and IO usage are noticeably reduced

CrowdSec can be considered an evolution of Fail2Ban — a system that not only reacts locally but also benefits from global threat intelligence.