I'm trying to set up a webserver using an Odroid U3; as OS I have Debian 7.4. The issue came when trying to load the iptables rules with iptables-persistent. I'm using the same file with rules I've been using for some time, but for some reason now it refuses to work (I have another server with Odroid U2 and Debian 7 and it works fine).
iptables-restore gives a failure message on the line with the COMMIT.
I've isolated the problem to the ssh brute force prevention part. When trying to add those rules manually I get "iptables: No chain/target/match by that name." Here are the rules:
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [8:1088]
-A INPUT -i eth0 -p tcp -m multiport --dports 67,80,465 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m multiport --sports 67,80,465 -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -p udp -m udp --sport 53 -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m multiport --sports 22,67,80,465 -m state --state ESTABLISHED -j ACCEPT
-A OUTPUT -o eth0 -p tcp -m multiport --dports 67,80,465 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A OUTPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name SSH --rsource
-A INPUT -p tcp -m tcp --dport 22 -m recent --rcheck --seconds 30 --hitcount 4 --rttl --name SSH --rsource -j REJECT --reject-with tcp-reset
-A INPUT -p tcp -m tcp --dport 22 -m recent --rcheck --seconds 30 --hitcount 3 --rttl --name SSH --rsource -j LOG --log-prefix "SSH brute force "
-A INPUT -p tcp -m tcp --dport 22 -m recent --update --seconds 30 --hitcount 3 --rttl --name SSH --rsource -j REJECT --reject-with tcp-reset
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A OUTPUT -p udp --dport 123 -j ACCEPT
-A INPUT -p udp --sport 123 -j ACCEPT
COMMIT
What am I missing?
Thank you in advance