zixiba

zixiba

1panel設置Fail2ban

1 安裝#

Ubuntu / Debian

1、安裝 Fail2ban
sudo apt-get install fail2ban

2、Debian 12 及以上的版本需要手動安裝 rsyslog
sudo apt-get install rsyslog

3、啟動 Fail2ban 服務

sudo systemctl start fail2ban

4、開機自啟動
sudo systemctl enable fail2ban

5、查看 Fail2ban 服務狀態。
sudo systemctl status fail2ban

2 默認配置#

1Panel 默認使用以下配置:

#DEFAULT-START
[DEFAULT]
bantime = 600
findtime = 300
maxretry = 5
banaction = ufw
action = %(action_mwl)s
#DEFAULT-END

[sshd]
ignoreip = 127.0.0.1/8
enabled = true
filter = sshd
port = 22
maxretry = 3
findtime = 300
bantime = -1
banaction = ufw
action = %(action_mwl)s
logpath = /var/log/auth.log

3 修改 UFW 配置#

/etc/fail2ban/action.d/ufw.conf

[Definition]
actionstart = 
actionstop = 
actioncheck = 
# 封禁所有端口訪問
actionban = ufw insert 1 deny from <ip> to any
actionunban = ufw delete deny from <ip> to any

[Init]
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。