LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-01-2006, 02:15 AM   #1
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Rep: Reputation: 30
Talking iptables antispoof protection


I have a debian sarge 3.1 2.6 stable.To make my iptables script shorter i was wondering about the spoof protection in the /etc/network/option file.If activated does it protect from every IANA spoof address attack or i still need an extra protection in the iptables script with "all" IANA ips set ?This is my actual script.

Quote:
$ipt -t nat -A PREROUTING -i $INT -s 128.0.0.0/16 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 169.254.0.0/16 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 172.16.0.0/12 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 191.255.0.0/16 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 192.0.0.0/24 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 192.0.2.0/24 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 192.88.99.0/24 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 198.18.0.0/15 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 224.0.0.0/4 -j DROP
$ipt -t nat -A PREROUTING -i $INT -s 240.0.0.0/4 -j DROP
 
Old 06-01-2006, 07:55 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
To make my iptables script shorter
What kind of reason is that?


i was wondering about the spoof protection in the /etc/network/option file. If activated does it protect from every IANA spoof address attack or i still need an extra protection in the iptables script with "all" IANA ips set ?
IIGC /etc/network/option seems deprecated in favour of "regular" sysctl.conf use. spoofprotect=yes sets / equals /proc/sys/net/ipv4/conf/default/rp_filter which does not equal filtering bogons, but should be used anyway.


This is my actual script.
If you would search for Cymru and bogons you'll have the whole list in ASCII text format. Now I found I had to manually strip non-bogon, non-IANA ranges belonging to AFRINIC, CISL-5, CVAD, SDSL, RIPE, APNIC and LACNIC. Undoubtedly incomplete due to broken ranges and updating, here's a script adapted to your chain naming. YMMV(VM):
Code:
wget -q http://www.cymru.com/Documents/bogon-bn-nonagg.txt -O /dev/stdout|\
egrep -ve "(^127\.|^192\.168\.|^41\.|^73\.|^76\.|^89\.|^90\.|^121\.|^122\.|^123\.|^124\.|^125\.|^126\.|^189\.|^190\.)"|\
while read s; do echo "\$ipt -t nat -A PREROUTING -i \$INT -s $s -j DROP"; done
 
Old 06-02-2006, 03:54 AM   #3
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Great help,thanks !!!
 
Old 06-03-2006, 12:25 PM   #4
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Quote:
wget -q http://www.cymru.com/Documents/bogon-bn-nonagg.txt -O /dev/stdout|\
egrep -ve "(^127\.|^192\.168\.|^41\.|^73\.|^76\.|^89\.|^90\.|^121\.|^122\.|^123\.|^124\.|^125\.|^126\.|^189\.| ^190\.)"|\
while read s; do echo "\$ipt -t nat -A PREROUTING -i \$INT -s $s -j DROP"; done
How can i add an ulog jump to this?I wrote an extra
Quote:
; do echo "\$ipt -t nat -A PREROUTING -i \$INT -s $s -j ULOG
"
but did not work , a bash help ?

Last edited by gabsik; 06-03-2006 at 12:27 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
iptables - antispoof and modulated states? lazlow69 Linux - Security 1 07-16-2006 07:29 PM
Copy Protection sadafwaqas Linux - Newbie 1 05-16-2006 12:40 PM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM
Data protection. rblampain Linux - Security 4 07-29-2005 12:45 AM
write protection speed_viper Linux - Software 5 10-02-2004 12:10 AM

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

All times are GMT -5. The time now is 08:34 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