Skip to contentSkip to conversation

rules suggestion

DISCUSSION Askar Ali Khan 4 participants 4 messages Jul 22, 2004

lore
Share & tools
lore
#0 lore raw

Hi all

Here are few rules from overs firewall, please let me know is this is the proper way to deal with windowz ports :)

iptables -A INPUT -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A INPUT -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP

Or we are unnecessary repeating it on some chains/tables.

regards
Askar Ali

#1 lore raw
Quoted 9 lines · Askar Ali Khan

Here are few rules from overs firewall, please let me know is this is the proper way to deal with windowz ports :)

iptables -A INPUT -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A INPUT -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP

$ipt -t filter -A OUTPUT -o $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A INPUT -i $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A FORWARD -i $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A FORWARD -o $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

This will do (at least it works on my PC :)

I have 192.168.1.x subnet.

# NETBIOS is my comment (first two lines are taken from my bash's script and lines 3 and 4 are not tested and I've created them by hand a while ago). However I've disabled multicast forwarding on my router/firewall so only first two lines are really needed (on my PC).

However if you like to enable SMB then some more ports will be needed (ie. 32768 or someting like that, and this one port is undocumented)

#3 lore raw
In reply to Askar Ali Khan

Hello,

Quoted 1 line · On Thu, 22 Jul 2004 10:43:07 +0500 Askar Ali Khan <[email protected]> wrote:

Or we are unnecessary repeating it on some chains/tables.

Yes, here:

Quoted 2 lines

iptables -t nat -A PREROUTING -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP

You already have that in your INPUT chain. Always stick to the 'filter' table for filtering.

I also think Windows uses only UDP (quite sure) on ports 137:138 (not sure).

Why don't you go for a default DROP policy with ACCEPT rules?

Kind regards,

Leslie

#2 lore raw
In reply to adderek

This one should also help:

iptables -I FORWARD -p icmp --icmp-type echo-request -m length --length 92:92 -j DROP

Maybe you also want to log some of those icmps

Quoted 38 lines · adderek
Quoted 9 lines · Askar Ali Khan

Here are few rules from overs firewall, please let me know is this is the proper way to deal with windowz ports :)

iptables -A INPUT -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A INPUT -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -A FORWARD -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p TCP -s 0/0 -d 0/0 --dport 135:140 -j DROP iptables -t nat -A PREROUTING -p UDP -s 0/0 -d 0/0 --dport 135:140 -j DROP

$ipt -t filter -A OUTPUT -o $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A INPUT -i $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A FORWARD -i $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

$ipt -t filter -A FORWARD -o $extif_name -p udp -d 192.168.1.255 --dport 137:139 -j DROP #NETBIOS

This will do (at least it works on my PC :)

I have 192.168.1.x subnet.

# NETBIOS is my comment (first two lines are taken from my bash's script and lines 3 and 4 are not tested and I've created them by hand a while ago). However I've disabled multicast forwarding on my router/firewall so only first two lines are really needed (on my PC).

However if you like to enable SMB then some more ports will be needed (ie. 32768 or someting like that, and this one port is undocumented)