From: "Peter Müller" <peter.mueller@link38.eu>
To: development@lists.ipfire.org
Subject: Re: ASN support for iptables
Date: Mon, 20 Nov 2017 20:03:06 +0100 [thread overview]
Message-ID: <20171120200306.51ef49b2.peter.mueller@link38.eu> (raw)
In-Reply-To: <1511107124.4838.519.camel@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 6314 bytes --]
Hello Michael,
> Hi,
>
> On Sun, 2017-11-19 at 15:52 +0100, Peter Müller wrote:
> > Hello development list,
> >
> > today, I'd like to discuss whether a new feature in
> > the firewall engine of IPFire makes sense or not.
> >
> > Since Core Update 90, IPFire supports GeoIP based firewall
> > rules, which goes beyond simple IP addresses or CIDR blocks
> > and makes firewalling easier.
> >
> > The idea I had in mind is to add ASN (Autonomous System
> > Number) support for firewall rules, too.
> >
> > An AS (Autonomous System) can be described as an administrative
> > instance on top of IP: For example, several IP blocks belong
> > to an AS, i.e. to the same company, university or whatever.
> > Although these blocks may be used for completely different purposes
> > in completely different countries, they share the same owner.
> >
> > Every AS has a number (ASN) and a description (sometimes
> > abbreviated to ASDescr), while the number is unique.
>
> I think this makes sense and I would welcome that as a new feature in IPFire. It
> will in the end have some similar problems like the GeoIP blocker, but that is
> not too bad.
Just for curiosity: Which ones are they?
I only see the (potential) problem of _another_ incomplete database here (see below).
Since all necessary data for this AS stuff are more or less public, inaccurate
data and extensive manual research are not necessary.
All we need is to write some scripts that convert the RIPE, ... databases
to a suitable format.
Second, in contrast to the GeoIP database, false-positives are extremely rare
when dealing with AS information since they have to be technically correct. As
always, there are some "good" and "bad" ASNs, and a lot "grey" ones, which stays
the same.
>
> > There are some scenarios in which AS based firewall rules
> > make sense, since AS information change less seldom than
> > IP ranges:
> >
> > (a) One wants to block malicious traffic, but blocking entire
> > countries is too much since there are some legitimate partners,
> > customers, ... out there. With AS support, it is possible to
> > grant them access by simply permitting their AS. The rest of
> > the country may now safely be blocked.
>
> True. This might work well in some situations, but is probably quite useless
> when fighting against a botnet.
I am not sure about this. In some cases, blocking access to some bullet proof/
rogue ISPs where many C&C servers are hosted improves the situation. Of course,
if there is a simple DDoS attack from many different IPs, this will not help
very much.
>
> What would also be good is to open a port forwarding only from a certain AS.
> Let's call that whitelisting.
Yes, that is a very good use case. :-)
And the combination of GeoIP and AS filtering (inbound and outbound)
opens up fare more possibilities...
>
> > (b) In some cases, IP ranges change very often, making firewall
> > rules very complex and hard to maintain, or the exact IP address
> > of a machine cannot be determined (dial-up connections). In
> > both cases, the AS (mostly) stays the same and allows firewall
> > rules without permitting access to a whole country.
>
> That will be the biggest challenge here. The database will need to be complete
> and needs regular updates. We don't really care if someone is actually
> announcing their prefix, but if they have one assigned, we should block/permit
> access.
I agree with you.
We could simply ship an updated version with every Core Update (I
had that in mind for the CA list, too, so we don't get too big deltas).
>
> > (c) Rogue ISPs (networks which are controlled/operated by professional
> > spammers or worse, such as the "Russian Business Network" (RBN),
> > which died in end-2007) sometimes run networks located in "good"
> > countries such as US or NL. Blocking them by GeoIP is not an
> > option because of many false-positives. AS based rules may help
> > here.
>
> The US is practically unblockable on the GeoIP filter, because too much is
> hosted in the US (at least according to the database by businesses that have
> their HQ there).
Indeed, and there are several ASs over there the internet would be a better
place without. But I guess that applies to most other countries, too.
>
> So this would be a good extension to blocking more granular.
>
> > Since the data behind this can be extracted from BGP feeds,
> > no external databases (such as MaxMind) are required.
>
> If we would use a BGP feed, we will only have the networks in the database that
> are currently announced. Wouldn't scraping the WHOIS database be better?
Good idea. For example, RIPE has one here: http://ftp.ripe.net/ripe/dbase/split/inet(6)num.gz
>
> Why not MaxMind? Not that I am in favour of that, but I am interested why it is
> not an option.
Well, technically, it is an option. But since there is some trouble with
their GeoIP database, as mentioned somewhere else some time before, I'd
like to move away from them.
And since we can build our own database here, I do not see why we should
rely on 3rd party data.
>
> > Unfortunately, my programming skills are too low for implementing
> > this feature. Thereof, if it is decided to do this, I will need
> > some help here. :-)
>
> *raises hand*
Thank you very much. :-)
>
> > Technically, this is similar to the GeoIP firewall stuff (just
> > another database), so I assume most of the work done there can
> > just be copied.
>
> The GeoIP block uses an iptables extension which parses the database. We
> wouldn't use that here but would either build something with ipset or similar.
Hmmm, not sure how well this performs: If there is only a small AS with
few IP ranges to parse, ipset would be sufficient.
However, if we have large networks (Level 3, Hurricane Electric, DTAG, ...),
ipset might become slow and cause many iptables rules. And if we update
the database (whomever created it), we need to reload the firewall rules.
Using a database lookup module similar to GeoIP avoids that issues here, as
far as I am concerned.
Best regards,
Peter Müller
>
> > Any thoughts on this idea?
> >
> > Best regards,
> > Peter Müller
>
> -Michael
next prev parent reply other threads:[~2017-11-20 19:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 14:52 Peter Müller
2017-11-19 15:58 ` Michael Tremer
2017-11-20 19:03 ` Peter Müller [this message]
2017-11-21 13:12 ` Michael Tremer
2017-11-24 18:31 ` Peter Müller
2017-11-28 14:49 ` Michael Tremer
2017-12-04 16:47 ` Peter Müller
2017-12-05 17:29 ` Michael Tremer
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=20171120200306.51ef49b2.peter.mueller@link38.eu \
--to=peter.mueller@link38.eu \
--cc=development@lists.ipfire.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