LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-17-2005, 06:57 PM   #1
bkankur
LQ Newbie
 
Registered: Feb 2005
Posts: 22

Rep: Reputation: 15
Preventing IP Spoofing through IPTABLES


Hello Friends,


I am creating a firewall and with the help of iptables i want to prevent IP Spoofing . Also some tricks of iptables that can help me in preventing from some intruders and attacks.

thanx for the same.
bye and good time,
Ankur.
om shanti.
 
Old 02-26-2005, 02:31 PM   #2
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
As far as I know, preventing spoofing with iptables is really limited to blocking IANA reserved IP addresses or blocking access to IPs that shouldn't be sending traffic over a certain interface (for example, suddenly seeing traffic from your external DNS server on the internal interface should set off alarms). The sysctl rp_filter setting can help with this somewhat, at least in detecting and denying traffic with impossible routes. tcp_wrappers also has a setting 'PARANOID' that will reject traffic whose hostname and IP address don't agree. Some indivdual daemons (like SSHd) have some built-in spoofing protections as well.
 
Old 02-27-2005, 03:48 PM   #3
mikeheggy
Member
 
Registered: Jan 2005
Posts: 37

Rep: Reputation: 15
So, one could set up rules like that only with a machine that has more than one network interface?
 
Old 02-27-2005, 05:56 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You can do it on a machine with one interface -- just drop all outgoing traffic that doesn't have the correct source IP. Note that machines with one ethernet interface may still have multiple IP addresses, so you need to take that into consideration if it applies to you.
 
Old 02-27-2005, 06:09 PM   #5
mikeheggy
Member
 
Registered: Jan 2005
Posts: 37

Rep: Reputation: 15
Quote:
Originally posted by btmiller
...just drop all outgoing traffic that doesn't have the correct source IP
Can you specify what you mean? I have a linux computer with iptables behind a NAT router. It has one interface with one internal IP address. Also, I don't understand how one interface can have multiple IP addresses (maybe you didn't mean at the same time?)
 
Old 02-27-2005, 06:12 PM   #6
Does
LQ Newbie
 
Registered: Jan 2005
Location: USA
Distribution: Slackware-current 2.6.10, Mandrake 10.1
Posts: 24

Rep: Reputation: 15
# Setting up IP spoofing protection
if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]
then
for f in /proc/sys/net/ipv4/conf/*/rp_filter
do
echo 1 > $f
done
fi
 
Old 02-27-2005, 06:39 PM   #7
mikeheggy
Member
 
Registered: Jan 2005
Posts: 37

Rep: Reputation: 15
I'm not exactly sure what that is.

I'm not really a linux newbie, but then again I'm not real experienced with linux either - somewhere in the middle I guess. Anyway, I use Webmin to configure iptables, and that's in plain english...

Here's how my current ruleset goes in english:

Incoming[list=1][*]Accept anything from interface lo[*]accept anything with state of connection related or established[*]accept all icmp[*]rules dealing with services running[*]deny and log everything else[/list=1]

The ruleset is similar for the outgoing chain as well. Is there a way to set up IP spoofing protection using Webmin (or rules)?
 
Old 02-27-2005, 06:42 PM   #8
Does
LQ Newbie
 
Registered: Jan 2005
Location: USA
Distribution: Slackware-current 2.6.10, Mandrake 10.1
Posts: 24

Rep: Reputation: 15
My reply is part of your shell script in which you setup the IP-Tables at runtime.

Peter
 
Old 02-27-2005, 07:13 PM   #9
Capt_Caveman
Senior Member
 
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658

Rep: Reputation: 69
Quote:
Originally posted by mikeheggy
So, one could set up rules like that only with a machine that has more than one network interface?
That would just be an example for a firewall in front of a network. However, the same principle applies for the firewall on a single host. There are types of traffic that you should never see under normal conditions. For example traffic coming into the external interface that has your own IP or the loopback address as the source. You also shouldn't normally see IANA reserved IPs for a source address, as internet routers shouldn't forward packets with invalid addresses. Occasionally it can happen if a router is mis-configured or if you are on a shared subscriber line like cable and your ISP assigns reserved IPs. In most cases though it's an indication that spoofing is occurring, so it's a good idea to block IPs in those ranges.

With regards to how a machine could get an invalid IP or more than 1 IP, both of these are trivial. Using the ifconfig command you can assign whatever IP you like and with IP aliases you can assign as many as you like (I've heard of systems with several thousand IPs assigned to a single interface.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IP spoofing prinski Linux - Security 2 03-25-2004 12:27 PM
Ip spoofing !! freelinuxcpp Linux - Networking 4 03-01-2004 01:08 PM
Iptables Preventing Access lappen Linux - Security 3 12-21-2003 04:53 PM
IP spoofing tied2 Linux - Security 4 07-30-2002 07:55 AM
IP Spoofing robeb Linux - Security 2 06-25-2002 12:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration