Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: --policy DROP kills everything?
@ 2005-06-09  3:05 Ginter, Jeff A
  2005-06-09 11:54 ` busby
  2005-06-09 17:59 ` R. DuFresne
  0 siblings, 2 replies; 14+ messages in thread
From: Ginter, Jeff A @ 2005-06-09  3:05 UTC (permalink / raw)
  To: netfilter

I have seen very similar results.

I have my first rule as Established/Related then I allow out 80, 443,
etc. (just a few ports)...and the web and other traffic dies.

When I tcpdump, I notice that for some of this traffic the s-port and
d-port are no longer matching (they are now high ports) and the
established, related rules don't seem to pick this up.

This is in my forwarding chain (there is a private network behind with 1
to 1 nats).

I added a rule that allowed ALL out, since security is not a concern for
that direction for me in this environment, but I shouldn't have had to
do that.

Let me know if you get anywhere with this Dave.  Thanks.

 
 
Jeff Ginter, CISSP
Computer Associates
Mid-Atlantic Consulting Manager
tel:    +1 908 874-9726
cell:   +1 609 577-1494
jeff.ginter@ca.com
 

-----Original Message-----
From: netfilter-bounces@lists.netfilter.org
[mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of David Busby
Sent: Wednesday, June 08, 2005 7:32 PM
To: netfilter@lists.netfilter.org
Subject: Re: --policy DROP kills everything?

Rob Sterenborg wrote:
> 
> Add this on top of the other INPUT rules :
> 
> -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
> 

Ok so I changed the rules to this:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state
RELATED,ESTABLISHED
ACCEPT     all  --  127.0.0.0/8          0.0.0.0/0
ACCEPT     udp  --  192.168.42.1         192.168.42.2        udp spt:53
ACCEPT     tcp  --  0.0.0.0/0            192.168.42.2        tcp dpt:22
ACCEPT     tcp  --  0.0.0.0/0            192.168.42.2        tcp dpt:80
LOG        all  --  0.0.0.0/0            0.0.0.0/0           LOG level
warning

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

But it won't accept new connections on port 80 or 22.  The Established
SSH conection is fine.
I can see new connections to port 80 or 22 in my logs, see:

IN=eth0 OUT= MAC=00:01:03:d2:db:0b:00:11:5b:50:ff:a4:08:00
SRC=192.168.42.34 DST=192.168.42.2 LEN=48 TOS=0x00 PREC=0x00 
TTL=128 ID=18259 DF PROTO=TCP SPT=3704 DPT=80 WINDOW=65535 RES=0x00 SYN
URGP=0

IN=eth0 OUT= MAC=00:01:03:d2:db:0b:00:11:5b:50:ff:a4:08:00
SRC=192.168.42.34 DST=192.168.42.2 LEN=48 TOS=0x00 PREC=0x00 
TTL=128 ID=18526 DF PROTO=TCP SPT=3705 DPT=22 WINDOW=65535 RES=0x00 SYN
URGP=0

Why they don't jump to accept?  They match a rule.

So then I adjusted #1 above to this

ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state
NEW,RELATED,ESTABLISHED

Doesn't that now allow any new connection to any port on any protocol
making my FW worthless?
Then I tried moving the RELATED,ESTABLISHED to the last rule like this:

imperium root # iptables -L INPUT -n
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  127.0.0.0/8          0.0.0.0/0
ACCEPT     udp  --  192.168.42.1         192.168.42.2        udp spt:53
ACCEPT     tcp  --  0.0.0.0/0            192.168.42.2        tcp dpt:22
ACCEPT     tcp  --  0.0.0.0/0            192.168.42.2        tcp dpt:80
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state
RELATED,ESTABLISHED
LOG        all  --  0.0.0.0/0            0.0.0.0/0           LOG flags 0
level 4

But I still cannot get new connections in and my estabilshed SSH is
still OK.

Should I not use policy DROP but add a last rule of DROP?  Which is the
"right" way?
I guess I learned so far that I need to accept new and established.  But
I cannot seem to get the rules to work.
I've been up and down the man page and samples but seem to be missing
one more stupid little thing :(
Please help.

/djb





^ permalink raw reply	[flat|nested] 14+ messages in thread
* --policy DROP kills everything?
@ 2005-06-08 21:11 David Busby
  2005-06-08 22:02 ` Rob Sterenborg
  2005-06-10 14:48 ` Steven M Campbell
  0 siblings, 2 replies; 14+ messages in thread
From: David Busby @ 2005-06-08 21:11 UTC (permalink / raw)
  To: netfilter

I have this these rules on a host, to protect only this host.

# Generated by iptables-save v1.2.11 on Tue Jun  7 23:03:58 2005
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -s 127.0.0.0/255.0.0.0 -i lo -j ACCEPT
-A INPUT -d 192.168.42.2 -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -d 192.168.42.2 -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT
COMMIT
# Completed on Tue Jun  7 23:03:58 2005

These are the loaded modules: iptable_filter, ip_tables

I cannot make an SSH or HTTP connection to the box.
I was under the impression that a policy of DROP will drop the packets if they dont match a rule.
If I switch the policy to ACCEPT then no problem.  If I add a last rule as DROP then it also fails.
If I put a LOG or ULOG before the DROP rule then I can see packes destined for port 80 making it to log, shouldn't 
ACCEPT have passed them through?  What stupid little thing did I miss?

imperium root # iptables --version
iptables v1.2.11
imperium root # uname -a
Linux imperium 2.6.10-gentoo-r6-edoceo #4 Sun May 1 03:48:25 PDT 2005 i686 AMD Athlon(TM) XP 1700+ AuthenticAMD GNU/Linux

/djb


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-06-10 18:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09  3:05 --policy DROP kills everything? Ginter, Jeff A
2005-06-09 11:54 ` busby
2005-06-09  5:04   ` Gary W. Smith
2005-06-09 17:59 ` R. DuFresne
2005-06-09 18:21   ` David Busby
2005-06-09 18:36     ` Damon Gray
     [not found]       ` <42A8909E.1030104@edoceo.com>
     [not found]         ` <Pine.LNX.4.62.0506091515190.14790@dgray-test.acs.internap.com>
2005-06-09 20:59           ` David Busby
2005-06-09 18:52     ` R. DuFresne
  -- strict thread matches above, loose matches on Subject: below --
2005-06-08 21:11 David Busby
2005-06-08 22:02 ` Rob Sterenborg
2005-06-08 23:32   ` David Busby
2005-06-09  6:26     ` Rob Sterenborg
2005-06-10 18:08       ` Jason Opperisano
2005-06-10 14:48 ` Steven M Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox