xtables-addons-common: cannot find or open GeoIPCountryCSV.zip

As of January 2019 MaxMind stopped providing old format CSV file for their GeoLite2 IP database. More info at their page.

Unfortunately this left everyone relying on xtables-addons-common to make geographyically conditioned iptables rules without an update source. Even the most unstable Debian is affected by this problem.

This is the current result of running xt_geoip_dl:

root@serverx:/usr/share/xt_geoip# /usr/lib/xtables-addons/xt_geoip_dl
--2019-03-15 16:23:44-- http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz
Risoluzione di geolite.maxmind.com (geolite.maxmind.com)…,, 2606:4700::6811:c959, …
Connessione a geolite.maxmind.com (geolite.maxmind.com)||:80… connesso.
Richiesta HTTP inviata, in attesa di risposta… 404 Not Found
2019-03-15 16:23:44 ERRORE 404: Not Found.
--2019-03-15 16:23:44-- http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
Riutilizzo della connessione esistente a geolite.maxmind.com:80.
Richiesta HTTP inviata, in attesa di risposta… 404 Not Found
2019-03-15 16:23:45 ERRORE 404: Not Found.
gzip: GeoIPv6.csv.gz: No such file or directory
unzip: cannot find or open GeoIPCountryCSV.zip, GeoIPCountryCSV.zip.zip or GeoIPCountryCSV.zip.ZIP.

I found several suggestions online on how to convert the current database to the legacy one. The most up to date appeared to be Martin Schmitt GeoLite2xtables repo, but unfortunately following the process resulted in an error when running xt_geoip_build:

Use of uninitialized value $dir in concatenation (.) or string at /usr/lib/xtables-addons/xt_geoip_build line 59.
Couldn't open list country names

So I found it Sander Spies docker image which packed a fixed version of the script into a runnable which generates GeoLite Legacy format files in a shot! Just run:

docker run --rm -v /usr/share/xt_geoip:/xt_build sander1/xtables_geoip

and you have an usable database for xtables!

Unfortunately on an Ubuntu 14.04 server I wasn’t able to run Docker, so I’ve created a small script which runs the above command weekly and provide a tgz with the legacy format database. You can find it at:


A good howto for GeoIP blocking is this one. To test MaxMind’s database you can visit this page.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Solve : *
30 + 17 =

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.