All of lore.kernel.org
 help / color / mirror / Atom feed
* Best Practices for iptables
@ 2003-12-05 14:01 Gabby James
  2003-12-05 14:11 ` Ray Leach
  0 siblings, 1 reply; 12+ messages in thread
From: Gabby James @ 2003-12-05 14:01 UTC (permalink / raw)
  To: netfilter

Hi,

I want to allow everything on eth1 and be selective on eth0.  What is the 
best way of handling unwanted packets?

A) Change the policy of the chain to DROP then allow what I want.  Example:
iptables -P INPUT DROP
iptables -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT


B) or leave the policy of the INPUT chain to ACCEPT but put REJECT rules at 
the end. Example:
iptables -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
iptables -A INPUT -p tcp -m tcp -j REJECT
iptables -A INPUT -p udp -m udp -j REJECT
iptables -A INPUT -p icmp -j DROP

This will give me the same outcome won't it?

Thanks in advance!

_________________________________________________________________
Winterize your home with tips from MSN House & Home. 
http://special.msn.com/home/warmhome.armx



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Best Practices for iptables
@ 2003-12-05 14:28 Gabby James
  0 siblings, 0 replies; 12+ messages in thread
From: Gabby James @ 2003-12-05 14:28 UTC (permalink / raw)
  To: netfilter

Yep, I did forget to designate my interface.  So, assuming I do that, which 
is the best way of forming rules - example A or B?


>From: Ray Leach <raymondl@knowledgefactory.co.za>
>To: Netfilter Mailing List <netfilter@lists.netfilter.org>
>Subject: Re: Best Practices for iptables
>Date: Fri, 05 Dec 2003 16:11:42 +0200
>
>On Fri, 2003-12-05 at 16:01, Gabby James wrote:
> > Hi,
> >
> > I want to allow everything on eth1 and be selective on eth0.  What is 
>the
> > best way of handling unwanted packets?
> >
> > A) Change the policy of the chain to DROP then allow what I want.  
>Example:
> > iptables -P INPUT DROP
> > iptables -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
> >
> >
> > B) or leave the policy of the INPUT chain to ACCEPT but put REJECT rules 
>at
> > the end. Example:
> > iptables -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
> > iptables -A INPUT -p tcp -m tcp -j REJECT
> > iptables -A INPUT -p udp -m udp -j REJECT
> > iptables -A INPUT -p icmp -j DROP
> >
> > This will give me the same outcome won't it?
>No, none of your rules reference the interface, e.g -i eth0
>So your rules allow/reject on all interfaces.
>
> >
> > Thanks in advance!
> >
> > _________________________________________________________________
> > Winterize your home with tips from MSN House & Home.
> > http://special.msn.com/home/warmhome.armx
>--
>--
>Raymond Leach <raymondl@knowledgefactory.co.za>
>Network Support Specialist
>http://www.knowledgefactory.co.za
>"lynx -source http://www.rchq.co.za/raymondl.asc | gpg --import"
>Key fingerprint = 7209 A695 9EE0 E971 A9AD  00EE 8757 EE47 F06F FB28
>--
><< signature.asc >>

_________________________________________________________________
Our best dial-up offer is back.  Get MSN Dial-up Internet Service for 6 
months @ $9.95/month now! http://join.msn.com/?page=dept/dialup



^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: Best Practices for iptables
@ 2003-12-05 17:40 Daniel Chemko
  2003-12-05 18:09 ` Antony Stone
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Chemko @ 2003-12-05 17:40 UTC (permalink / raw)
  To: Gabby James, netfilter

Best practices:

WE ARE ALL HUMAN (I hope)

If you are looking for the best case, you'd want to cover your own
incompetence. Honestly, I work from this rule.
I policy block everything that I haven't allowed explicitly, simply
becausd if you try to build it in reverse, you're almost guaranteed to
miss a lot of important blocks / etc..



^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Best Practices for iptables
@ 2003-12-05 20:52 Gabby James
  0 siblings, 0 replies; 12+ messages in thread
From: Gabby James @ 2003-12-05 20:52 UTC (permalink / raw)
  To: netfilter

Thanks for all the replies.  I will set my chain policies to DROP then only 
accept what I want.

_________________________________________________________________
Wonder if the latest virus has gotten to your computer? Find out. Run the 
FREE McAfee online computer scan! 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



^ permalink raw reply	[flat|nested] 12+ messages in thread
* RE: Best Practices for iptables
@ 2003-12-05 20:54 Daniel Chemko
  2003-12-05 21:33 ` Antony Stone
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Chemko @ 2003-12-05 20:54 UTC (permalink / raw)
  To: Ramin Dousti, Michael Gale; +Cc: netfilter

I don't know what either you or the parent are talking about.

The OUTPUT chain is ONLY useful for filtering when:

1. The machine runs services as an account other than root; in which
case, default-accept is still ok in my book, just filter the uid of the
service.
2. You don't know how to work with inbound packets
3. The machine is a multi-user access server
4. The machine is a workstation

INPUT and FORWARD should be you're gatekeepers. I would shy away from
filtering in PREROUTING as it gets messy to track before DNAT /
REDIRECTing.

My corp. firewalls: INPUT: 10-20 rules, FORWARD: 75-200, OUTPUT: 0
My Home firewall: INPUT: 7 rules, FORWARD, 8 rules, OUTPUT: 0

In conclusion, it is all up and fine to use OUTPUT filtering if you
really really want to, but I fail to see how enforcing OUTPUT filtering
helps to secure a network as long as the Linux firewall is stand-alone.

For a userspace tool like ZoneAlarm, and Norton Internet Security, there
is currently no mechanism to trap/query users based on outgoing packets.
When that technology is developed for Linux, you'll really see the
benefits of OUTPUT filtering.


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

end of thread, other threads:[~2003-12-05 21:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-05 14:01 Best Practices for iptables Gabby James
2003-12-05 14:11 ` Ray Leach
2003-12-05 15:40   ` Michael H. Warfield
  -- strict thread matches above, loose matches on Subject: below --
2003-12-05 14:28 Gabby James
2003-12-05 17:40 Daniel Chemko
2003-12-05 18:09 ` Antony Stone
2003-12-05 19:29   ` Ted Kaczmarek
2003-12-05 19:43     ` Michael Gale
2003-12-05 21:16       ` Ramin Dousti
2003-12-05 20:52 Gabby James
2003-12-05 20:54 Daniel Chemko
2003-12-05 21:33 ` Antony Stone

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.