检查本机python
[root@vanegoo ~]# python -V
Python 3.9.9
下载 fail2ban
[root@vanegoo ~]# git clone https://github.com/fail2ban/fail2ban.git
安装
[root@vanegoo ~]# cd fail2ban
[root@vanegoo fail2ban]# python setup.py install
配置systemctl service
[root@vanegoo fail2ban]# cp build/fail2ban.service /lib/systemd/system/fail2ban.service
# 增加一行
[root@vanegoo fail2ban]# vim /lib/systemd/system/fail2ban.service
Environment="PYTHONPATH=/usr/local/lib/python3.9/site-packages"
配置规则
[root@vanegoo fail2ban]# cd /etc/fail2ban/
[root@vanegoo fail2ban]# cp jail.conf jail.local
[root@vanegoo fail2ban]# vim jail.local
启动fail2ban
[root@vanegoo ~]# systemctl enable --now fail2ban
评论区