Dopers,
Anybody want to try and explain IPTables to me? I’ve googled and googled but even the intro tutorials are complicated. I wouldn’t even consider myself a linux newbie.
Background
I recently installed apache2 on my linux box. In an attempt to lock things down a little better, I fired up iptables. I noticed two things right off the back that it was stopping; my Samba connections to Windows 2000 shares were not accesible and I was no longer able to passive ftp into my ftp server.
So, first, here’s my iptables file:
# Firewall configuration written by redhat-config-securitylevel
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -s 68.33.103.42 --dport 80 -j REJECT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
Now, I added 4 entries to the out-of-the-box config. The tcp port 139, udp 138, udp 137 and finally the specific ip address reject. The 139, 138 and 137 were supposed to be the ports for SAMBA but opening those hasn’t fixed that problem. The specific ip reject is to block a box launching a continual attack on my apache server (that one seems to work).
1.) anyone know where I went wrong with SAMBA? How can I set it to only allow boxes on my network to see the SAMBA shares (ie anything with a 192.168.1.0/24 – -s maybe)?
2.) does my specific ip block look correct?
3.) to get passive ftp to work, I think I must specify a passive port range in my ftp config and then open those ports, right?
Details
Fedora Core 1 - VSftpd - Apache2 - if you need the version #s I’ll dig them out.
Thanks,
LarsenMTL