Tüm Rehberler

Fail2Ban Kurulumu

Fail2Ban ile brute-force saldırılarına karşı sunucunuzu koruyun.

Orta15 dk

Kurulum Adımları

1. Fail2Ban'ı kurun:

sudo apt install fail2ban -y

2. Yapılandırma dosyasını oluşturun:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local

3. Temel ayarlar:

[DEFAULT]
bantime = 3600
findtime = 600
maxretry = 5

[sshd]
enabled = true
port = ssh
logpath = %(sshd_log)s
maxretry = 3

4. Apache koruması:

[apache-auth]
enabled = true
port = http,https
logpath = %(apache_error_log)s
maxretry = 5

5. Nginx koruması:

[nginx-http-auth]
enabled = true
port = http,https
logpath = /var/log/nginx/error.log

6. Servisi başlatın:

sudo systemctl start fail2ban
sudo systemctl enable fail2ban

7. Durumu kontrol edin:

sudo fail2ban-client status
sudo fail2ban-client status sshd

8. IP yasağını kaldırma:

sudo fail2ban-client set sshd unbanip 192.168.1.100