Block Malicious IPs With CrowdSec: Install the Bouncer, Allowlist Yourself, Test the Ban

To block malicious IPs on a Linux host with CrowdSec, install the engine and a matching firewall bouncer, allowlist your own address before anything can ban it, then prove enforcement with a manual decision. CrowdSec’s introduction puts enforcement in separate remediation components, called bouncers, so an engine on its own does not complete the job. As of 13 November 2026 the vendor’s getting-started page lists recommended minimums of 1 CPU core, 100 MB of free RAM and 1 GB of free disk space.

Google · Preferred Sources

Don't miss new tech stories on Google

Add Tech Insider once in the Google app and our stories appear in your news suggestions.

Add Now

The engine detects, the bouncer enforces: the parts of a CrowdSec install

In the docs’ words the Security Engine is open source and lightweight. It reads logs and HTTP requests and matches them against scenarios, which are behaviour-based patterns. Blocking happens in the remediation components, which the docs say block malicious IPs at the level you choose: iptables, firewalls, web servers or reverse proxies. The Local API is the go-between: it connects the log processors to the bouncers that enforce decisions, and to the Central API, where alerts are shared and blocklists received.

PartWhat the docs say it does
Security Engine (log processor)Analyses logs and HTTP requests against scenarios
Local APIMiddleman between log processors, remediation components and the Central API
Remediation component (bouncer)Blocks malicious IPs at iptables, firewalls, web servers or reverse proxies
Central APIReceives shared alerts and supplies blocklists
AppSecPart of the log processor; filters HTTP requests from compatible web servers
ConsoleWeb UI for daily operations; cscli does the same from the command line

The getting-started page lists amd64, arm64 and armhf platforms. The vendor’s troubleshooting page adds that the engine itself is light and, in a small to medium setup, should use less than 100 MB of memory. By default the engine binds 6060/tcp (Prometheus metrics) and 8080/tcp (API) to loopback, and both can be changed after installation. The security-engine page lists single-server installs on Linux, Windows, FreeBSD, macOS, Docker, Kubernetes, OPNsense, pfSense and WHM.

Firewall bouncer, proxy bouncer, AppSec or a blocklist URL: where to enforce

Enforcement pointWhat you installChoose it when
Host firewallEngine plus the firewall bouncer for your backend (nftables or iptables package)You want banned IPs dropped by the host itself, as for SSH
Web server or reverse proxyEngine plus a bouncer for that web server or proxyYour exposure is HTTP
AppSecAppSec in the log processor, listening on 127.0.0.1:7422 by defaultYou want HTTP requests filtered, not only IPs banned
Firewall, CDN or WAF subscriptionNothing on the device: it pulls a curated feed by URLYou run network-perimeter equipment and cannot or will not install an agent
Several serversOne central LAPI that aggregates alerts and distributes decisionsOne detection point should protect many hosts

The docs describe the subscription route as “no agent to install, just curated feeds your equipment can pull”, from the documentation home page. With no agent there is no log analysis on your side, so it suits perimeter devices rather than a server whose SSH log you want read. For a single host with SSH exposed, the firewall bouncer is the simplest path and the one the rest of this page follows. If your existing tool, such as Fail2ban, already covers one small host and you do not want shared data, the engine-plus-bouncer pair adds parts you may not need. If you are weighing CrowdSec against a full SIEM or network monitor, our Wazuh, Security Onion and CrowdSec comparison sets them side by side.

Repository, engine and firewall bouncer, with the backend check first

The bouncer ships in nftables and iptables variants, so check which your host uses before installing.

if sudo nft list tables &>/dev/null; then
  echo "nft is available: use the nftables bouncer package"
else
  iptables --version
  echo "no nft: use the iptables bouncer package"
  # if neither tool works, load the nftables kernel module and repeat the check:
  # sudo modprobe nf_tables
fi

The vendor’s Linux installation page recommends the repository script, run as curl -s https://install.crowdsec.net | sudo sh, to add the APT or YUM source. This version downloads the script to a temporary directory, lets you read it with less crowdsec-repo.sh before it runs, and removes the copy on exit; on RHEL-family hosts replace apt-get with yum. The engine’s configuration then lives in /etc/crowdsec/ and its data in /var/lib/crowdsec/data/. Release numbers change, so read the current engine version from the project’s GitHub releases page rather than from a guide.

#!/usr/bin/env bash
set -euo pipefail

workdir="$(mktemp -d)"
trap 'rm -rf "$workdir"' EXIT
cd "$workdir"

curl -s -f -S https://install.crowdsec.net -o crowdsec-repo.sh
less crowdsec-repo.sh        # read it before it runs
sudo sh crowdsec-repo.sh

sudo apt-get update
sudo apt-get install -y crowdsec
sudo cscli version
sudo systemctl status crowdsec --no-pager

Now the bouncer. The firewall bouncer page shows the iptables package installed with apt or yum; the nftables package is the other choice.

set -euo pipefail

sudo apt-get install -y crowdsec-firewall-bouncer-nftables
# iptables hosts: install crowdsec-firewall-bouncer-iptables instead

sudo cscli bouncers list

The files and ports you will touch next:

File or portPurpose
/etc/crowdsec/config.yamlGlobal settings
acquis.yaml and acquis.d/Which logs the engine reads; drop-in files
profiles.yamlWhat decision follows an alert
/etc/crowdsec/notifications/Notification plugin configs
/var/lib/crowdsec/data/Engine data directory
8080Local API, on loopback by default
127.0.0.1:6060/metricsPrometheus metrics
127.0.0.1:7422AppSec, if enabled

Detection needs collections for the services you run. The Hub lists them; check each name there before installing.

CollectionCovers
crowdsecurity/linuxBase OS and syslog
crowdsecurity/sshdBrute force and user enumeration
crowdsecurity/nginxHTTP probing and bad user-agents
crowdsecurity/http-cveKnown CVE exploitation in HTTP logs
crowdsecurity/base-http-scenariosCrawling and scanning
crowdsecurity/wordpresswp-login and XML-RPC abuse

Install the Linux base and sshd collections here; sshd failures are what trigger the ssh-bf scenario. Add the web collections if the host serves HTTP. Logs are read from acquis.yaml and acquis.d/, and the data sources page says “The type label is mandatory, and used by the Security Engine to choose which parser to use”, so the label (syslog, nginx and so on) must match what the collection expects. Validate before reloading.

set -euo pipefail
sudo cscli collections install crowdsecurity/linux crowdsecurity/sshd
sudo crowdsec -t                  # validate the configuration
sudo systemctl reload crowdsec

Allowlist your own address before any ban can fire

The bouncer is live now, so this step comes before the test. The allowlist docs say the feature manages IP-based allowlists at the LAPI level and “affects local decisions, blocklist pulls, and AppSec (WAF) processing”. The docs also say a fresh engine is protected by the community blocklist straight away, so an address on that list that you have not allowlisted is a candidate for enforcement as soon as a bouncer runs.

Add your admin address or VPN exit and any uptime monitors, each as a single address. A broad range exempts every attacker inside it too. The script takes the addresses as arguments and stops on the first error.

#!/usr/bin/env bash
set -euo pipefail
: "${1:?usage: $0 ADDRESS [ADDRESS...]}"

sudo cscli allowlists create admin_and_monitors -d "Admin address and uptime monitors"
for addr in "$@"; do
  sudo cscli allowlists add admin_and_monitors "$addr"
done
sudo cscli allowlists inspect admin_and_monitors

Prove the chain with a documentation-range address, then delete the decision

The decisions guide adds a ban with cscli decisions add -i 192.168.1.1, defaulting to a four-hour ban. Use an address from a documentation range and a short duration instead, so the test never touches a real LAN host. The script removes the decision on exit even if a check fails.

#!/usr/bin/env bash
set -euo pipefail

test_ip=203.0.113.10
trap 'sudo cscli decisions delete -i "$test_ip" || true' EXIT

sudo cscli decisions add -i "$test_ip" -d 5m -t ban
sudo cscli decisions list
sudo nft list ruleset | grep "$test_ip"

If the last line prints the address, the host’s nftables rules now hold the decision. On an iptables host, list your iptables rules and look for the address instead. For real detection, generate failed SSH logins from a throwaway machine, never your admin workstation, and look for an automatic ban from ssh-bf in sudo cscli alerts list.

Enrolling in the Console and sharing signals: what you send, what you get, and how to check the promises

The docs state the exchange plainly: “when you participate, you share the attacks you detect and block.” In return the engine downloads “a curated list of validated attackers (the community blocklist)”. Console enrolment follows the cscli console enroll page: create an account at app.crowdsec.net, copy the enrollment key, run the command, then validate the enrollment in the web app.

sudo cscli console enroll YOUR_ENROLLMENT_KEY
# accept the pending machine in the Console, then:
sudo cscli capi status

If you filter outbound traffic, the network management page says the Central API is reached on port tcp/443 by the Local API, at the FQDN api.crowdsec.net. Allow that connection or the engine cannot pull the community blocklist.

Each promise below is the vendor’s wording, paired with the command that shows what happens on your own host.

Vendor wordingPublished onCheck on your host
Security Engine “Immediately protected with the Community Blocklist”Documentation home pagecscli capi status, then cscli decisions list
Remediation components “block malicious IPs at your chosen level”Introductioncscli bouncers list and the test ban above
Allowlists affect local decisions, blocklist pulls and AppSecAllowlist docscscli allowlists inspect
Agentless feeds for firewall, CDN or WAFDocumentation home pageThe device’s own feed settings; no cscli involved

The allowlist and the test ban come first because a docs statement describes the product, not your traffic: they protect you if a list entry ever covers an address you need, and they show enforcement working before you rely on it. You can run daily operations from the Console or from cscli, so the web dashboard is a convenience rather than a requirement.

Web servers, longer bans and alerts: AppSec, metrics, profiles and notification plugins

If the host serves HTTP, AppSec is part of the log processor and filters requests from compatible web servers; per the AppSec data source page it listens on 127.0.0.1:7422 by default. Prometheus metrics are at 127.0.0.1:6060/metrics. Custom scenarios can be written and shared on the Hub, per the docs home page.

Longer bans and alerts: profiles and notification plugins

The profiles page explains that the default formula counts how many times a value was detected and adds 1, so “the first ban is always 4 hours”. Editing the then part of profiles.yaml lets you ban repeat offenders for longer or send a CAPTCHA for web traffic. Dry-run profile changes with sudo crowdsec -t, then reload.

Notification plugins push alerts to Slack, email, Splunk, Sentinel, a file or an HTTP webhook. Their configs live in /etc/crowdsec/notifications/, and a profile links to a plugin through its notifications key. The Slack plugin page advises testing the configuration before enabling the plugin, so you can see its output. Alert on manual bans and AppSec blocks rather than on routine SSH bans, or the channel fills with noise.

Detected but not blocked, and other failures: symptom, cause, command

SymptomLikely causeCommand or fix
Alerts appear but traffic still connectsNo bouncer installed or runningsudo cscli bouncers list
Address is in the decisions list but not blockedBouncer package does not match the firewall backendRepeat the backend check; confirm the address appears in the firewall rules
No alerts ever fireLogs not acquired, or the type label does not match the collectionRun sudo cscli metrics and check the “lines read” figures; fix acquis.yaml, then validate with sudo crowdsec -t
Engine will not start after an editYAML errorsudo crowdsec -t
A legitimate address gets bannedIt is not on an allowlistAdd it with sudo cscli allowlists add admin_and_monitors ADDRESS, then check with sudo cscli allowlists inspect admin_and_monitors
Community blocklist emptyEngine cannot reach the Central API on tcp/443sudo cscli capi status; check outbound filtering
Nadia Dubois

Nadia Dubois

AI, software and the business of tech

Nadia Dubois covers AI, software and the business of tech for Tech Insider: AI models and the products built on them, developer and productivity software, pricing, and the company decisions and regulation that shape the industry.

View all articles