Skip to contentSkip to conversation

Idea: Check session source and destination

DISCUSSION Mike Andersen 2 participants 2 messages May 23, 2004 netfilter

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Henrik Nordstrom
Quoted 1 line · Mike Andersen

iptables -A FORWARD -m conntrack --ctorigdst <int_ip> -j ACCEPT iptables -A

FORWARD -j DROP

Quoted 4 lines

Works here..

Quoted 1 line

I then look more closely at the state table (/proc/net/ip_conntrack) and

see that there are two sets of source definition, and two sets for the destination:

Quoted 2 lines

One is the ORIGINAL direction, the other the REPLY direction. Each is

matched independently by the "conntrack" match (--ctorigdst vs

Quoted 1 line

--ctreplydst).

Ah, that explains it. Thanks for clearing up that.

Quoted 1 line
Quoted 1 line

Any idea of why the "-m conntrack --ctorigdst <int_ip>" also passes through

traffic where int_ip is the source of the session?

Quoted 2 lines

Does work like intended here and only matches where it is the original

destination. But I am using this for packet filtering, not mirroring. Not that I see any difference.

I reconfigured my test setup and used the FW for filtering instead of mirroring (physical reconfiguration, all software . Then the rules works as intended.

So the problem I'm having here, seems to be related to the mirroring. My gut feeling says that it may be related to the fact that the state table is being built independently of the netfilter rules.

Here is some more data. First the rules used in this test case:

iptables -A FORWARD -m conntrack --ctorigdst 10.10.10.199/32 -j LOG --log-level DEBUG --log-prefix '>ctorigdst> '
iptables -A FORWARD -m conntrack --ctorigdst 10.10.10.199/32 -j ACCEPT iptables -A FORWARD -j LOG --log-level DEBUG --log-prefix '>drop> ' iptables -A FORWARD -j DROP

Then I try to connect _from_ 10.10.10.199, and this is what the log says:

Apr 27 14:22:35 local kernel: >drop> IN=br0 OUT=br0 PHYSIN=eth0

PHYSOUT=eth1 SRC=10.10.10.199 DST=10.10.10.200 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=19660 DF PROTO=TCP SPT=51905 DPT=80 WINDOW=65535 RES=0x00 SYN URGP=0

Apr 27 14:22:35 local kernel: >ctorigdst> IN=br0 OUT=br0 PHYSIN=eth0

PHYSOUT=eth1 SRC=10.10.10.200 DST=10.10.10.199 LEN=60 TOS=0x00 PREC=0x00 TTL=61 ID=0 DF PROTO=TCP SPT=80 DPT=51905 WINDOW=5792 RES=0x00 ACK SYN URGP=0

Apr 27 14:22:35 local kernel: >ctorigdst> IN=br0 OUT=br0 PHYSIN=eth0

PHYSOUT=eth1 SRC=10.10.10.199 DST=10.10.10.200 LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=19661 DF PROTO=TCP SPT=51905 DPT=80 WINDOW=65535 RES=0x00 ACK URGP=0

Apr 27 14:22:35 local kernel: >ctorigdst> IN=br0 OUT=br0 PHYSIN=eth0

PHYSOUT=eth1 SRC=10.10.10.199 DST=10.10.10.200 LEN=536 TOS=0x00 PREC=0x00 TTL=64 ID=19662 DF PROTO=TCP SPT=51905 DPT=80 WINDOW=65535 RES=0x00 ACK PSH URGP=0

Apr 27 14:22:36 local kernel: >ctorigdst> IN=br0 OUT=br0 PHYSIN=eth0

PHYSOUT=eth1 SRC=10.10.10.200 DST=10.10.10.199 LEN=52 TOS=0x00 PREC=0x00 TTL=61 ID=58220 DF PROTO=TCP SPT=80 DPT=51905 WINDOW=6432 RES=0x00 ACK URGP=0

As you see, the first SYN package is dropped, while the rest of the traffic is passed through.

I really want to figure out _why_ this is not working as intended, and are therefore willing to put a lot of hours into testing. But I'm pretty stuck here. Any suggestion and hints about what I should try out next (tools/configurations etc) is very welcome.

mike
--
"It is a lesson which all history teaches wise men, to put trust in
ideas, and not in circumstances." --Ralph Waldo Emerson

#1 lore raw

repeatet postings (was Re: Idea: Check session source and destination)

Apparently either Mike Andersen's MUA or MTA are broken and keep re-transmitting the same mail. Given that every message has a different msgid, I'd suggest it's the MUA.

Anyway, I have now deleted all mail from the mailman and exim spools on both netfilter.org mailservers to ensure no more of thos mails are delivered.

I also unsubscribed [email protected] from netfilter-devel to make sure all his postings will end up in manual moderation until further investigation.

I'm sorry for the amount of mail you received, but there's nothing we can [automatically] do about this, if a individual legitimate subscriber keeps sending in the same message over and over again.

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie