08.09.2026 · Linux, Network · 1 мин чтения

CrowdSec Antibrute


Debian 13

Проверяем не установлен ли Fail2ban:

systemctl status fail2ban.service

Если есть, то отключаем:

systemctl stop fail2ban && systemctl disable fail2ban

Скачиваем и запускаем скрипт:

apt update && apt install curl -y && curl -s https://install.crowdsec.net | bash

Ставим CrowdSec и вышибалу. Также ставим для Nginx. Удалить если не нужен.

apt install -y crowdsec crowdsec-firewall-bouncer-nftables crowdsec-nginx-bouncer

В файле /etc/crowdsec/notifications/http.yaml производим следующие замены:
Название хоста - Hostname
ID-чата Телеграм
TELEGRAM_API_KEY

nano /etc/crowdsec/notifications/http.yaml

Настроим адреса и сети, не подлежащие блокировке, т.е. белый список:

nano /etc/crowdsec/parsers/s02-enrich/whitelists.yaml

Производим замену в файле /etc/crowdsec/profiles.yaml duration: 2400h
Также раскомментируем строки notification и — http_default для уведомлений в телегу.

nano /etc/crowdsec/profiles.yaml

Далее:

sed -i 's/leakspeed: "10s"/leakspeed: "3600s"/' /etc/crowdsec/scenarios/ssh-bf.yaml && \
sed -i 's/leakspeed: 10s/leakspeed: 3600s/' /etc/crowdsec/scenarios/ssh-bf.yaml && \
sed -i 's/leakspeed: "60s"/leakspeed: "3600s"/' /etc/crowdsec/scenarios/ssh-slow-bf.yaml && \
sed -i 's/leakspeed: 60s/leakspeed: 3600s/' /etc/crowdsec/scenarios/ssh-slow-bf.yaml && \
sed -i 's/online_client/#online_client/' /etc/crowdsec/config.yaml && \
sed -i 's/credentials_path: \/etc\/crowdsec\/online/#credentials_path: \/etc\/crowdsec\/online/' /etc/crowdsec/config.yaml

Перезапускаем службы:

systemctl restart crowdsec crowdsec-firewall-bouncer

Если crowdsec-firewall-bouncer вываливается с ошибой API, то:

cscli bouncers add crowdsec-firewall-bouncer

Копируем полученный API в файл:

nano /etc/crowdsec/bouncers/crowdsec-firewall-bouncer.yaml

Перезапускаем сервис:

systemctl restart crowdsec-firewall-bouncer

Для полного удаления из системы запускаем следующую команду:

apt-get -y autoremove crowdsec crowdsec-firewall-bouncer-nftables && \
apt-get -y purge crowdsec crowdsec-firewall-bouncer-nftables && \
apt-get -y autoremove --purge crowdsec crowdsec-firewall-bouncer-nftables

Источник: IT-Admins

Аватар
Автор

MSN

Оставить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

три + 10 =

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.