iptables question
I have my rules setup the way I would guess they should be based on 5 tutorials, 1 book and the man pages. However, I still can't seem to get the thing to do what I want. Could someone please help me?
I will make this very simple:
1) I want to allow all incoming requests to port 80
2) I want to allow all outgoing requests .... period.
I want to drop all other incoming requests not addressed to port 80.
Thats it. I've been fighting with this all day and still can't get it to act right. If you like I can send my current iptables file but its basically the same as the earlier one I sent.
P.S. I'm sorry if someone has already answered my question. I was having a little trouble with my email before... As long as you reply to the list group I should get any further emails without a problem.
Thanks,
Signature · 15 lines
Glenn Hancock SofTek Software International, Inc. 813 Pavilion Court T: 678-583-5720 I: [email protected] www.softeksoftware.com www.Spambite.com NOTE: My email address is currently protected by Spambite. If you send me an email, you will be asked to validate your email address on the Spambite network AND re-send you original email to me. Or, you can pro-actively register your email address on the Spambite network by visiting the website: www.spambite.com When visiting the website, please feel free to look around to learn about this exciting new technology.
Hi Glenn,
Quoted 9 lines
I have my rules setup the way I would guess they should be based on 5 tutorials, 1 book and the man pages. However, I still can't seem to get the thing to do what I want. Could someone please help me?
I will make this very simple:
1) I want to allow all incoming requests to port 80
2) I want to allow all outgoing requests .... period.I want to drop all other incoming requests not addressed to port 80.
Did you see Rob Sterenborg's response to your previous post? The ruleset which you sent didn't appear to be complete. You also don't mention if the machine you're running the firewall on is the same one that's running the web server, and that you're trying to make outgoing requests from. Assuming that it is, the following rules should work:
iptables -F iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP iptables -A INPUT -m state --state established -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPT
If, on the other hand, you have another network behind your Linux box, and machines on that network need to get through the Linux box to the Internet, then you will need the following additional rules:
iptables -A FORWARD -i <internal-interface> -o <external-interface> \
-j ACCEPT
iptables -A FORWARD -m state --state established -j ACCEPT
and if the internal machines have private IP addresses:
iptables -t nat -A POSTROUTING -o <external-interface> -j MASQUERADE
By the way, I don't like my first impression of your challenge-response spam filter. You might want to try SpamAssassin, it's much less intrusive to people trying to e-mail you.
Cheers, Chris.
Signature · 4 lines
___ __ _ / __// / ,__(_)_ | Chris Wilson -- UNIX Firewall Lead Developer | / (_ / ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk | \ _//_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |
Chris,
Thanks to you and to the other gentleman. That fixed me and seems to be working perfectly.
Thanks,
Glenn
Quoted 43 lines · Chris Wilson
Hi Glenn,
Quoted 9 lines
I have my rules setup the way I would guess they should be based on 5 tutorials, 1 book and the man pages. However, I still can't seem to get the thing to do what I want. Could someone please help me?
I will make this very simple:
1) I want to allow all incoming requests to port 80
2) I want to allow all outgoing requests .... period.I want to drop all other incoming requests not addressed to port 80.
Did you see Rob Sterenborg's response to your previous post? The ruleset which you sent didn't appear to be complete. You also don't mention if the machine you're running the firewall on is the same one that's running the web server, and that you're trying to make outgoing requests from. Assuming that it is, the following rules should work:
iptables -F iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD DROP iptables -A INPUT -m state --state established -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPTIf, on the other hand, you have another network behind your Linux box, and machines on that network need to get through the Linux box to the Internet, then you will need the following additional rules:
iptables -A FORWARD -i <internal-interface> -o <external-interface> \
-j ACCEPT
iptables -A FORWARD -m state --state established -j ACCEPTand if the internal machines have private IP addresses:
iptables -t nat -A POSTROUTING -o <external-interface> -j MASQUERADE
By the way, I don't like my first impression of your challenge-response spam filter. You might want to try SpamAssassin, it's much less intrusive to people trying to e-mail you.
Cheers, Chris.
Signature · 15 lines
Glenn Hancock SofTek Software International, Inc. 813 Pavilion Court T: 678-583-5720 I: [email protected] www.softeksoftware.com www.Spambite.com NOTE: My email address is currently protected by Spambite. If you send me an email, you will be asked to validate your email address on the Spambite network AND re-send you original email to me. Or, you can pro-actively register your email address on the Spambite network by visiting the website: www.spambite.com When visiting the website, please feel free to look around to learn about this exciting new technology.
Am Mit, 2003-08-13 um 22.49 schrieb Glenn Hancock:
Quoted 5 lines
I have my rules setup the way I would guess they should be based on 5 tutorials, 1 book and the man pages. However, I still can't seem to get the thing to do what I want. Could someone please help me?
I will make this very simple:
Is this for a local machine?
Quoted 1 line
1) I want to allow all incoming requests to port 80
# Allow new connections to port 80
iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
Quoted 1 line
2) I want to allow all outgoing requests .... period.
# Allow outgoing connections
iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT # Allow all packets belonging to established connections come back iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
Quoted 3 lines
I want to drop all other incoming requests not addressed to port 80.
iptables -P INPUT DROP
iptables -P OUTPUT DROP
Cheers,
Ralf
Signature · 6 lines
Ralf Spenneberg RHCE, RHCX Book: Intrusion Detection für Linux Server http://www.spenneberg.com IPsec-Howto http://www.ipsec-howto.org Honeynet Project Mirror: http://honeynet.spenneberg.org