This is a community guide and is not officially supported. If you have any issues, please reach out to the author.
Installation
Crowdsec can be installed using the Pangolin Installer.Configuration
By default, Crowdsec is installed with a basic configuration, which includes the Crowdsec Bouncer Traefik plugin.Choose the right logs
Syslog
For systems utilizing Syslog, the following volumes should be added to thedocker-compose.yml
file:
syslog.yaml
file under /config/crowdsec/acquis.d
with the following content:
Journalctl
To log iptables to journalctl, execute the following command on your host system:docker-compose.yml
file as follows:
journalctl.yaml
file under /config/crowdsec/acquis.d
with the following content:
Securing the Host System (SSH)
By default, only Traefik requests are secured through the Crowdsec bouncer. To extend protection to your host system (e.g., SSH), follow these steps to add a firewall bouncer:- Install the Crowdsec repositories. Refer to the installation documentation:
- Install the firewall bouncer. For Debian/Ubuntu systems using IPTables, refer to the documentation:
- Create an API key for the firewall bouncer to communicate with your CrowdSec Docker container. (“vps-firewall” is a placeholder name for the key):
- Copy the dispalyed API key and insert it into the bouncer’s configuration file:
- Restart the firewall bouncer:
- Update the
docker-compose.yml
file to expose communication port8080
for the CrowdSec container and restart the container:
Docker’s NAT-based port publishing feature automatically exposes all
ports:
defined in the docker-compose
file on all network interfaces. This behavior can bypass your host firewall settings, potentially exposing services that you did not intend to make public.
Please see complete warning about exposing ports.- Verify communication between the firewall bouncer and the CrowdSec container by running:
Custom Ban Page
To display a custom ban page to attackers, follow these steps:- Place a
ban.html
page in the/config/traefik
directory. If you prefer not to create your own, you can download the official example:
- Update the
/config/traefik/dynamic_config.yml
file to include the following:
Custom Captcha Page
To use a custom captcha page, follow these steps:- Place a
captcha.html
page in the/config/traefik
directory. If you don’t want to create your own, you can download the official example:
- Update the
/config/traefik/dynamic_config.yml
file with the following configuration, replacing<SERVICE>
with your captcha provider (MUST BE eitherhcaptcha
,recaptcha
, orturnstile
), and<KEY>
with the appropriate site and secret keys: