Linux 防暴力破解 - fail2ban

安装

1
2
sudo yum install fail2ban
sudo apt-get install fail2ban

服务状态

1
2
systemctl status fail2ban
systemctl restart fail2ban

查看敏感日志:

1
sudo tail -f /var/log/fail2ban.log

检查 fail2ban 状态

1
2
fail2ban-client status
fail2ban-client status sshd

解锁 ip

1
sudo fail2ban-client set sshd unbanip 192.168.1.8

问题记录

Failed during configuration: Have not found any log file for sshd jail #3567

From other point of view it is a configuration issue and can be surely simply fixed using:

1
2
- echo -e "[sshd]\nenabled=true" | sudo tee /etc/fail2ban/jail.local
+ echo -e "[sshd]\nbackend=systemd\nenabled=true" | sudo tee /etc/fail2ban/jail.local

With other words:

1
2
3
4
  $ sudo cat /etc/fail2ban/jail.local 
[sshd]
+ backend=systemd
enabled = true

References


Linux 防暴力破解 - fail2ban
https://www.frytea.com/post/20240529221841.html
作者
Tianlun Song
发布于
2024年5月29日
更新于
2024年6月13日
许可协议