CrowdSec can block abusive IP addresses across a whole estate within seconds, and the same speed means one bad scenario, a missing allowlist or a leaked bouncer key can lock out customers or your own operations team. This guide explains how the CrowdSec Security Engine fits together, how decisions flow from log detection to remediation, what the engine shares with the CrowdSec Central API, and how to deploy it so legitimate users are not blocked. It is written for Linux and web operations teams running CrowdSec in front of SSH, web servers, reverse proxies and firewalls. For the wider network control picture, see the Network Security Guide.
This is an independent guide from NHI Mgmt Group, based on CrowdSec's public documentation as of November 2026. It is not sponsored or reviewed by CrowdSec. Product features change, so confirm settings against CrowdSec's current documentation.
Key takeaways
- Detection and blocking are separate jobs. The Log Processor detects behaviour and writes decisions to the Local API; remediation components (bouncers) read those decisions and enforce them at the firewall, web server or proxy.
- Allowlist before you enforce. Centralised Local API allowlists stop alerts, decisions and blocklist entries for trusted IPs and ranges, so add office egress, monitoring probes, load balancers and partner ranges first.
- Know what leaves the host. Shared signals carry the scenario name, hash and version, a timestamp, your machine ID and the offending IP; context sharing and manual decisions are separate console options you control.
- Treat bouncer API keys as machine credentials. Each key is shown once at creation, sits in a configuration file and grants read access to every decision, so give each bouncer its own key and protect the file.
- Roll out in simulation first. Simulation mode and short ban durations let you measure false positives before decisions reach production traffic.
How CrowdSec works
CrowdSec is an open source security engine (MIT licence for the engine, and detection rules on the CrowdSec Hub are also published under MIT). It reads logs or HTTP requests, matches them against behaviour-based scenarios, and turns a match into a decision such as a ban on an IP. The decision is stored by the Local API and enforced by whichever remediation components you install. Optionally, the engine shares signals with the Central API and receives a community blocklist in return.
| Component | What it does | Where it runs | Security note |
|---|---|---|---|
| Log Processor (agent) | Reads log sources, parses events, runs scenarios, raises alerts | Each host or log collector | Authenticates to the Local API as a machine (credentials in /etc/crowdsec/local_api_credentials.yaml) or by client certificate |
| AppSec | Log Processor feature that inspects HTTP requests forwarded by compatible web servers | Alongside the Log Processor | Inline on the request path: test rules before enforcing |
| Scenarios, parsers, collections | Detection content: parsers normalise logs, scenarios describe behaviour (for example SSH brute force), collections bundle both | Installed from the Hub with cscli | Custom or modified ("tainted") scenarios are shared upstream by default unless you disable it |
| Local API (LAPI) | Stores alerts and decisions, applies profiles, serves decisions to bouncers, talks to the Central API | One central instance or one per host | Default listen_uri in the shipped config is 127.0.0.1:8080; expose it beyond localhost only with TLS |
| Profiles | Rules that decide whether an alert becomes a decision, a notification or just a log entry | /etc/crowdsec/profiles.yaml | Shipped default: ban, scope IP or range, duration 4h |
| Remediation components (bouncers) | Enforce decisions: firewall (iptables, nftables), web server, reverse proxy, CDN | Wherever traffic is controlled | Authenticate with an API key or client certificate |
| Central API (CAPI) | Receives shared signals and distributes blocklists | CrowdSec service | Outbound connection configured under online_client |
| Console | Web interface for alerts, engines, blocklists and allowlists across an organisation | app.crowdsec.net | Enrolment changes what is shared; review console options after enrolling |
| cscli | Command line administration of hub content, decisions, bouncers, machines and allowlists | LAPI host and agents | Restrict to administrators: it can create keys and delete decisions |
Agents, scenarios and the local API
An alert is the output of a scenario: a bucket of events from one source that overflowed a threshold. The Local API passes each alert through profiles in order of definition. The shipped profiles file has two entries, default_ip_remediation and default_range_remediation, each issuing a ban for 4h and then stopping with on_success: break. A commented duration_expr example lengthens bans for repeat offenders based on how many decisions an IP already has.
- Local overrides: put custom profiles in
profiles.yaml.local. It is read beforeprofiles.yamland the two are not merged, so end your local profiles withon_success: breakwhere you intend them to be final. - Distributed setups: several Log Processors can report to one Local API. Each agent is a machine identity; register and review them (
cscli machines list) and remove decommissioned hosts. - Certificate authentication: the Local API can accept client certificates instead of passwords and keys. Configure
cert_file,key_fileandca_cert_pathunderapi.server.tls, restrict which certificate OUs are accepted withagents_allowed_ouandbouncers_allowed_ou, and addcrl_pathfor revocation. CrowdSec also checks OCSP and auto-creates new clients namedCN@IP, which suits auto-scaling fleets. - Notifications: profiles can send alerts to Slack, Splunk, HTTP or email plugins. Route bans on critical services to the on-call channel so a mistaken block is noticed quickly.
Bouncers and remediation
Remediation components only enforce what the Local API tells them. Choose the enforcement point by what you need to protect and how much context you want at the point of blocking.
| Enforcement point | Strength | Trade-off | Good fit |
|---|---|---|---|
| Host firewall (iptables or nftables sets) | Drops traffic before any service sees it; protects every port | Blunt: a blocked shared IP loses all access, including to status pages | SSH and non-HTTP services, single servers |
| Web server or reverse proxy | Can apply ban or challenge per request and show a block page | Only covers HTTP traffic through that proxy | Public websites and APIs where some users share IPs |
| Edge firewall, CDN or WAF integration | Stops traffic upstream and protects origin capacity | Depends on the provider's list size and update interval | Large estates with central egress and ingress |
Components work in one of two modes. In live mode the component asks the Local API on each check; in stream mode it downloads all current decisions into a local cache and polls for changes. The firewall bouncer, for example, polls every update_frequency: 10s in its shipped configuration, uses deny_action: DROP, and inserts its rule into the INPUT chain by default. Containers published through Docker often bypass INPUT, which is why the configuration offers DOCKER-USER and FORWARD chains: check which chain your traffic actually traverses before assuming you are protected.
Community blocklist and data sharing
Participation in the Central API is what gives CrowdSec its collaborative reputation data, and it is also the point where data leaves your environment. Review it with your privacy lead before enrolling production hosts.
| Data item | When it is sent | How you control it |
|---|---|---|
| Signal meta-data: scenario name, hash and version, decision timestamp, machine ID, offending IP with geolocation where available | When the engine raises an alert from a shared scenario | Remove or leave unconfigured the online_client section to run without the Central API |
| List of enabled scenarios | At login to the Central API | Determines which community blocklist entries you receive |
| Alerts from custom and tainted scenarios | By default (share_custom: true, share_tainted: true) | cscli console disable custom and cscli console disable tainted |
| Manual decisions | Only when the manual console option is on; console enrolment turns it on | Review with cscli console status after enrolling |
| Alert context (selected log fields) | Only when context sharing is enabled (share_context: false in the shipped file) | Keep off unless you have checked which fields, such as URLs or usernames, would be sent |
| Console metrics: names and versions of remediation components and engines | When enrolled | Console enrolment |
- Privacy view: attacker IP addresses can be personal data under GDPR, and so can your own users' addresses if a scenario misfires. Record the sharing in your processing records and keep context sharing off unless it is needed. See the AI and GDPR Guide for the wider lawful-basis discussion.
- Manual decisions: an engineer banning a partner IP by hand should not publish that IP to a shared reputation service. Check the manual option deliberately.
- Availability: the Security Engine and Hub content are open source. CrowdSec also offers Console plans; its documentation describes some features, such as managing allowlists across multiple engines from the Console, as available to premium users. Check the current plan terms before designing around a Console feature.
Avoiding false positives and lockouts
Most CrowdSec incidents are self-inflicted: a monitoring probe, NAT gateway or office VPN trips a scenario and gets banned. Build trust lists before turning on enforcement.
| Mechanism | Where it acts | Use it for |
|---|---|---|
Centralised LAPI allowlists (cscli allowlists) | Drops local alerts, removes IPs from blocklists before they reach the database, bypasses AppSec and bot detection, blocks cscli decisions on listed IPs unless forced | Trusted IPs and CIDR ranges: office egress, VPN, monitoring, load balancers, partners |
Parser whitelists (parsers/s02-enrich/) | Discards events at parse time, before buckets | Expression rules on log fields, such as a health-check URL or user agent |
Postoverflow whitelists (postoverflows/s01-whitelist/) | Checked after a scenario overflows | Expensive checks such as reverse DNS; the folder does not exist by default and must be created |
| Simulation mode | Alerts are produced but decisions are not enforced | Trialling new scenarios or a new estate |
- Inventory trusted sources: list office and VPN egress, uptime monitors, vulnerability scanners you run, CDN and load balancer ranges, and partner integrations.
- Create the allowlist:
cscli allowlists create corp_trusted -d "office, VPN and monitoring"(the description is mandatory), thencscli allowlists add corp_trusted 203.0.113.0/24. Use-e 7dfor temporary entries, such as a penetration test window, so they expire. - Fix the real source IP: behind a proxy or load balancer, make sure logs record the client address, not the proxy. Otherwise one ban blocks everyone.
- Simulate: enable simulation (globally, or per scenario) for at least a week of normal traffic, then review alerts with
cscli alerts list. - Enforce in rings: start with SSH on non-critical hosts, then web tiers. Keep the default 4h duration until false positive rates are known.
- Prepare rollback: document how to remove a decision (
cscli decisions delete --ip) and how to stop the bouncer service, and make sure out-of-band console access exists for hosts you could lock yourself out of.
Securing the deployment
CrowdSec itself holds machine credentials and makes enforcement decisions, so protect it like other security infrastructure.
- One API key per bouncer: register each component with
cscli bouncers add <name>on the Local API host. The key is printed once and cannot be retrieved later, so put it straight into the component's configuration (the firewall bouncer readsapi_key) or a secrets store. Naming keys per host makes revocation precise. See the API Key Management Guide. - File permissions: restrict bouncer configuration files and
local_api_credentials.yamlto root and the service account. Never commit them to configuration repositories in clear text. - Review and revoke: list registered components with
cscli bouncers listand machines withcscli machines list; delete entries for retired hosts and rotate keys when staff with access leave. - Transport security: when bouncers or agents reach a remote Local API, use TLS and keep
insecure_skip_verify: false. Client certificates with OU restrictions remove the need for pre-shared keys. - Network exposure: keep the Local API on localhost or a management network; firewall it from the internet.
- Updates: keep the engine, hub content (
cscli hub updateand upgrade) and bouncers current, and apply vendor security updates promptly from CrowdSec's own release notes.
Bouncer keys and agent credentials are non-human identities. They should appear in your NHI inventory with an owner and a rotation date. See the Non-Human Identity (NHI) Guide.
Detection, measurement and framework mapping
Feed CrowdSec alerts to your SIEM so analysts can correlate bans with authentication and application logs. Track these measures:
- False positive rate: decisions removed manually or allowlisted afterwards, as a share of all local decisions.
- Time to unblock: from a user report to removal of a wrong decision.
- Coverage: internet-facing services with an active bouncer, from
cscli metricsand your asset list. - Bouncer freshness: components that have not pulled decisions recently, a sign of a broken key or network path.
- Credential hygiene: registered bouncers and machines with no matching live host.
| Framework | Reference | How CrowdSec relates |
|---|---|---|
| MITRE ATT&CK | T1110 Brute Force (T1110.001 Password Guessing, T1110.004 Credential Stuffing), T1595 Active Scanning, T1190 Exploit Public-Facing Application | Behaviours that common scenarios detect and bans interrupt |
| NIST SP 800-53 Rev 5 | SI-4 System Monitoring, SC-7 Boundary Protection, AC-7 Unsuccessful Logon Attempts, IR-4 Incident Handling | Detection, boundary enforcement and automated response |
| NIST CSF 2.0 | DE.CM-01, DE.AE-02, RS.MI-01, PR.IR-01 | Monitoring, analysis, containment and network protection |
| CIS Controls v8.1 | 13.3 Deploy a Network Intrusion Detection Solution; 13.10 Perform Application Layer Filtering | Network monitoring and defence |
| ISO/IEC 27001:2022 Annex A | A.5.7 Threat intelligence, A.8.16 Monitoring activities, A.8.20 Networks security | Shared reputation data, monitoring and network controls |
Common failure patterns
- Banning the proxy: logs record the load balancer address, so the first ban blocks all users.
- Allowlist added after the incident: monitoring or partner IPs are banned during launch week because nobody listed them first.
- Bouncer in the wrong chain: container traffic bypasses the
INPUTchain and the service is unprotected while dashboards show decisions. - Shared or orphaned API keys: one key copied to every server, so a leak exposes the full decision list and revocation breaks the whole estate.
- Unreviewed sharing: manual decisions or alert context are shared after console enrolment without a privacy check.
Practitioner checklist
- Confirm logs record the true client IP behind every proxy and load balancer.
- Create LAPI allowlists for office, VPN, monitoring, scanners and partners before enforcing.
- Run new scenarios and new estates in simulation, then enforce in rings.
- Register one named API key per bouncer and store it in a protected file or secrets store.
- Keep the Local API on localhost or a management network, with TLS for remote clients.
- Review
cscli console statussharing options and record the decision with your privacy lead. - Remove bouncers and machines for retired hosts every quarter.
- Send alerts to the SIEM and measure false positives and time to unblock.
Standards and references
- CrowdSec: Security Engine introduction
- CrowdSec: Central API
- CrowdSec: Remediation Components
- CrowdSec: Centralized AllowLists
- CrowdSec: TLS Authentication
- CrowdSec: Profiles
- CrowdSec: Security Engine source repository
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Network Security Guide · Linux Firewall Guide · Linux Server Hardening Guide · Suricata IDS Guide · API Key Management Guide