[Eisfair] Block_Complete_Networks mit Geoip
Dirk Alberti
Howy-1 at gmx.de
So Jul 30 13:26:49 CEST 2017
Ich habe jetzt mal ein wenig "experimentiert"... ;-)
So wie es aussieht, muss weder der Kernel, noch iptables dafür neu
kompiliert werden. Zumindest für Eisfair-1.
Ich habe "xtables-addons" heruntergeladen [1], entpackt, kompiliert und
installiert. Vorletzteres benötigte allerdings erst noch die
Installation des Eisfair-Paketes "libxtables-dev" .
Nun ging auf jeden Fall schonmal die Abfrage "iptables -m geoip --help"
, was vorher eine Fehlermeldung brachte, hatte nun die normale Ausgabe
der Hilfe und zusätzliche noch die Zeilen:
geoip match options:
[!] --src-cc, --source-country country[,country...]
Match packet coming from (one of) the specified country(ies)
[!] --dst-cc, --destination-country country[,country...]
Match packet going to (one of) the specified country(ies)
Weiter vorgegangen bin ich nach dieser Anleitung [2], natürlich mit
angepassten Pfaden und ohne sudo. Hier wurde noch das Perl-Modul
"Text::CSV_XS" benötigt, was ich mittels cpan-Befehl installiert habe.
Und dann, siehe da:
eisfair # cd /usr/lib/geoip/
eisfair # /usr/lib/geoip/xt_geoip_build -D /usr/share/xt_geoip *.csv
187904 entries total
0 IPv6 ranges for A1 Anonymous Proxy
33 IPv4 ranges for A1 Anonymous Proxy
0 IPv6 ranges for A2 Satellite Provider
36 IPv4 ranges for A2 Satellite Provider
3 IPv6 ranges for AD Andorra
21 IPv4 ranges for AD Andorra
50 IPv6 ranges for AE United Arab Emirates
257 IPv4 ranges for AE United Arab Emirates
19 IPv6 ranges for AF Afghanistan
etc........
Nun habe ich nur noch das Problem, dass iptables irgendwas nicht findet.
Das Beispiel
>> ==================== Blacklist ======================================
>> Block access to FTP server for Papua New Guinea (PG)
>>
>> iptables -A INPUT -p tcp --dport 21 -m geoip --src-cc PG -j DROP
>> iptables -A INPUT -p tcp --dport 21 -j ACCEPT
>> =====================================================================
>
läuft so nicht:
eisfair # iptables -A INPUT -p tcp --dport 21 -m geoip --src-cc PG -j DROP
iptables: No chain/target/match by that name.
eisfair #
Oder fehlt da doch noch irgendwo was? Mir fehlen halt die grundlegenden
Firewall-/Paketfilter-Kenntnisse... :-(
Gruß
Dirk
[1] https://sourceforge.net/projects/xtables-addons/files/
[2]
https://www.fam-moser.de/blog/kmosers-tech-blog/computer/ubuntu/netzwerk/ubuntu-1404-laender-blockieren-mit-iptables.html
Mehr Informationen über die Mailingliste Eisfair