Secure Hestia Control Panel with Crowdsec

CrowdSec is an open-source, collaborative Intrusion Detection System (IDS) and firewall that protects servers, services, and containers by analyzing log files to detect and block malicious behavior. It uses a community-driven approach, sharing threat intelligence about malicious IP addresses across all users to create a collective, real-time defense against botnets, DDoS, and other cyberattacks.

There is an official Crowdsec Collection for Hestia Control Panel available now. With this can protect the control panel like fail2ban but more efficient. Can take advantage of the community blocklist and can get 3 free blocklist if have free Crowdsec account.

If Crowdsec already installed then follow Step 3 and Step 4.

Installing CrowdSec on Linux (Ubuntu/Debian)

1. Add Repository & Install: Run the following command to automatically add the repo and install the agent:

curl -s https://install.crowdsec.net | sudo sh
sudo apt update
sudo apt install crowdsec

2. Install Firewall Bouncer: To make CrowdSec actually block malicious IPs (not just detect them), install the firewall bouncer:

sudo apt install crowdsec-firewall-bouncer-iptables

3. Install Hestia Control Panel Collection:

Reference: hestiacp Collection by LearningSpot

sudo cscli collections install LearningSpot/hestiacp

Create acquisition file for this in /etc/crowdsec/acquis.d/hestiacp.yaml

---
filenames:
 - /var/log/hestia/auth.log
labels:
  type: hestiacp

Reload Crowdsec:

sudo systemctl reload crowdsec

4. Verify Installation:

Check if Crowdsec is running:

sudo systemctl status crowdsec

Check if Crowdsec Firewall Bouncer is running:

sudo systemctl status crowdsec-firewall-bouncer

Now your protected against BAD IPS and brute force attack on the Control Panel.

@LearningSpot does this work on the current Hestiacp version. I want to set this up but have not much knowledge on Linux.

Yes this still works. But you need to use the terminal.

Thanks @LearningSpot for putting this guide together!

For anyone setting up CrowdSec on HestiaCP (and for @bosunjohnson looking for an easier setup), there are two important HestiaCP-specific caveats to keep in mind when installing CrowdSec manually:

  1. Port 8080 conflict with Apache2: By default, CrowdSec’s Local API (LAPI) binds to 127.0.0.1:8080. On standard HestiaCP Nginx + Apache2 setups, port 8080 is already used by Apache2, so CrowdSec LAPI should be moved to a dedicated loopback port (e.g. 127.0.0.1:8099) in /etc/crowdsec/config.yaml and /etc/crowdsec/local_api_credentials.yaml.
  2. iptables bouncer vs v-update-firewall: If you use crowdsec-firewall-bouncer-iptables, HestiaCP’s native v-update-firewall flushes iptables chains (iptables -F) whenever firewall rules are updated in the panel, which can detach CrowdSec’s jump rule until the bouncer restarts. Using crowdsec-firewall-bouncer-nftables instead keeps CrowdSec bans in an isolated nftables table (table ip crowdsec / table ip6 crowdsec6) that survives HestiaCP firewall reloads.

Automated 1-Command Setup for HestiaCP (v-harden-server --crowdsec)

We maintain an open-source toolkit for HestiaCP (hestiacp-useful-tools) that automates this entire CrowdSec setup in one command (v-harden-server --crowdsec):

  • Automatically configures CrowdSec LAPI on 127.0.0.1:8099 (no Apache 8080 conflict)
  • Installs crowdsec-firewall-bouncer-nftables (immune to v-update-firewall flushes, dual-stack IPv4 + IPv6)
  • Auto-detects your active services from hestia.conf (Nginx, Apache, Exim, Dovecot, SSH, MariaDB, Hestia :8083 /var/log/hestia/auth.log, Roundcube, and WordPress/CMS brute-force protection)
  • Adds an automatic SSH anti-lockout exemption rule so admins don’t accidentally lock themselves out on port 22

Quick install:

git clone https://github.com/webxtekstudio/hestiacp-useful-tools.git /root/hestiacp-useful-tools
cd /root/hestiacp-useful-tools
bash install.sh --crowdsec

You can inspect the status anytime with:

v-harden-server --status

Repository & full documentation: hestiacp-useful-tools/scripts/server-hardening at main · webxtekstudio/hestiacp-useful-tools · GitHub