On Tue, 01 Nov 2005 16:41:13 +0000, William Gill wrote:
> I have a Linux box as my gateway/firewall/router I'll call "www1" for a
> home lan that accesses the internet via pppoe with dynamic ip.
OK
> I run apache (httpd)and sendmail on www1, for local (lan) use only.
OK
> Before I create new iptables rules what, generically should a safe home
> network firewall allow and deny? For example, I know I will have to
> allow all lan machines to originate http, smtp , and dns, but should
> that be done by port, originating ip, or interface? Once i have this
> figured out in english, I'm sure I'll be back to have someone look at my
> actual rules.
OK, while the advice you were receiving is good you don't really need the
OUTPUT rules unless you are going to be doing things from the firewall
it's self. You will however require one OUTPUT rule for MASQUERADE.
Not sure about your firewall setup in regards to how you access it. If
you have a keyboard and monitor hooked up then the following rule set will
work. It you have to telnet to it then I would suggest that you add a
rule to allow ssh into your firewall from the LAN side only.
Here is what I configured for you. I like to break things down into
interfaces as it makes keeping things in order a lot easier. Any traffic
you want to pass from the LAN side you will have to edit these rules and
add them to the LAN setup.
You will notice that I only have 2 OUTPUT rule listed. This is because I
don't know what you will need to do from the firewall box itself.
Some would say I really don't need the DROP rules in each chain, but I
feel safer this way. Keeps everything locked down. Better safe then
sorry.
Should you have any questions feel free to ask.
-----cut here-----
#!/bin/sh
# Clear all Firewall Policies
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
# Zero all Firewall Policies
iptables -Z INPUT
iptables -Z OUTPUT
iptables -Z FORWARD
# Set Default Policies
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD ACCEPT
# Load all Modules
#
# Only needed if you are going to allow ftp and irc through the firewall for tracking
#
#/sbin/modprobe ip_conntrack_ftp
#/sbin/modprobe ip_conntrack_irc
# Allow loopback traffic
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Forward setup to jump to correct chain
iptables -A FORWARD -i eth1 -j LAN
iptables -A FORWARD -i ppp0 -j WAN
# WAN Chain: We allow no new outside connections
iptables -A WAN -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A WAN -j DROP
#LAN Chain: WE allow only traffic to pass that we want
iptables -A LAN -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A LAN -p tcp --dport 25 -j ACCEPT
iptables -A LAN -p tcp --dport 110 -j ACCEPT
iptables -A LAN -p tcp --dprot 80 -j ACCEPT
iptables -A LAN -p tcp --dprot 443 -j ACCEPT
iptables -A LAN -p udp --dport 53 -j ACCEPT
iptables -A LAN -p icmp --icmp-type 0 -j ACCEPT
iptables -j DROP
# Post routing Masquerading
iptables -A POSTROUTING -o ppp0 -j MASQUERADE
# OUTPUT Chain to allow replies to the LAN only
iptables -A OUTPUT -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -j DROP
-----End cut-----
--
Regards
Robert
Smile... it increases your face value!
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----