CrowdSec Security Engine
CrowdSec collaborative security with dashboard.
Overview
CrowdSec is a modern, collaborative security engine that functions as both an intrusion detection system (IDS) and intrusion prevention system (IPS). Born from the need to democratize cybersecurity, CrowdSec operates on a community-driven model where threat intelligence is shared across all participants, creating a collective defense network. Unlike traditional security solutions that rely solely on signature-based detection, CrowdSec uses behavioral analysis and machine learning to identify malicious patterns, then shares these discoveries with the entire community in real-time.
This Docker stack combines the core CrowdSec security engine with a Traefik bouncer and Metabase dashboard to create a comprehensive security monitoring and response system. The CrowdSec engine analyzes log files and network traffic to detect threats, while the bouncer component actively blocks malicious IP addresses at the reverse proxy level. The Metabase dashboard provides rich visualization of security events, attack patterns, and community threat intelligence, enabling administrators to understand their security posture at a glance.
This configuration is ideal for organizations running web applications behind Traefik, security-conscious homelab enthusiasts, and development teams who need enterprise-grade security without the complexity of traditional SIEM solutions. The community aspect means smaller organizations benefit from threat intelligence typically available only to large enterprises, while the lightweight architecture makes it suitable for resource-constrained environments.
Key Features
- Real-time behavioral analysis engine that detects attack patterns without relying on static signatures
- Community threat intelligence sharing with automatic IP reputation updates from global CrowdSec network
- Traefik-specific bouncer integration for automatic IP blocking at the reverse proxy layer
- Pre-configured collection parsers for Linux system logs and Nginx access patterns
- Metabase-powered analytics dashboard with pre-built security visualization templates
- CSCLI command-line interface for manual threat management and bouncer key generation
- Automatic scenario detection for common attacks including brute force, DDoS, and web application exploits
- Multi-log source ingestion supporting syslog, application logs, and custom log formats
Common Use Cases
- 1Web application security for e-commerce sites and SaaS platforms running behind Traefik
- 2Homelab security monitoring for self-hosted services and personal cloud infrastructure
- 3Small to medium business perimeter defense without dedicated security operations center
- 4Development environment protection during application testing and staging phases
- 5Multi-tenant hosting providers seeking automated threat response across customer deployments
- 6Educational institutions monitoring student-accessible services and research infrastructure
- 7Remote work VPN exit points requiring behavioral analysis of user access patterns
Prerequisites
- Docker Engine 20.10+ and Docker Compose v2 for advanced networking and volume management features
- Minimum 2GB RAM and 2 CPU cores for Metabase dashboard and CrowdSec analysis engine
- Available ports 8080 (CrowdSec API) and 3000 (dashboard) not conflicting with existing services
- Read access to system log directories (/var/log) for security event analysis
- Basic understanding of reverse proxy concepts and Traefik configuration for bouncer integration
- Network connectivity for CrowdSec community intelligence updates and scenario downloads
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 restart: unless-stopped6 ports: 7 - "${CS_API_PORT:-8080}:8080"8 environment: 9 - COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx10 volumes: 11 - crowdsec_config:/etc/crowdsec12 - crowdsec_data:/var/lib/crowdsec/data13 - /var/log:/var/log:ro1415 bouncer-traefik: 16 image: fbonalair/traefik-crowdsec-bouncer:latest17 container_name: crowdsec-bouncer18 restart: unless-stopped19 environment: 20 - CROWDSEC_BOUNCER_API_KEY=${BOUNCER_KEY}21 - CROWDSEC_AGENT_HOST=crowdsec:808022 depends_on: 23 - crowdsec2425 dashboard: 26 image: crowdsecurity/metabase:latest27 container_name: crowdsec-dashboard28 restart: unless-stopped29 ports: 30 - "${DASHBOARD_PORT:-3000}:3000"31 volumes: 32 - dashboard_data:/metabase-data33 - crowdsec_data:/var/lib/crowdsec/data:ro34 depends_on: 35 - crowdsec3637volumes: 38 crowdsec_config: 39 crowdsec_data: 40 dashboard_data: .env Template
.env
1# CrowdSec2CS_API_PORT=80803BOUNCER_KEY=your_bouncer_api_key4DASHBOARD_PORT=3000Usage Notes
- 1CrowdSec API at http://localhost:8080
- 2Dashboard at http://localhost:3000
- 3Generate bouncer key via cscli
- 4Join CrowdSec community
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
crowdsec
crowdsec:
image: crowdsecurity/crowdsec:latest
container_name: crowdsec
restart: unless-stopped
ports:
- ${CS_API_PORT:-8080}:8080
environment:
- COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx
volumes:
- crowdsec_config:/etc/crowdsec
- crowdsec_data:/var/lib/crowdsec/data
- /var/log:/var/log:ro
bouncer-traefik
bouncer-traefik:
image: fbonalair/traefik-crowdsec-bouncer:latest
container_name: crowdsec-bouncer
restart: unless-stopped
environment:
- CROWDSEC_BOUNCER_API_KEY=${BOUNCER_KEY}
- CROWDSEC_AGENT_HOST=crowdsec:8080
depends_on:
- crowdsec
dashboard
dashboard:
image: crowdsecurity/metabase:latest
container_name: crowdsec-dashboard
restart: unless-stopped
ports:
- ${DASHBOARD_PORT:-3000}:3000
volumes:
- dashboard_data:/metabase-data
- crowdsec_data:/var/lib/crowdsec/data:ro
depends_on:
- crowdsec
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 crowdsec:5 image: crowdsecurity/crowdsec:latest6 container_name: crowdsec7 restart: unless-stopped8 ports:9 - "${CS_API_PORT:-8080}:8080"10 environment:11 - COLLECTIONS=crowdsecurity/linux crowdsecurity/nginx12 volumes:13 - crowdsec_config:/etc/crowdsec14 - crowdsec_data:/var/lib/crowdsec/data15 - /var/log:/var/log:ro1617 bouncer-traefik:18 image: fbonalair/traefik-crowdsec-bouncer:latest19 container_name: crowdsec-bouncer20 restart: unless-stopped21 environment:22 - CROWDSEC_BOUNCER_API_KEY=${BOUNCER_KEY}23 - CROWDSEC_AGENT_HOST=crowdsec:808024 depends_on:25 - crowdsec2627 dashboard:28 image: crowdsecurity/metabase:latest29 container_name: crowdsec-dashboard30 restart: unless-stopped31 ports:32 - "${DASHBOARD_PORT:-3000}:3000"33 volumes:34 - dashboard_data:/metabase-data35 - crowdsec_data:/var/lib/crowdsec/data:ro36 depends_on:37 - crowdsec3839volumes:40 crowdsec_config:41 crowdsec_data:42 dashboard_data:43EOF4445# 2. Create the .env file46cat > .env << 'EOF'47# CrowdSec48CS_API_PORT=808049BOUNCER_KEY=your_bouncer_api_key50DASHBOARD_PORT=300051EOF5253# 3. Start the services54docker compose up -d5556# 4. View logs57docker 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-stack/run | bashTroubleshooting
- Dashboard shows 'No data available': Verify crowdsec_data volume is properly mounted read-only to dashboard container and CrowdSec has processed log events
- Bouncer not blocking IPs: Generate new API key using 'docker exec crowdsec cscli bouncers add traefik-bouncer' and update BOUNCER_KEY environment variable
- CrowdSec failing to parse logs: Check that log file permissions allow container access and verify collection parsers match your log format using 'cscli parsers list'
- High memory usage on dashboard: Increase container memory limits for Metabase or reduce data retention period in CrowdSec configuration
- Community intelligence not updating: Ensure container has internet access and check CrowdSec Central API connectivity with 'cscli capi status'
- Collections not loading: Manually install required collections using 'docker exec crowdsec cscli collections install crowdsecurity/nginx' for missing parsers
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
Ad Space
Shortcuts: C CopyF FavoriteD Download