Skip to contentSkip to conversation

state NEW

DISCUSSION Jochen Vogel 3 participants 3 messages Nov 19, 2004

lore
Share & tools
lore
#0 lore raw

hi,

i have the following forwarding rule

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW,ESTABLISHED,RELATED -j QUEUE
$IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED -j
ACCEPT

if i send an ACK with hping from INT to EXT it reaches the target system

if i do

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW -j ACCEPTLOG $IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED-j ACCEPT

i can see the following

Nov 19 12:05:20 snolin kernel: ACPT IN=eth0 OUT=ppp0 SRC=1.1.1.1 DST=2.2.2.2

LEN=40 TOS=0x00 PREC=0x00 TTL=63 ID=12368 PROTO=TCP SPT=2618 DPT=63 WINDOW=512 RES=0x00 ACK URGP=0

did i have a false understanding from NEW or whats wrong

thx for help
jo

#1 lore raw
Quoted 17 lines · Jochen Vogel

hi,

i have the following forwarding rule

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW,ESTABLISHED,RELATED -j QUEUE
$IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED -j
ACCEPT

if i send an ACK with hping from INT to EXT it reaches the target system

if i do

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW -j ACCEPTLOG $IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED-j ACCEPT

Quoted 7 lines

i can see the following

Nov 19 12:05:20 snolin kernel: ACPT IN=eth0 OUT=ppp0 SRC=1.1.1.1 DST=2.2.2.2

LEN=40 TOS=0x00 PREC=0x00 TTL=63 ID=12368 PROTO=TCP SPT=2618 DPT=63 WINDOW=512 RES=0x00 ACK URGP=0

did i have a false understanding from NEW or whats wrong

you have a false understanding of NEW.

NEW == packet does not match an entry in the conntrack table.

there is a common misconception that "-m state --state NEW" performs some sort of intelligent enforcement on valid flag combinations (i.e only matches TCP SYN packets), which is simply not true.

if you want this type of enforcement, write your rules like:

  iptables -A FORWARD -p tcp --syn -m state --state NEW [ ... ]

which enforces that NEW packets must be SYN packets.

-j

--
"If something is to hard to do, then it's not worth doing."
--The Simpsons

#2 lore raw
In reply to Jochen Vogel
Quoted 6 lines · Jochen Vogel

hi,

i have the following forwarding rule

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW,ESTABLISHED,RELATED -j QUEUE

Here you are sending all this traffic to userspace, I suppose to snort-inline or similar program. You could use stateless rules because you are sending everything...

Quoted 3 lines

$IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED -j
ACCEPT

And this rule does nothing, because all the traffic has been sent to userspace and then accepted or dropped, probably.

Quoted 7 lines

if i send an ACK with hping from INT to EXT it reaches the target system

if i do

$IPT -A FORWARD -i $INT -o $EXT -m state --state NEW -j ACCEPTLOG $IPT -A FORWARD -i $EXT -o $INT -m state --state ESTABLISHED,RELATED-j ACCEPT

Here you are logging and accepting all the new connections and accepting all the related conections.

Quoted 7 lines

i can see the following

Nov 19 12:05:20 snolin kernel: ACPT IN=eth0 OUT=ppp0 SRC=1.1.1.1 DST=2.2.2.2

LEN=40 TOS=0x00 PREC=0x00 TTL=63 ID=12368 PROTO=TCP SPT=2618 DPT=63 WINDOW=512 RES=0x00 ACK URGP=0

So everything it's working as you have configured it.

Quoted 2 lines

did i have a false understanding from NEW or whats wrong

I don't know what you want to do exactly.

Quoted 2 lines

thx for help
jo

Signature · 12 lines
Jose Maria Lopez Hernandez
Director Tecnico de bgSEC
[email protected]
bgSEC Seguridad y Consultoria de Sistemas Informaticos
http://www.bgsec.com
ESPAÑA

The only people for me are the mad ones -- the ones who are mad to live,
mad to talk, mad to be saved, desirous of everything at the same time,
the ones who never yawn or say a commonplace thing, but burn, burn, burn
like fabulous yellow Roman candles.
                -- Jack Kerouac, "On the Road"