apt update -y
apt install fail2ban -y
apt-get install rsyslog -y
service sshd restart
为啥安装日志模块,因为pve默认是没这玩意儿的,导致auth.log日志文件不存在,间接导致fail2ban启动失败,参考:fail2ban 无法启动 Have not found any log file for sshd jail-XQLEE'Blog
service fail2ban restart
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
编辑内容/etc/fail2ban/jail.local :
vi /etc/fail2ban/jail.local
[proxmox]
enabled = true
port = https,http,8006
filter = proxmox
backend = systemd
maxretry = 3
findtime = 2d
bantime = 1h
配置文件路径 /etc/fail2ban/filter.d/proxmox.conf
vi /etc/fail2ban/filter.d/proxmox.conf
[Definition]
failregex = pvedaemon\[.*authentication failure; rhost=<HOST> user=.* msg=.*
ignoreregex =
journalmatch = _SYSTEMD_UNIT=pvedaemon.service
systemctl restart fail2ban
https://blog.xqlee.com/article/2505260936208196.html