Brute-force - saatda minlərlə şifrə cəhdi
Server internetə açılan kimi botnet-lər SSH, FTP, mail port-larını sınamağa başlayır. Fail2Ban log fayllarını izləyir, çox uğursuz cəhd olan IP-ni avtomatik bloklayır.
Quraşdırma
sudo apt install fail2ban -y sudo systemctl enable fail2ban sudo systemctl start fail2ban
Konfiqurasiya
Default fayla toxunma, jail.local yarat:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local sudo nano /etc/fail2ban/jail.local
SSH üçün jail
[sshd] enabled = true port = 22 filter = sshd logpath = /var/log/auth.log maxretry = 5 findtime = 300 bantime = 3600
5 uğursuz cəhd 5 dəqiqə ərzində → 1 saatlıq ban.
Nginx HTTP brute-force
[nginx-http-auth] enabled = true filter = nginx-http-auth port = http,https logpath = /var/log/nginx/error.log maxretry = 5
WordPress login üçün
Custom filter /etc/fail2ban/filter.d/wordpress.conf:
[Definition] failregex = ^.* "POST /wp-login.php ignoreregex =
jail.local-da:
[wordpress] enabled = true filter = wordpress port = http,https logpath = /var/log/nginx/access.log maxretry = 5 bantime = 3600
Status yoxlamaq
sudo fail2ban-client status sudo fail2ban-client status sshd
Bloklananları açmaq
sudo fail2ban-client unban 192.0.2.10