All of lore.kernel.org
 help / color / mirror / Atom feed
* firewall rules
@ 2003-04-14 14:00 Payal Rathod
  2003-04-14 17:18 ` Michael K
  0 siblings, 1 reply; 4+ messages in thread
From: Payal Rathod @ 2003-04-14 14:00 UTC (permalink / raw)
  To: netfilter

Hi,
I have made a few firewall rules, almost stolen from IP-Masquerading
HOWTO. Can you please check them and tell about any loopholes.
I have a lan of 15 computers and a central linux server. Users can
telnet, ping, http, ssh, pop3, smtp in this linux box if only they
belong to the lan.
Also, users of the lan have internet access to everything except www,
how do I mention it? Only ip 192.168.10.1, 192.168.10.3, 192.168.10.10
have www net access also. Rest no.

So as not to waste bandwidth I have put the rules on my site at
www.geocities.com/rpayal99/firewall-b1.txt Please have a look at them
and suggest changes. For security I have just made a small change to
external IP, but the rest of all the rules are kept as they are.

With warm regards,
-Payal



-- 
"Visit GNU/Linux Success Stories"
www.geocities.com/rpayal99
Guest-Book Section Updated.


^ permalink raw reply	[flat|nested] 4+ messages in thread
* firewall rules
@ 2002-09-11 14:12 Scott van Looy
  2002-09-11 17:36 ` Antony Stone
  0 siblings, 1 reply; 4+ messages in thread
From: Scott van Looy @ 2002-09-11 14:12 UTC (permalink / raw)
  To: netfilter

I'm using ADSL and have 6 IP addresses available - So I've (starting from 
an example firewall I found on the internet) slowly built the IPtables 
stuff up to the following mess :)
I was wondering if any of you expert types could look it over and give me 
pointers as to where I might be able to improve upon the rules, etc.

Also, if I'm using pre and postrouting, do these filters bypass the 
FORWARD chain? If so I'm probably wasting my time with lots of the forward 
rules ;)

It's meant to block any port below 1024 except for exceptions and 
provide 1:1 NAT for my internal network

Here goes!

#Default rules (there's no problem with a default accept on output is 
#there?)

$IPTABLES -F INPUT
$IPTABLES -P INPUT DROP
$IPTABLES -F OUTPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F FORWARD
$IPTABLES -P FORWARD DROP
$IPTABLES -t nat -F

echo "   Assigning IPs"
/sbin/ifconfig ppp0:1 213.152.47.234 netmask 255.255.255.248
/sbin/ifconfig ppp0:2 213.152.47.235 netmask 255.255.255.248
/sbin/ifconfig ppp0:3 213.152.47.236 netmask 255.255.255.248
/sbin/ifconfig ppp0:4 213.152.47.237 netmask 255.255.255.248
/sbin/ifconfig ppp0:5 213.152.47.238 netmask 255.255.255.248

echo "   Setting pre and post routing"
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.2 -o ppp0 -j SNAT \
        --to-source 213.152.47.234
$IPTABLES -t nat -A PREROUTING -i ppp0 -d 213.152.47.234 -j DNAT \ 
        --to-destination 192.168.0.2
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.27 -o ppp0 -j SNAT \
        --to-source 213.152.47.235
$IPTABLES -t nat -A PREROUTING -i ppp0 -d 213.152.47.235 -j DNAT \
        --to-destination 192.168.0.27
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.3 -o ppp0 -j SNAT \
        --to-source 213.152.47.236
$IPTABLES -t nat -A PREROUTING -i ppp0 -d 213.152.47.236 -j DNAT \
        --to-destination 192.168.0.3

#Is setting the forward here setting it to globally forward 
# everything thus making the rest of the forward ruleset pintless?

$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT

#Forward rules for other machines on the internal network
#Open ports > 1023
$IPTABLES -A FORWARD -p tcp --dport ! 0:1023 -j ACCEPT
$IPTABLES -A FORWARD -p udp --destination-port ! 0:1023 -j ACCEPT

#Except certain stuff (Netmeeting/SSH/dns/identd/etc)
$IPTABLES -A FORWARD -p udp --destination-port 111 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 111 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 113 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 522 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 443 -j ACCEPT
$IPTABLES -A FORWARD -p tcp --dport 22 -j ACCEPT
$IPTABLES -A FORWARD -p udp --destination-port 53 -j ACCEPT
$IPTABLES -A FORWARD -p icmp -j ACCEPT

#Input rules for the firewall/server

#Open ports > 1023
$IPTABLES -A INPUT -p tcp --dport ! 0:1023 -j ACCEPT
$IPTABLES -A INPUT -p udp --destination-port ! 0:1023 -j ACCEPT

#Except certain stuff (Netmeeting/SSH/dns/http/etc)
$IPTABLES -A INPUT -i $INTIF -p udp --destination-port 137 -j ACCEPT
$IPTABLES -A INPUT -p udp --destination-port 111 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 111 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 993 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 113 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 389 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 522 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 443 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 25 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 110 -j ACCEPT
$IPTABLES -A INPUT -p udp --destination-port 53 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 143 -j ACCEPT
$IPTABLES -A INPUT -p udp --destination-port 138 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 139 -j ACCEPT
$IPTABLES -A INPUT -p icmp -j ACCEPT

#Stuff to transparent proxy using squid
$IPTABLES -t nat -A PREROUTING -i $INTIF -p tcp --dport 80 -j \
        REDIRECT --to-port 3128

#Stuff to enable Netmeeting/MSN
$IPTABLES -t nat -A PREROUTING -i br0 -p tcp --dport 1863 -j \
        REDIRECT --to-ports 1863
$IPTABLES -t nat -A PREROUTING -i br0 -p tcp --dport 389 -j \
        REDIRECT --to-ports 389
$IPTABLES -t nat -A PREROUTING -i br0 -p tcp --dport 522 -j \
        REDIRECT --to-ports 522

How's that? Is it likely to be reasonably secure?

Regards,
Scott

-- 
Scott van Looy - email:me@ethosuk.org.uk | web:www.ethosuk.org.uk
PGP Fingerprint: 7180 5543 C6C4 747B 7E74  802C 7CF9 E526 44D9 D4A7
      -------------------------------------------
      |/// /// /// /// WIDE LOAD /// /// /// ///|
      -------------------------------------------

A tall, dark stranger will have more fun than you.



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

end of thread, other threads:[~2003-04-14 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-14 14:00 firewall rules Payal Rathod
2003-04-14 17:18 ` Michael K
  -- strict thread matches above, loose matches on Subject: below --
2002-09-11 14:12 Scott van Looy
2002-09-11 17:36 ` 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.