CrowdSec Security Engine
CrowdSec behavior detection engine with community-driven IP blocklists.
Overview
CrowdSec is a modern, open-source security engine that detects aggressive behaviors and protects against attacks through collaborative intelligence. Born from the need for a more effective alternative to traditional fail2ban solutions, CrowdSec analyzes log files in real-time using behavioral detection patterns and shares threat intelligence with a global community of users. Unlike signature-based systems, CrowdSec focuses on behavioral analysis to identify malicious activities such as brute force attacks, web scraping, and DDoS attempts.
This Docker stack combines the CrowdSec security engine with a Metabase dashboard to provide comprehensive threat detection and visualization capabilities. CrowdSec processes system logs and applies collections of parsers and scenarios to detect suspicious behaviors, while automatically sharing anonymized attack signatures with the community blocklist. The Metabase dashboard connects to CrowdSec's database to provide rich visualizations of detected threats, attack patterns, and security metrics, making it easier to understand your security posture.
This configuration is ideal for system administrators managing web servers, security engineers implementing defense-in-depth strategies, and organizations wanting to participate in collaborative threat intelligence. The combination of real-time behavioral detection with community-driven IP reputation makes this stack particularly valuable for environments facing automated attacks, while the dashboard component enables data-driven security decisions and compliance reporting.
Key Features
- Real-time behavioral analysis using crowdsecurity/linux and crowdsecurity/nginx collections for comprehensive threat detection
- Community-driven IP blocklist sharing with automatic contribution of anonymized attack signatures to global threat intelligence
- Metabase-powered security dashboard with customizable visualizations of attack patterns, geographic threat distribution, and temporal analysis
- SQLite-based local threat database with persistent storage for historical attack data and pattern analysis
- Multi-scenario detection engine supporting brute force, web scraping, port scanning, and application-layer attack identification
- RESTful API interface for integration with external security tools, SIEM systems, and custom automation workflows
- Bouncer architecture enabling protection deployment across multiple services including firewalls, load balancers, and web servers
- Log file monitoring with read-only access to system logs for non-intrusive security analysis
Common Use Cases
- 1Web server protection against brute force attacks on SSH, HTTP authentication, and application login endpoints
- 2E-commerce platform security monitoring to detect credential stuffing, card testing, and automated fraud attempts
- 3Multi-tenant hosting environment protection with shared threat intelligence across customer deployments
- 4Development team security operations providing visual attack analysis and security metrics for sprint reviews
- 5Compliance reporting for SOC2, PCI-DSS, or ISO27001 requirements using dashboard analytics and historical attack data
- 6Small business security enhancement replacing traditional fail2ban with community intelligence and modern visualization
- 7Homelab and self-hosted service protection with minimal configuration overhead and professional-grade threat detection
Prerequisites
- Docker host with minimum 2GB RAM for Metabase dashboard operation and CrowdSec processing
- Access to system log files in /var/log directory with appropriate read permissions for container mounting
- Available ports 8080 and 3000 for CrowdSec API and Metabase dashboard access respectively
- Basic understanding of log analysis, IP blocking concepts, and security monitoring principles
- Network connectivity to CrowdSec community API for blocklist updates and threat intelligence sharing
- Sufficient disk space for persistent volumes storing threat databases, configuration files, and dashboard metadata
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 crowdsec: 3 image: crowdsecurity/crowdsec:latest4 container_name: crowdsec5 environment: 6 - GID=10007 - COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx8 volumes: 9 - crowdsec_db:/var/lib/crowdsec/data10 - crowdsec_config:/etc/crowdsec11 - /var/log:/var/log:ro12 ports: 13 - "8080:8080"14 restart: unless-stopped15 networks: 16 - crowdsec-network1718 dashboard: 19 image: metabase/metabase:latest20 container_name: crowdsec-dashboard21 environment: 22 - MB_DB_TYPE=sqlite23 volumes: 24 - metabase_data:/metabase-data25 ports: 26 - "3000:3000"27 depends_on: 28 - crowdsec29 networks: 30 - crowdsec-network3132volumes: 33 crowdsec_db: 34 crowdsec_config: 35 metabase_data: 3637networks: 38 crowdsec-network: 39 driver: bridge.env Template
.env
1# CrowdSec2# Add collections as neededUsage Notes
- 1CrowdSec API at http://localhost:8080
- 2Dashboard at http://localhost:3000
- 3Install bouncers on services
- 4Register at app.crowdsec.net
- 5Share blocklists with community
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
crowdsec
crowdsec:
image: crowdsecurity/crowdsec:latest
container_name: crowdsec
environment:
- GID=1000
- COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx
volumes:
- crowdsec_db:/var/lib/crowdsec/data
- crowdsec_config:/etc/crowdsec
- /var/log:/var/log:ro
ports:
- "8080:8080"
restart: unless-stopped
networks:
- crowdsec-network
dashboard
dashboard:
image: metabase/metabase:latest
container_name: crowdsec-dashboard
environment:
- MB_DB_TYPE=sqlite
volumes:
- metabase_data:/metabase-data
ports:
- "3000:3000"
depends_on:
- crowdsec
networks:
- crowdsec-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 crowdsec:5 image: crowdsecurity/crowdsec:latest6 container_name: crowdsec7 environment:8 - GID=10009 - COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx10 volumes:11 - crowdsec_db:/var/lib/crowdsec/data12 - crowdsec_config:/etc/crowdsec13 - /var/log:/var/log:ro14 ports:15 - "8080:8080"16 restart: unless-stopped17 networks:18 - crowdsec-network1920 dashboard:21 image: metabase/metabase:latest22 container_name: crowdsec-dashboard23 environment:24 - MB_DB_TYPE=sqlite25 volumes:26 - metabase_data:/metabase-data27 ports:28 - "3000:3000"29 depends_on:30 - crowdsec31 networks:32 - crowdsec-network3334volumes:35 crowdsec_db:36 crowdsec_config:37 metabase_data:3839networks:40 crowdsec-network:41 driver: bridge42EOF4344# 2. Create the .env file45cat > .env << 'EOF'46# CrowdSec47# Add collections as needed48EOF4950# 3. Start the services51docker compose up -d5253# 4. View logs54docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/crowdsec-security/run | bashTroubleshooting
- CrowdSec container exits with permission errors: Ensure /var/log directory has proper read permissions and GID=1000 matches host user group
- No threats detected despite obvious attacks: Verify log file paths in collections match actual system log locations and formats
- Metabase dashboard shows no data: Check CrowdSec database initialization by examining container logs and ensure services start in correct order
- API connection refused on port 8080: Confirm firewall rules allow traffic and CrowdSec service has fully initialized before bouncer connections
- Community blocklist updates failing: Verify outbound internet connectivity and register at app.crowdsec.net for API authentication
- High memory usage in Metabase container: Increase Docker host memory allocation or configure Metabase JVM heap settings for large datasets
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
crowdseccrowdsec-dashboard
Tags
#crowdsec#security#ids#firewall#threat-detection
Category
Security & NetworkingAd Space
Shortcuts: C CopyF FavoriteD Download