Skip to contentSkip to conversation

Drop firstly? Drop at the end of the Script? Or it doesn't matter?

DISCUSSION giannhsp 3 participants 3 messages Mar 21, 2003 – Mar 24, 2003

lore
Share & tools
lore

giannhsp

author
#0 lore raw

Is it better to put the command tha sets the default policy (DROP in my case) to the beginning of the script and then writing the ACCEPT section or the opposite?

#1 lore raw
Quoted 1 line

hi,

Quoted 1 line

Is it better to put the command tha sets the default policy (DROP in my case) to the beginning of the script and then writing the ACCEPT section or the opposite?

IMO is better to set DROP as default policy and allow only the traffic you *really* need. I use DROP for INPUT and FORWARD. I have ACCEPT for OUTPUT on my home box. This approach will fit nearly all easy installations.

What do you plan to deploy on "netfiltered" machine?

regards,
Astib();

Signature · 2 lines
A l e s  S t i b a l, Wintel free, powered by AthlonXP and Gentoo Linux.
<[email protected]> Giganet.cz community network, Litomerice, Czech Republic
#2 lore raw
Quoted 4 lines · Ales Stibal

IMO is better to set DROP as default policy and allow only the traffic you *really* need.
I use DROP for INPUT and FORWARD. I have ACCEPT for OUTPUT on my home box. This approach will fit nearly all easy installations.

I can almost guarantee that if you set the default policies to DROP you will lock yourself out of the machine sometime :)
I usually add a -j DROP rule at the end instead so that if I get the not so bright idea to flush the INPUT chain I won't be locked out.

The downside is that you can't just append rules with -A since the -j DROP rule will drop the packets before the newly appended rules are checked. IIRC someone sent a patch quite some time ago that made it possible to write something like this to add a rule second last in the chain:

iptables -I INPUT -2 -s x.x.x.x -j ACCEPT

I can find that quite usefull so I'll see if I can find that patch and convince Harald into accepting it :)

Signature · 1 line
/Martin