Skip to content
Log In Sign Up info@muvcloud.com

How CrowdSec Is Built

  • Engine: reads log files and the journal, parses them, and matches the events against scenarios such as "many failed SSH logins from one address". A match creates an alert and a decision, usually a ban for a set time.
  • Remediation components (bouncers): separate programs that ask the engine's local API for decisions and enforce them, for example in nftables or iptables. Without one, CrowdSec detects but blocks nothing.
  • Shared blocklists: by default the engine shares signals about the attacks it detects, and engines that contribute regularly receive a community blocklist of addresses reported by others. What that list contains depends on the plan.

Install the Engine

The project publishes package repositories, and a script that adds the right one for your distribution. Download the script, read it, then run it:

curl -fsSL https://install.crowdsec.net -o crowdsec-repo.sh
less crowdsec-repo.sh
sudo sh crowdsec-repo.sh

Then install the engine. On Ubuntu and Debian:

sudo apt install crowdsec

On AlmaLinux and Rocky Linux:

sudo dnf install crowdsec

During the install it looks for known services and sets up matching log sources and collections. Its local API listens on localhost (port 8080 by default); keep it there and do not open it in the firewall. CrowdSec needs no inbound port at all.

Allowlist Your Own Address First

Before any blocking is switched on, make sure your own address cannot be banned. Find it, then create a parser whitelist file such as /etc/crowdsec/parsers/s02-enrich/01-my-whitelist.yaml:

name: my/whitelist
description: "Own admin addresses"
whitelist:
  reason: "admin address"
  ip:
    - "203.0.113.10"

Parser whitelists are not reloaded on the fly: restart with sudo systemctl restart crowdsec. Recent versions also offer allowlists managed with cscli allowlists, which take effect without a restart. Keep a second way in as well: the server console in your provider's control panel works even if your address is blocked.

Add Collections for SSH and the Web Server

A collection bundles the parsers and scenarios for one service.

sudo cscli collections list
sudo cscli collections install crowdsecurity/nginx
sudo systemctl reload crowdsec

The Linux collection, which covers SSH, is normally installed with the engine. For Apache, install crowdsecurity/apache2. The engine must also be told where the logs are: the log sources are in /etc/crowdsec/acquis.yaml and the acquis.d folder.

Install the Firewall Bouncer

Install the package that matches your firewall: crowdsec-firewall-bouncer-nftables or crowdsec-firewall-bouncer-iptables, with apt or dnf. When the engine runs on the same server, the package normally registers the bouncer with the local API during the install. Check that it is listed:

sudo cscli bouncers list

It adds its own set and rules next to UFW or firewalld; you keep managing your rules as before.

Check What It Sees

CommandShows
cscli metricsLines read and parsed
cscli alerts listWhat was detected
cscli decisions listCurrent bans

Run them with sudo. In the metrics, a log source with read lines but no parsed lines points to a parser that does not match the log format.

Lift a Ban

If you or a customer were banned, remove the decision for the address:

sudo cscli decisions delete --ip 203.0.113.10

Then add the address to the allowlist if it should never be banned again. A manual ban works the other way round: sudo cscli decisions add --ip 203.0.113.10 --duration 4h.

CrowdSec or Fail2ban?

CrowdSecFail2ban
PartsEngine and bouncersOne service
Shared listsYesNo
Rules fromA hubLocal filters
Several serversOne APIEach alone

Fail2ban is simpler and fully local; see how to install Fail2ban. Do not run both on the same logs. Neither replaces the basics: key login, as in disabling SSH password authentication, and a firewall that allows only what is needed, as in what a firewall is.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations