Centos 7 Tomcat 使用 Fail2Ban

參考內容是Using Fail2ban with Tomcat

不過內容有些不太一樣,像是log的path,而且好像ban不會成功。

1.在/etc/fail2ban/jail.local增加一個jail 內容

[tomcat]
enabled  = true
port     = 8080,8443
filter   = tomcat
logpath  = /usr/share/tomcat/logs/localhost_access_log.*.txt
maxretry = 3
bantime = 600
action = firewallcmd-ipset[name=TOMCAT_PORT, port=8080, protocol=tcp]
#findtime = 600
# uncomment the next line to use a custom action
#action = echo-to-file

centos 7預設使用的firewall是firewallcmd,而不是iptables

jail.local

Read More