設定 conf
編輯 /etc/fail2ban/jail.local 或是修改 /etc/fail2ban/jail.conf
[DEFAULT]
# Ban hosts for one hour:
ignoreip = 127.0.0.1/8
bantime = 86400
findtime = 600
maxretry = 10
# Override /etc/fail2ban/jail.d/00-firewalld.conf:
# if you use iptables firewall use this one
# banaction = iptables-multiport
# if you use firewalld firewall use this one
banaction = firewallcmd-ipset
action = %(action_mwl)s
[sshd]
enabled = true
filter = sshd
port = 22
action = %(action_mwl)s
logpath = /var/log/secure
以上的設定會在 try 10 次密碼失敗後鎖住一整天 (86400 秒)
鎖定的方式是透過 firewalld,如果你用 iptables 的話就要看一下說明改設定了!~