All of lore.kernel.org
 help / color / mirror / Atom feed
* A replacement for rp_filter with iptables (config help needed)
@ 2005-06-30  4:24 Simon
  2005-07-01  5:47 ` tahmeed
  0 siblings, 1 reply; 6+ messages in thread
From: Simon @ 2005-06-30  4:24 UTC (permalink / raw)
  To: netfilter

Hi There,

We are debian sarge with two ethernet cards.. To get eth1 (on a seperate 
subnet) working correctly, ive had to change 
/proc/sys/net/ipv4/conf/eth1/rp_filter to 0. Now i need a simple 
solution to protect against spoofing attacks on this interface... I have 
an example setup, but i want to make sure i have it correct.. can 
someone confirm for me?...

Note, this was a small script to block the mysql port on the server, but 
then enable for certain time/ip dynamically by adding/removing chains.

iptables -F
iptables -A INPUT -i lo -j ACCEPT
iptables -N MYSQL
iptables -N SPOOF
iptables -A INPUT -p tcp --dport 3306 -j MYSQL
iptables -A SPOOF -i eth1 -j SPOOF
iptables -A INPUT -p tcp --dport 3306 -j REJECT --reject-with tcp-reset

Is this correct - or have i got it ALL wrong.

Thanks

Simon


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A replacement for rp_filter with iptables (config help needed)
  2005-06-30  4:24 A replacement for rp_filter with iptables (config help needed) Simon
@ 2005-07-01  5:47 ` tahmeed
  2005-07-01 21:55   ` John A. Sullivan III
  0 siblings, 1 reply; 6+ messages in thread
From: tahmeed @ 2005-07-01  5:47 UTC (permalink / raw)
  To: Simon; +Cc: netfilter

hi,

i am not an expert in iptables - actually am studying it - 

one thing - what rules did u set for the new chain MYSQL & SPOOF -
unless & untill u set up rules for any NEW chains u create - its not
going to work.



On 6/30/05, Simon <dev@networker.co.nz> wrote:
> Hi There,
> 
> We are debian sarge with two ethernet cards.. To get eth1 (on a seperate 
> subnet) working correctly, ive had to change 
> /proc/sys/net/ipv4/conf/eth1/rp_filter to 0. Now i need a simple 
> solution to protect against spoofing attacks on this interface... I have 
> an example setup, but i want to make sure i have it correct.. can 
> someone confirm for me?...
> 
> Note, this was a small script to block the mysql port on the server, but 
> then enable for certain time/ip dynamically by adding/removing chains.
> 
> iptables -F
> iptables -A INPUT -i lo -j ACCEPT
> iptables -N MYSQL
> iptables -N SPOOF
> iptables -A INPUT -p tcp --dport 3306 -j MYSQL
> iptables -A SPOOF -i eth1 -j SPOOF
> iptables -A INPUT -p tcp --dport 3306 -j REJECT --reject-with tcp-reset
> 
> Is this correct - or have i got it ALL wrong.
> 
> Thanks
> 
> Simon
> 
> 


-- 
Happy! If not now never


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A replacement for rp_filter with iptables (config help needed)
  2005-07-01  5:47 ` tahmeed
@ 2005-07-01 21:55   ` John A. Sullivan III
  2005-07-01 22:10     ` Jozsef Kadlecsik
  0 siblings, 1 reply; 6+ messages in thread
From: John A. Sullivan III @ 2005-07-01 21:55 UTC (permalink / raw)
  To: netfilter, Simon

In our default configuration for the ISCS network security management
project (http://iscs.sourceforge.net), we generate rules to protect
against spoofing from both the outside and the inside (to ensure we are
good Internet citizens!).  Although the rules are automatically
generated, they tend to look something like this:

iptables -t mangle -A PREROUTING -i ! eth1 -s
2xx.xx.xxx.224/255.255.255.240 -j DROP
iptables -t mangle -A PREROUTING -i eth1 -m ttl --ttl 1 -j DROP
iptables -t mangle -A PREROUTING -i eth0 -j ProtectionMangleSpoof
iptables -t mangle -A ProtectionMangleSpoof -i eth0 -j DROP
iptables -t mangle -A PREROUTING -i ! eth0 -s 10.6.0.0/255.255.0.0 -j
DROP
iptables -t mangle -A PREROUTING -i ! eth0 -s 10.7.0.0/255.255.0.0 -j
DROP
iptables -t mangle -I ProtectionMangleSpoof 1 -i eth0 -s
10.6.0.0/255.255.0.0 -j RETURN
iptables -t mangle -I ProtectionMangleSpoof 1 -i eth0 -s
10.7.0.0/255.255.0.0 -j RETURN

Where eth0 is the private interface and eth1 is the Internet interface.
Hope that helps - John

On Fri, 2005-07-01 at 11:47 +0600, tahmeed wrote: 
> hi,
> 
> i am not an expert in iptables - actually am studying it - 
> 
> one thing - what rules did u set for the new chain MYSQL & SPOOF -
> unless & untill u set up rules for any NEW chains u create - its not
> going to work.
> 
> 
> 
> On 6/30/05, Simon <dev@networker.co.nz> wrote:
> > Hi There,
> > 
> > We are debian sarge with two ethernet cards.. To get eth1 (on a seperate 
> > subnet) working correctly, ive had to change 
> > /proc/sys/net/ipv4/conf/eth1/rp_filter to 0. Now i need a simple 
> > solution to protect against spoofing attacks on this interface... I have 
> > an example setup, but i want to make sure i have it correct.. can 
> > someone confirm for me?...
> > 
> > Note, this was a small script to block the mysql port on the server, but 
> > then enable for certain time/ip dynamically by adding/removing chains.
> > 
> > iptables -F
> > iptables -A INPUT -i lo -j ACCEPT
> > iptables -N MYSQL
> > iptables -N SPOOF
> > iptables -A INPUT -p tcp --dport 3306 -j MYSQL
> > iptables -A SPOOF -i eth1 -j SPOOF
> > iptables -A INPUT -p tcp --dport 3306 -j REJECT --reject-with tcp-reset
> > 
> > Is this correct - or have i got it ALL wrong.
> > 
> > Thanks
> > 
> > Simon
> > 
> > 
> 
> 
-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan@opensourcedevel.com

Financially sustainable open source development
http://www.opensourcedevel.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A replacement for rp_filter with iptables (config help needed)
  2005-07-01 21:55   ` John A. Sullivan III
@ 2005-07-01 22:10     ` Jozsef Kadlecsik
  2005-07-03 14:03       ` Jan Engelhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Jozsef Kadlecsik @ 2005-07-01 22:10 UTC (permalink / raw)
  To: John A. Sullivan III; +Cc: netfilter

Hi,

On Fri, 1 Jul 2005, John A. Sullivan III wrote:

> In our default configuration for the ISCS network security management
> project (http://iscs.sourceforge.net), we generate rules to protect
> against spoofing from both the outside and the inside (to ensure we are
> good Internet citizens!).  Although the rules are automatically
> generated, they tend to look something like this:
>
> iptables -t mangle -A PREROUTING -i ! eth1 -s
> 2xx.xx.xxx.224/255.255.255.240 -j DROP

If you support 2.6.x kernels, I'd suggest to use the raw table instead:
thus the unnecessary load on conntrack could be avoided.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A replacement for rp_filter with iptables (config help needed)
  2005-07-01 22:10     ` Jozsef Kadlecsik
@ 2005-07-03 14:03       ` Jan Engelhardt
  2005-07-04  7:39         ` Jozsef Kadlecsik
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2005-07-03 14:03 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: John A. Sullivan III, netfilter

>> iptables -t mangle -A PREROUTING -i ! eth1 -s
>> 2xx.xx.xxx.224/255.255.255.240 -j DROP
>
>If you support 2.6.x kernels, I'd suggest to use the raw table instead:
>thus the unnecessary load on conntrack could be avoided.
>

Why use this sort of replacement for rp_filter anyway? What's bad with 
rp_filter? (Apart from the problem with asymmetric routing, as is mentioned 
in net/ipv4/*.)



Jan Engelhardt                                                               
--                                                                            
| Gesellschaft fuer Wissenschaftliche Datenverarbeitung Goettingen,
| Am Fassberg, 37077 Goettingen, www.gwdg.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: A replacement for rp_filter with iptables (config help needed)
  2005-07-03 14:03       ` Jan Engelhardt
@ 2005-07-04  7:39         ` Jozsef Kadlecsik
  0 siblings, 0 replies; 6+ messages in thread
From: Jozsef Kadlecsik @ 2005-07-04  7:39 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: John A. Sullivan III, netfilter

On Sun, 3 Jul 2005, Jan Engelhardt wrote:

> >> iptables -t mangle -A PREROUTING -i ! eth1 -s
> >> 2xx.xx.xxx.224/255.255.255.240 -j DROP
> >
> >If you support 2.6.x kernels, I'd suggest to use the raw table instead:
> >thus the unnecessary load on conntrack could be avoided.
>
> Why use this sort of replacement for rp_filter anyway? What's bad with
> rp_filter? (Apart from the problem with asymmetric routing, as is mentioned
> in net/ipv4/*.)

Thus one can disable rp_filter and collect the logs together with all
the "other" firewall log entries.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-07-04  7:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-30  4:24 A replacement for rp_filter with iptables (config help needed) Simon
2005-07-01  5:47 ` tahmeed
2005-07-01 21:55   ` John A. Sullivan III
2005-07-01 22:10     ` Jozsef Kadlecsik
2005-07-03 14:03       ` Jan Engelhardt
2005-07-04  7:39         ` Jozsef Kadlecsik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.