Re: Iptables or misconfiguration?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Re: Iptables or misconfiguration?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Iptables or misconfiguration?  
James T. Dennis


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 09:27 PM

Diogo C. Pereira <diogocolla@yahoo.com> wrote:
quote:
> I'm building up a router with IPTABLES. My wish is to isolate the > internal network from the internet. I inserted two rules to it:
quote:
> /usr/sbin/iptables -t nat -P POSTROUTING DROP > /usr/sbin/iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to > my_address
quote:
> NAT works very well, but what I get is that the router doesn't > communicates with the machines on the internal network, but the > machines communicate with the router. > When I try to ping some 192.168.0. from the router, it says:
quote:
> PING 192.168.0.3 (192.168.0.3): 56 data bytes > ping: sendto: Operation not permitted > ping: wrote 192.168.0.3 64 chars, ret=-1
quote:
> I need to ssh and other things to the internal network... > where am I failing?
You're being a little too simplistic. In general you should bind your rules to a particular interface. It is quite reasonable to block all the RFC 1918 blocks (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) as well as "martians" (127.0.0.0/8) and a few other known reserved blocks (168.254.0.0) (see ftp://ftp.rfc-editor.org/in-notes/rfc3330.txt for a list and some discussion on that). These addresses should never appear as sources on any packets you receive from the Internet. So you can presume that they are spoofed. I recommend DROP as your policy for these sorts of inbound packets; but I wouldn't bother logging them. (It's just doorknob twisting and is a waste of your time to count how often portscanners and other malware are sweeping the 'net). A rule for outbound packets should simply require that they have a one of your valid (ISP assigned) addresses. This prevents your site from emitting any spoofed packets and is the crux of egress filtering. It means that many sorts of DDoS worm would be prevented from using your site to attack others. In addition a cracker who broke into your site would find your network connections of limited use as a launch point for further attacks (assuming he/she didn't manage to "own" your router, too). I recommend these be REJECTed and logged. (You should be alerted to any attempts by your users to spoof or abuse the 'net --- that you *can* and should do something about). Anyway, you could just put in an accept rule: /usr/sbin/iptables -t filter -A OUTPUT -o eth0 -j ALLOW -s $MYIPADDR .. I think this should only apply to packets generated by local processes (according the man page) and should pre-empt any other rules that would otherwise effect the packet). Do not remove (ellide) my signature from any E-MAIL replies. -- Jim Dennis, Starshine: Signed, Sealed, Delivered




[ Post a follow-up to this message ]



    Re: Iptables or misconfiguration?  
James T. Dennis


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 09:38 PM

Diogo C. Pereira <diogocolla@yahoo.com> wrote:
quote:
> I'm building up a router with IPTABLES. My wish is to isolate the > internal network from the internet. I inserted two rules to it:
quote:
> /usr/sbin/iptables -t nat -P POSTROUTING DROP > /usr/sbin/iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to > my_address
quote:
> NAT works very well, but what I get is that the router doesn't > communicates with the machines on the internal network, but the > machines communicate with the router. > When I try to ping some 192.168.0. from the router, it says:
quote:
> PING 192.168.0.3 (192.168.0.3): 56 data bytes > ping: sendto: Operation not permitted > ping: wrote 192.168.0.3 64 chars, ret=-1
quote:
> I need to ssh and other things to the internal network... > where am I failing?
You're being a little too simplistic. In general you should bind your rules to a particular interface. It is quite reasonable to block all the RFC 1918 blocks (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) as well as "martians" (127.0.0.0/8) and a few other known reserved blocks (168.254.0.0) (see ftp://ftp.rfc-editor.org/in-notes/rfc3330.txt for a list and some discussion on that). These addresses should never appear as sources on any packets you receive from the Internet. So you can presume that they are spoofed. I recommend DROP as your policy for these sorts of inbound packets; but I wouldn't bother logging them. (It's just doorknob twisting and is a waste of your time to count how often portscanners and other malware are sweeping the 'net). A rule for outbound packets should simply require that they have a one of your valid (ISP assigned) addresses. This prevents your site from emitting any spoofed packets and is the crux of egress filtering. It means that many sorts of DDoS worm would be prevented from using your site to attack others. In addition a cracker who broke into your site would find your network connections of limited use as a launch point for further attacks (assuming he/she didn't manage to "own" your router, too). I recommend these be REJECTed and logged. (You should be alerted to any attempts by your users to spoof or abuse the 'net --- that you *can* and should do something about). Anyway, you could just put in an accept rule: /usr/sbin/iptables -t filter -A OUTPUT -o eth0 -j ALLOW -s $MYIPADDR .. I think this should only apply to packets generated by local processes (according the man page) and should pre-empt any other rules that would otherwise effect the packet). Do not remove (ellide) my signature from any E-MAIL replies. -- Jim Dennis, Starshine: Signed, Sealed, Delivered




[ Post a follow-up to this message ]



    Re: Iptables or misconfiguration?  
James T. Dennis


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 09:54 PM

Diogo C. Pereira <diogocolla@yahoo.com> wrote:
quote:
> I'm building up a router with IPTABLES. My wish is to isolate the > internal network from the internet. I inserted two rules to it:
quote:
> /usr/sbin/iptables -t nat -P POSTROUTING DROP > /usr/sbin/iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to > my_address
quote:
> NAT works very well, but what I get is that the router doesn't > communicates with the machines on the internal network, but the > machines communicate with the router. > When I try to ping some 192.168.0. from the router, it says:
quote:
> PING 192.168.0.3 (192.168.0.3): 56 data bytes > ping: sendto: Operation not permitted > ping: wrote 192.168.0.3 64 chars, ret=-1
quote:
> I need to ssh and other things to the internal network... > where am I failing?
You're being a little too simplistic. In general you should bind your rules to a particular interface. It is quite reasonable to block all the RFC 1918 blocks (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) as well as "martians" (127.0.0.0/8) and a few other known reserved blocks (168.254.0.0) (see ftp://ftp.rfc-editor.org/in-notes/rfc3330.txt for a list and some discussion on that). These addresses should never appear as sources on any packets you receive from the Internet. So you can presume that they are spoofed. I recommend DROP as your policy for these sorts of inbound packets; but I wouldn't bother logging them. (It's just doorknob twisting and is a waste of your time to count how often portscanners and other malware are sweeping the 'net). A rule for outbound packets should simply require that they have a one of your valid (ISP assigned) addresses. This prevents your site from emitting any spoofed packets and is the crux of egress filtering. It means that many sorts of DDoS worm would be prevented from using your site to attack others. In addition a cracker who broke into your site would find your network connections of limited use as a launch point for further attacks (assuming he/she didn't manage to "own" your router, too). I recommend these be REJECTed and logged. (You should be alerted to any attempts by your users to spoof or abuse the 'net --- that you *can* and should do something about). Anyway, you could just put in an accept rule: /usr/sbin/iptables -t filter -A OUTPUT -o eth0 -j ALLOW -s $MYIPADDR .. I think this should only apply to packets generated by local processes (according the man page) and should pre-empt any other rules that would otherwise effect the packet). Do not remove (ellide) my signature from any E-MAIL replies. -- Jim Dennis, Starshine: Signed, Sealed, Delivered




[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 01:15 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register