Linux Netfilter discussions
 help / color / mirror / Atom feed
* Clear Iptables chains?
@ 2002-07-08 14:43 Denis JULIEN
  2002-07-08 14:46 ` Lukas Ruf
  0 siblings, 1 reply; 8+ messages in thread
From: Denis JULIEN @ 2002-07-08 14:43 UTC (permalink / raw)
  To: netfilter

How can I clear all iptables chains before that my FW script be launched?

thank in advance

Denis



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

* Re: Clear Iptables chains?
  2002-07-08 14:43 Clear Iptables chains? Denis JULIEN
@ 2002-07-08 14:46 ` Lukas Ruf
  2002-07-08 14:56   ` Antony Stone
  0 siblings, 1 reply; 8+ messages in thread
From: Lukas Ruf @ 2002-07-08 14:46 UTC (permalink / raw)
  To: Denis JULIEN; +Cc: netfilter

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -X

but rtfm.

--lpr

On Mon, 08 Jul 2002, Denis JULIEN wrote:

> How can I clear all iptables chains before that my FW script be launched?
> 
> thank in advance
> 
> Denis
> 

-- 
Lukas Ruf      Bellariastr. 11      CH-8002 Zuerich      +41 1 2813545
http://www.lpr.ch                                http://www.maremma.ch    
     http://www.{{topsy,nodeos}.net,{promethos,netbeast}.org}


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

* Re: Clear Iptables chains?
  2002-07-08 14:46 ` Lukas Ruf
@ 2002-07-08 14:56   ` Antony Stone
  2002-07-08 15:22     ` Antony Stone
  0 siblings, 1 reply; 8+ messages in thread
From: Antony Stone @ 2002-07-08 14:56 UTC (permalink / raw)
  To: netfilter

On Monday 08 July 2002 3:46 pm, Lukas Ruf wrote:

> iptables -P INPUT ACCEPT
> iptables -P OUTPUT ACCEPT
> iptables -P FORWARD ACCEPT
> iptables -F
> iptables -X

Don't forget:
iptables -F -t nat
iptables -F -t mangle

Antony.

> but rtfm.

Always good advice :-)

> On Mon, 08 Jul 2002, Denis JULIEN wrote:

> > How can I clear all iptables chains before that my FW script be launched?
> >
> > thank in advance
> >
> > Denis


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

* Re: Clear Iptables chains?
  2002-07-08 14:56   ` Antony Stone
@ 2002-07-08 15:22     ` Antony Stone
  2002-07-08 16:34       ` Jan Humme
  2002-07-08 16:43       ` Ross Vandegrift
  0 siblings, 2 replies; 8+ messages in thread
From: Antony Stone @ 2002-07-08 15:22 UTC (permalink / raw)
  To: netfilter

On Monday 08 July 2002 3:56 pm, Antony Stone wrote:

> On Monday 08 July 2002 3:46 pm, Lukas Ruf wrote:
> > iptables -P INPUT ACCEPT
> > iptables -P OUTPUT ACCEPT
> > iptables -P FORWARD ACCEPT

I'd prefer to see:
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

Then you add in the rules for the stuff your definitely know you want to 
allow.

> > iptables -F
> > iptables -X
>
> Don't forget:
> iptables -F -t nat
> iptables -F -t mangle
>
> Antony.
>
> > but rtfm.
>
> Always good advice :-)
>
> > On Mon, 08 Jul 2002, Denis JULIEN wrote:
> > > How can I clear all iptables chains before that my FW script be
> > > launched?
> > >
> > > thank in advance
> > >
> > > Denis


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

* Re: Clear Iptables chains?
  2002-07-08 15:22     ` Antony Stone
@ 2002-07-08 16:34       ` Jan Humme
  2002-07-08 17:01         ` Antony Stone
  2002-07-08 16:43       ` Ross Vandegrift
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Humme @ 2002-07-08 16:34 UTC (permalink / raw)
  To: Antony Stone, netfilter

On Monday 08 July 2002 17:22, Antony Stone wrote:
> On Monday 08 July 2002 3:56 pm, Antony Stone wrote:
> > On Monday 08 July 2002 3:46 pm, Lukas Ruf wrote:
> > > iptables -P INPUT ACCEPT
> > > iptables -P OUTPUT ACCEPT
> > > iptables -P FORWARD ACCEPT
>
> I'd prefer to see:
> iptables -P INPUT DROP
> iptables -P OUTPUT DROP
> iptables -P FORWARD DROP
>
> Then you add in the rules for the stuff your definitely know you want to
> allow.

Certainly.

What about default policies for the nat and mangle tables?

Or perhaps you find that it doesn't belong here?

Jan Humme.


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

* Re: Clear Iptables chains?
  2002-07-08 15:22     ` Antony Stone
  2002-07-08 16:34       ` Jan Humme
@ 2002-07-08 16:43       ` Ross Vandegrift
  1 sibling, 0 replies; 8+ messages in thread
From: Ross Vandegrift @ 2002-07-08 16:43 UTC (permalink / raw)
  To: Antony Stone; +Cc: netfilter

On Mon, Jul 08, 2002 at 04:22:47PM +0100, Antony Stone wrote:
> On Monday 08 July 2002 3:56 pm, Antony Stone wrote:
> 
> > On Monday 08 July 2002 3:46 pm, Lukas Ruf wrote:
> > > iptables -P INPUT ACCEPT
> > > iptables -P OUTPUT ACCEPT
> > > iptables -P FORWARD ACCEPT
> 
> I'd prefer to see:
> iptables -P INPUT DROP
> iptables -P OUTPUT DROP
> iptables -P FORWARD DROP
> 
> Then you add in the rules for the stuff your definitely know you want to 
> allow.

Be careful with doing this though, if you're managing a remote box.
It's *very* easy to cut yourself off the box when setting policy like
this.

I keep a script around that flushes all rules and sets default policy to
ACCEPT, and then make -P DROP the first three commands in the script to
configure iptables.  This prevents me from neutering my access when I'm
hacking around with the firewall rules.

Ross Vandegrift
ross@willow.seitz.com


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

* Re: Clear Iptables chains?
  2002-07-08 16:34       ` Jan Humme
@ 2002-07-08 17:01         ` Antony Stone
  2002-07-08 17:14           ` Jan Humme
  0 siblings, 1 reply; 8+ messages in thread
From: Antony Stone @ 2002-07-08 17:01 UTC (permalink / raw)
  To: netfilter

On Monday 08 July 2002 5:34 pm, Jan Humme wrote:

> On Monday 08 July 2002 17:22, Antony Stone wrote:

> > I'd prefer to see:
> > iptables -P INPUT DROP
> > iptables -P OUTPUT DROP
> > iptables -P FORWARD DROP
> >
> > Then you add in the rules for the stuff your definitely know you want to
> > allow.
>
> Certainly.
>
> What about default policies for the nat and mangle tables?

Those should be ACCEPT, unless you're being sneaky/clever, and you definitely 
know what you are doing..

The reasons are simple:

1. The choice of whether to block or accept packets should be done in the 
filtering table - that's what it's for.   The nat table is for address 
translation, and the mangle table is for packet mangling.   Don't drop 
packets in the nat table; drop them in the filter table.

2. If you start setting default policies of anything except ACCEPT in the nat 
or mangle tables, it's very easy to stop all traffic through your firewall, 
and spend some time scratching your head trying to figure out why, because 
there are no rules in the filter table causing the behaviour you observe.

 

Antony.


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

* Re: Clear Iptables chains?
  2002-07-08 17:01         ` Antony Stone
@ 2002-07-08 17:14           ` Jan Humme
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Humme @ 2002-07-08 17:14 UTC (permalink / raw)
  To: Antony Stone, netfilter

On Monday 08 July 2002 19:01, Antony Stone wrote:
> On Monday 08 July 2002 5:34 pm, Jan Humme wrote:
> > On Monday 08 July 2002 17:22, Antony Stone wrote:
> > > I'd prefer to see:
> > > iptables -P INPUT DROP
> > > iptables -P OUTPUT DROP
> > > iptables -P FORWARD DROP
> > >
> > > Then you add in the rules for the stuff your definitely know you want
> > > to allow.
> >
> > Certainly.
> >
> > What about default policies for the nat and mangle tables?
>
> Those should be ACCEPT, unless you're being sneaky/clever, and you
> definitely know what you are doing..
>
> The reasons are simple:
>
> 1. The choice of whether to block or accept packets should be done in the
> filtering table - that's what it's for.   The nat table is for address
> translation, and the mangle table is for packet mangling.   Don't drop
> packets in the nat table; drop them in the filter table.

Makes perfect sense.


> 2. If you start setting default policies of anything except ACCEPT in the
> nat or mangle tables, it's very easy to stop all traffic through your
> firewall, and spend some time scratching your head trying to figure out
> why, because there are no rules in the filter table causing the behaviour
> you observe.

..........as I already found out...............(!).

Jan Humme.


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

end of thread, other threads:[~2002-07-08 17:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-08 14:43 Clear Iptables chains? Denis JULIEN
2002-07-08 14:46 ` Lukas Ruf
2002-07-08 14:56   ` Antony Stone
2002-07-08 15:22     ` Antony Stone
2002-07-08 16:34       ` Jan Humme
2002-07-08 17:01         ` Antony Stone
2002-07-08 17:14           ` Jan Humme
2002-07-08 16:43       ` Ross Vandegrift

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