Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Gary & Mic McFall <nutbrownhares@tds.net>
To: netfilter@lists.netfilter.org
Subject: Blocking Netranges Based on IP-to-Country CSV
Date: Wed, 15 Sep 2004 18:41:41 -0500	[thread overview]
Message-ID: <1095291700.2828.3.camel@localhost.localdomain> (raw)

Due to a number of issues, my organization is reviewing the ability to
block certain country domains at the firewall.  To be proactive, we want
to automate that process via iptables & the CSV available at
<http://ip-to-country.webhosting.info>.

We have created a C program (IPCheck) in the /bin directory which, when
given an IP long number, checks the ip-to-country CSV and returns a
value for permit or not.  We want to process the packet based on that
return.  

I'm a relative newbie with iptables & scripts.  Listed below is some
very crude code, some of which is a verbal description of intent.  Any
suggestions on how to shore this up so that it will work?  Or should
this concept be a new module in iptables?

#
#    ***** DROP BAD IPS *****
#
/bin/IPCheck `grep -w "SRC =" | cut -d = -f 2`
if return = "Bad IP"
$IPT -A INPUT -$ETH0 $RATELIMIT -j INBADIPS

      ***** RULES - DROP  BAD IPS *****
#    ***** REVIEW LOG AT /var/log/iptables.log *****
#
$IPT -A  INBADIPS -j LOG --log-level debug --log-prefix "BADIP:  " -j
DROP

Thanks in advance for your help.

Gary McFall

             reply	other threads:[~2004-09-15 23:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15 23:41 Gary & Mic McFall [this message]
2004-09-16  0:54 ` Blocking Netranges Based on IP-to-Country CSV Frank Gruellich
  -- strict thread matches above, loose matches on Subject: below --
2004-09-20 13:57 nutbrownhares
2004-09-20 14:09 ` Jason Opperisano
2004-09-20 14:10 ` Alexis
2004-09-17 20:16 Hudson Delbert J Contr 61 CS/SCBN
2004-09-20 11:57 ` Nick Drage
2004-09-16 16:33 Hudson Delbert J Contr 61 CS/SCBN
2004-09-17 11:46 ` Nick Drage
2004-09-18 13:25   ` Pascal Vilarem
2004-09-19 11:09     ` Nick Drage
2004-09-19 14:59       ` Alexis
2004-09-19  9:09   ` Mohamed Eldesoky
2004-09-19 11:01     ` Nick Drage
2004-09-19 11:17       ` Mohamed Eldesoky
2004-09-19 11:45         ` George Alexandru Dragoi
2004-09-20 11:53           ` Nick Drage
2004-09-20 12:06             ` Thomas Lußnig
2004-09-20 12:26               ` Chris Brenton
2004-09-20 13:20                 ` George Alexandru Dragoi
2004-09-20 12:16             ` Chris Brenton
2004-09-15 12:57 McFall, Gary
2004-09-16 14:16 ` Aleksandar Milivojevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1095291700.2828.3.camel@localhost.localdomain \
    --to=nutbrownhares@tds.net \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox