From: Frank Gruellich <frank@der-frank.org>
To: netfilter@lists.netfilter.org
Subject: Re: Blocking Netranges Based on IP-to-Country CSV
Date: Thu, 16 Sep 2004 02:54:00 +0200 [thread overview]
Message-ID: <20040916005400.GO12986@der-frank.org> (raw)
In-Reply-To: <1095291700.2828.3.camel@localhost.localdomain>
Hello,
* Gary & Mic McFall <nutbrownhares@tds.net> 15. Sep 04:
> To be proactive, we want to automate that process via iptables & the
> CSV available at <http://ip-to-country.webhosting.info>.
I am very suspicious to configure packet filters with external
(untrusted) data.
> We have created a C program (IPCheck) in the /bin directory
Maybe it should go to /usr/local/bin/... anyway.
> We want to process the packet based on that return.
Make it to return 0 for bad and !0 for 'good' IP#s.
> I'm a relative newbie with iptables & scripts.
<URL:http://iptables-tutorial.frozentux.net/iptables-tutorial.html>
> Listed below is some very crude code,
Aah... yes.
> Any suggestions on how to shore this up so that it will work?
# You need to create the userdefined chain bevor using it:
$IPT -N INBADIPS
> # ***** DROP BAD IPS *****
> /bin/IPCheck `grep -w "SRC =" | cut -d = -f 2`
# What are you going to use as input? This grep needs a source to
# parse. Will it result in a list of IP#s? I assume a single $IP.
> if return = "Bad IP"
> $IPT -A INPUT -$ETH0 $RATELIMIT -j INBADIPS
# This will not work. Use:
if /usr/local/bin/IPCheck $IP
then
$IPT -A INPUT -i eth0 -s $IP -j INBADIPS
fi
# What do you mean with $RATELIMIT? Are you looking for
# <URL:http://iptables-tutorial.frozentux.net/iptables-tutorial.html#TABLE.LIMITMATCH>?
> ***** RULES - DROP BAD IPS *****
> # ***** REVIEW LOG AT /var/log/iptables.log *****
> $IPT -A INBADIPS -j LOG --log-level debug --log-prefix "BADIP: " -j DROP
# You can't have to targets in a rule. Split it:
$IPT -A INBADIPS -j LOG --log-level debug --log-prefix="BADIP: "
$IPT -A INBADIPS -j DROP
Some questions you should ask yourself:
+ Is this a gateway? Should it go to FORWARD?
+ Will IP#s stay for ever at blacklist? How and when to remove them?
+ Is this really what you want?
Hope I understood you,
regards, Frank.
--
Sigmentation fault
next prev parent reply other threads:[~2004-09-16 0:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-15 23:41 Blocking Netranges Based on IP-to-Country CSV Gary & Mic McFall
2004-09-16 0:54 ` Frank Gruellich [this message]
-- 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=20040916005400.GO12986@der-frank.org \
--to=frank@der-frank.org \
--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 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.