Skip to contentSkip to conversation

Default policy

DISCUSSION [email protected] 3 participants 3 messages Dec 21, 2002

lore
Share & tools
lore
#0 lore raw

Hi All,

Following is the policy that my firewall generation script gives, but my system hangs when i execute this, I am using ssh to execute this script. I am opening all other required ports. When I comment the last two lines my script works fine.

******Script*******

#Set default policies to DROP

$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

# Rejecting all Packets

#$IPTABLES -A INPUT -s 0/0 -d 0/0 -p udp -j DROP
#$IPTABLES -A INPUT -s 0/0 -d 0/0 -p tcp -j DROP

Can anyone help me.

thanks in advance.

Regards,

#1 lore raw
Quoted 7 lines

Following is the policy that my firewall generation script gives, but my system hangs when i execute this, I am using ssh to execute this script. I am opening all other required ports. When I comment the last two lines my script works fine.

******Script*******

Quoted 9 lines

#Set default policies to DROP

$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

This ok.
This will drop everything you didn't ACCEPT or REJECT or something.

Quoted 4 lines

# Rejecting all Packets

#$IPTABLES -A INPUT -s 0/0 -d 0/0 -p udp -j DROP #$IPTABLES -A INPUT -s 0/0 -d 0/0 -p tcp -j DROP

If you have this in front of the other rules, nothing will reach the other rules and you just killed (not only) your ssh connection. Not even on lo (127.0.0.1).
You already have default policy DROP : just put in the ACCEPT and other rules you need.

Rob

#2 lore raw
In reply to [email protected]
Quoted 9 lines · you

Hi All,

Following is the policy that my firewall generation script gives, but my system hangs when i execute this, I am using ssh to execute this script. I am opening all other required ports. When I comment the last two lines my script works fine.

******Script*******

Quoted 8 lines

#Set default policies to DROP

$IPTABLES -P INPUT DROP

# Rejecting all Packets

#$IPTABLES -A INPUT -s 0/0 -d 0/0 -p udp -j DROP
#$IPTABLES -A INPUT -s 0/0 -d 0/0 -p tcp -j DROP

Ssh hangs because you drop all packets on tcp from and to everywhere.. So, your connection to the server is being cut. But policies like yours make no sens.

Regards

Giorgio Zarrelli