Sonny To on 23 Aug 2007 14:35:34 -0000 |
Dan, that was it. thanks a lot! for the benefit of anyone who might be trying to open port 22 and 80 for ssh and http, but block everything else here's the complete iptables rule iptables -A INPUT -j ACCEPT -p tcp --destination-port 22 -i ppp0 iptables -A INPUT -j ACCEPT -p tcp --destination-port 80 -i ppp0 iptables -A INPUT -j ACCEPT -p tcp -m state --state ESTABLISHED,RELATED -i ppp0 iptables -A INPUT -j DROP -p tcp -i ppp0 order matters because the chain is matched from top down. ppp0 is the external interface (adsl pppoe) On 8/23/07, Dan Widyono <dan@widyono.net> wrote: > On Thu, Aug 23, 2007 at 12:52:29AM -0400, Sonny To wrote: > > iptables -A INPUT -j ACCEPT -p tcp --destination-port 22 -i ppp0 > > iptables -A INPUT -j ACCEPT -p tcp --destination-port 80 -i ppp0 > > iptables -A INPUT -j DROP -p tcp -i ppp0 > > > this rule is saying, drop everything coming in from ppp0 except on > > port 22 & 80. computers on the LAN can connect out but the firewall > > cannot connect out. > > When you SSH outbound, you're coming from a random high port, let's say 32768 > for this explanation. When the sshd on the outside responds, it's replying > to port 32768. You have to allow for that as well coming in, using > --source-port 22 and state ESTABLISHED,RELATED. It's easier but broader (and > therefore perhaps less secure) to have one rule to just allow all incoming > ESTABLISHED,RELATED packets. Saves typing. > > Dan W. > ___________________________________________________________________________ > Philadelphia Linux Users Group -- http://www.phillylinux.org > Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce > General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug > ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|