Motsheganong 23, 2026Dikaelo
Jang go Kenya le go Seta Fail2ban mo Linux
Sireletsa VPS go tswa mo di-attack tsa go leka password ka Fail2ban le melao ya SSH le Nginx.

Fail2ban e lebelela di-log mme e thibela IP ka nakwana fa go na le tiro e e belaetsang — jaaka go leka go tsena ka SSH go palelwa gantsi. Ke e nngwe ya didiriswa tsa tshireletso tsa ntlha mo Hiddence VPS e ntšha.
Go kenya Fail2ban
bash
# Ubuntu / Debian
sudo apt update
sudo apt install fail2ban -y
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
# CentOS / RHEL / Alma / Rocky
sudo yum install epel-release -y
sudo yum install fail2ban -y
sudo systemctl enable fail2ban
sudo systemctl start fail2banSireletsa SSH
Tlhama faele ya config ya lefelo (o se ka wa fetola jail.conf ka tlhamalalo — dirisa jail.local):
bash
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 5
bantime = 3600
findtime = 600
sudo systemctl restart fail2banSireletsa Nginx (ka boikgethelo)
Thibela IP tse di dirang 404 kgotsa diphoso tsa go netefatsa go le gontsi:
bash
[nginx-http-auth]
enabled = true
port = http,https
filter = nginx-http-auth
logpath = /var/log/nginx/error.log
maxretry = 5
[nginx-noscript]
enabled = true
port = http,https
filter = nginx-noscript
logpath = /var/log/nginx/access.log
maxretry = 6Netefatsa IP tse di thibetsoeng
bash
sudo fail2ban-client status
sudo fail2ban-client status sshd
# Unban an IP if needed:
sudo fail2ban-client set sshd unbanip 1.2.3.4Ditiro tsa botlhale
- Dirisa di-SSH key mo boemong jwa password
- Fetola SSH port fela mmogo le melao ya firewall
- Oketsa IP ya gago mo ignoreip fa go tlhokega
- Lokela /var/log/fail2ban.log ka nako le nako
- Kopanya Fail2ban le UFW kgotsa Firewalld