Brute force attacks

I've been using this to stop Brute force attacks.

iptables -N rate_limit
iptables -A rate_limit -p tcp --dport 22 -m limit --limit 3/min --limit-burst 3 -j DROP
iptables -A rate_limit -p tcp --dport 23 -m limit --limit 3/min --limit-burst 3 -j DROP
iptables -A rate_limit -p tcp --dport 1194 -m limit --limit 3/min --limit-burst 3 -j DROP
iptables -A rate_limit -p udp --dport 1194 -m limit --limit 3/min --limit-burst 3 -j DROP
iptables -A rate_limit -p ICMP --icmp-type echo-request -m limit --limit 3/sec -j ACCEPT
iptables -A rate_limit -p ICMP -j LOG --log-prefix " Connection dropped "
iptables -A rate_limit -p tcp -j REJECT --reject-with tcp-reset
iptables -A rate_limit -p udp -j REJECT --reject-with icmp-port-unreachable
iptables -A rate_limit -j DROP
#
iptables -I input_rule -p ICMP --icmp-type echo-request -j rate_limit
iptables -I input_rule -p tcp --dport 22 -m state --state NEW -j rate_limit
iptables -I input_rule -p tcp --dport 23 -m state --state NEW -j rate_limit
iptables -I input_rule -p tcp --dport 1194 -m state --state NEW -j rate_limit
iptables -I input_rule -p udp --dport 1194 -m state --state NEW -j rate_limit

But with openwrt 18.06.0 I get this error.

 * Running script '/etc/firewall.user'
iptables v1.6.2: Couldn't load match `state':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.6.2: Couldn't load match `state':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.6.2: Couldn't load match `state':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
iptables v1.6.2: Couldn't load match `state':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
   ! Failed with exit code 2

Ideas?

iptables command parameters changed awhile back

  • iptables -I INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j rate_limit

If you're running 17.01.x or 18.06, input_rule no longer exists, as it was changed to INPUT

  • I'd recommend issuing fw3 print to ensure you're utilizing the current chains
1 Like

Thanks @JW0914

Alll chains working now :slight_smile:

Image1

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.