ich möchte bei mehreren Debian Stretch Servern verschiedene Länder per Geoip und iptables blocken. Diese Tutorials:
https://documentacoes.wordpress.com/201 ... -debian-9/
https://terminal28.com/how-to-block-cou ... es-debian/
halfen bei der einfachen Einrichtung. Doch jetzt stellte ich fest, dass diese Geoip-Datenbank seit 2.1.19 nicht weiter gepflegt wird und nicht mehr verfügbar ist:
https://support.maxmind.com/geolite-leg ... on-notice/
Ich habe mir zwar die neue Version heruntergeladen:
https://dev.maxmind.com/geoip/geoip2/geolite2/
(sorry für die vielen Links), doch scheint sich die ganze Struktur der Dateien geändert zu haben. Die Datei GeoLite2-Country-CSV.zip hat folgenden Inhalt:
Code: Alles auswählen
root@server /tmp/GeoLite2-Country-CSV_20190212 # ls -al
insgesamt 14968
drwxr-xr-x 2 root root 4096 Feb 19 14:48 .
drwxrwxrwt 16 root root 4096 Feb 19 15:04 ..
-rw-r--r-- 1 root root 55 Feb 12 23:08 COPYRIGHT.txt
-rw-r--r-- 1 root root 11734000 Feb 12 23:08 GeoLite2-Country-Blocks-IPv4.csv
-rw-r--r-- 1 root root 3464092 Feb 12 23:08 GeoLite2-Country-Blocks-IPv6.csv
-rw-r--r-- 1 root root 9864 Feb 12 23:08 GeoLite2-Country-Locations-de.csv
-rw-r--r-- 1 root root 9937 Feb 12 23:08 GeoLite2-Country-Locations-en.csv
-rw-r--r-- 1 root root 9992 Feb 12 23:08 GeoLite2-Country-Locations-es.csv
-rw-r--r-- 1 root root 10230 Feb 12 23:08 GeoLite2-Country-Locations-fr.csv
-rw-r--r-- 1 root root 14998 Feb 12 23:08 GeoLite2-Country-Locations-ja.csv
-rw-r--r-- 1 root root 11422 Feb 12 23:08 GeoLite2-Country-Locations-pt-BR.csv
-rw-r--r-- 1 root root 14932 Feb 12 23:08 GeoLite2-Country-Locations-ru.csv
-rw-r--r-- 1 root root 11732 Feb 12 23:08 GeoLite2-Country-Locations-zh-CN.csv
-rw-r--r-- 1 root root 433 Feb 12 23:08 LICENSE.txt
-rw-r--r-- 1 root root 116 Feb 12 23:08 README.txt
root@sa /tmp/GeoLite2-Country-CSV_20190212 #
Hat sich eventuell schon jemand die Mühe gemacht, die Scripte ( /usr/lib/xtables-addons/xt_geoip_build ) anzupassen?
Edit: ich glaube ich habe schon etwas gefunden: https://github.com/mschmitt/GeoLite2xtables
Lösung:
* Download: https://github.com/mschmitt/GeoLite2xta ... master.zip
* Installieren eines benötigten perl-Modules:
$ perl -MCPAN -e shell
$ install NetAddr::IP
* Danach wie in der Anleitung folgendes ausführen:
$ ./00_download_geolite2
$ ./10_download_countryinfo
$ cat /tmp/GeoLite2-Country-Blocks-IPv{4,6}.csv | ./20_convert_geolite2 /tmp/CountryInfo.txt > /usr/share/xt_geoip/GeoIP-legacy.csv
$ /usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip /usr/share/xt_geoip/GeoIP-legacy.csv
Jetzt werden ip's endlich geblockt, getestet mit einer Freundin aus der Schweiz
(Der Anlass sind eigentlich diese obernervigen Angriffe gegen alles was ein Login hat, inbesondere SSH, seit über einer Woche)