У меня есть файл IP-адресов из черного списка, которые загружаются через fail2ban
в iptables
когда fail2ban
запускается.
Предположим, что исходный список при запуске выглядит так:
Chain fail2ban-ip-blacklist (1 references)
target prot opt source destination
DROP all -- 120.25.68.125 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain fail2ban-wordress (1 references)
target prot opt source destination
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Почему я должен получать уведомление в журналах после запуска, что 120.25.68.125
был забанен, и проверьте статус iptables, чтобы увидеть следующее:
Chain fail2ban-ip-blacklist (1 references)
target prot opt source destination
DROP all -- 120.25.68.125 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Chain fail2ban-wordress (1 references)
target prot opt source destination
REJECT all -- 120.25.68.125 0.0.0.0/0
RETURN all -- 0.0.0.0/0 0.0.0.0/0
Разве IP 120.25.68.125
уже заблокирован и не требует повторного добавления в список запретов? Почему трафик из 120.25.68.125
пропускают обратно?
iptables
выводChain INPUT (policy ACCEPT 1393 packets, 164K bytes)
pkts bytes target prot opt in out source destination
1401 164K fail2ban-wordpress tcp -- * * 0.0.0.0/0 0.0.0.0/0
1410 165K fail2ban-repeatoffender all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1207 packets, 1786K bytes)
pkts bytes target prot opt in out source destination
Chain fail2ban-repeatoffender (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 120.25.68.125 0.0.0.0/0
Chain fail2ban-wordpress (1 references)
pkts bytes target prot opt in out source destination
1401 164K RETURN all -- * * 0.0.0.0/0 0.0.0.0/0
Вам нужно поменять местами порядок fail2ban-wordpress
и fail2ban-repeatoffender
правила в вашем INPUT
цепь.