hello gurus,
could somebody please help me on deciphering my iptables and pinpoint to me what's wrong with it? i am following this book about setting up a webserver. they suggested to use their script named "firewall". the contents are listed below. when ever i start this firewall, i cant get to the internet and cant see my webserver. when i stop it, everything works. i also listed the default iptables output below after running the iptables --list (this is when everything works). it seems pretty much open.
i just want to have a secure and safe webserver using apache, mysql, and php with email and ftp capability. please advice. thanks in advance!
********************book's firewall script (does not work)*************************
#!/bin/sh
# Change the part after the = to the where your
# IPTABLES is on your system
IPTABLES=/sbin/iptables
# Flush existing rulles
$IPTABLES -F INPUT
# Allow connections going outbound
# from this machine to reply back
$IPTABLES -A INPUT -j ACCEPT -m state --state \
ESTABLISHED -i eth0 -p icmp
# ESTABLISHED -i wlan0 -p icmp
$IPTABLES -A INPUT -j ACCEPT -m state --state \
ESTABLISHED -i eth0 -p tcp
# ESTABLISHED -i wlan0 -p tcp
$IPTABLES -A INPUT -j ACCEPT -m state --state \
ESTABLISHED -i eth0 -p udp
# ESTABLISHED -i wlan0 -p udp
# Allow incoming SSH requests
$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 tcp --dport 143 -j ACCEPT
# Allow incoming DNS
$IPTABLES -A INPUT -p udp --dport 53 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 53 -j ACCEPT
# Allow incoming HTTP requests (to web server)
$IPTABLES -A INPUT -p tcp --dport 80 -j ACCEPT
$IPTABLES -A INPUT -p tcp --dport 443 -j ACCEPT
# Allow Ping echo
$IPTABLES -A INPUT -p icmp -j ACCEPT
# Load modules
insmod ip_conntrack_ftp
insmod ipt_LOG
insmod ipt_REJECT
insmod ipt_limit
insmod ipt_state
# The logging is set so if more than 5 packets are dropped
# in three seconds they will be ignored. This
# helps to prevent a DOS attack
# crashing the computer the firewall is running on
# $IPTABLES -A INPUT -m limit --limit 3/second \
# --limit-burst 5 -i ! lo -j LOG
# Drop and log all other data
$IPTABLES -A INPUT -i ! lo -j DROP
*******************default (everything works)******************
[root@projectff selinux]# iptables --list
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
**************iptables --list after starting "firewall" script*************
[root@projectff etc]# iptables --list
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT icmp -- anywhere anywhere state ESTABLISHED
ACCEPT tcp -- anywhere anywhere state ESTABLISHED
ACCEPT udp -- anywhere anywhere state ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt

op3
ACCEPT tcp -- anywhere anywhere tcp dpt:imap
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT icmp -- anywhere anywhere
DROP all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
[root@projectff etc]#