Skip to contentSkip to conversation

bad argument state

DISCUSSION J. Bakshi 2 participants 2 messages Aug 21, 2009

lore
Share & tools
lore

J. Bakshi

author
#0 lore raw

Dear list,

Here is a rule set to prevent distributed ( from different machine) port scan.
But whenevr I insert these rules in my existing iptables rule it reports "bad argument state"

Any clue ?

``````````````````
IFACE=eth0
iptables -A INPUT -p tcp -i $IFACE -m state --state NEW -m recent --set
iptables -A INPUT -p tcp -i $IFACE -m state --state NEW -m recent
--update --seconds 30 --hitcount   10 -j DROP
iptables -A FORWARD -p tcp -i $IFACE -m state --state NEW -m recent --set
iptables -A FORWARD -p tcp -i $IFACE -m state --state NEW -m recent
--update --seconds 30 --hitcoun  10 -j DROP
`````````````````````````````

thanks

#1 lore raw
Quoted 4 lines · On Friday 21 August 2009 03:21:56 J. Bakshi wrote:

But whenevr I insert these rules in my existing iptables rule it reports "bad argument state"

Any clue ?

Looks like shell scripting failure.

root@chestnut:~# iptables -vA INPUT -p tcp -i $IFACE -m state
Bad argument `state'

That's what I get when $IFACE is not set.

Quoted 3 lines

``````````````````
IFACE=eth0
iptables -A INPUT -p tcp -i $IFACE -m state --state NEW -m recent --set

Is this exactly and completely what you tried, to get that result? I bet not.

Quoted 6 lines

iptables -A INPUT -p tcp -i $IFACE -m state --state NEW -m recent
--update --seconds 30 --hitcount 10 -j DROP
iptables -A FORWARD -p tcp -i $IFACE -m state --state NEW -m recent --set iptables -A FORWARD -p tcp -i $IFACE -m state --state NEW -m recent --update --seconds 30 --hitcoun 10 -j DROP `````````````````````````````

"--hitcoun" is definitely wrong too.

I think Jan's "Perfect Ruleset" document might be helpful for you:
http://jengelh.medozas.de/documents/Perfect_Ruleset.pdf

Signature · 2 lines
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header