May 22, 2020

xtables-addons: How to fix 'Can't open DBIP database' Error

When you are using the 3.8-* version of xtables-addons to harden your server with a geofense, chances are super high that things don’t work anymore… The latest problem occurs after you have downloaded the geo-ip-tables from Maxmind and try to convert the tables for the geofense with xt_geoip_build. You get this error: Can't open DBIP database.

The simple reason for this is that the developers of xtables-addons decided to get rid of Maxmind (maybe because they did that thing with the user accounts a couple of months ago?). Instead, another geo-ip-tables provider called is preferred now. However, this provider uses a different file format. So, the latest version of xt_geoip_build cannot deal with the stuff from Maxmind anymore and you have to update your update script again. This time we have to exchange the geo-ip-tables provider, obviously!

From a bug report I could extract helpful info and update my updater script. Today (!!) this version of my script is working fine:


rm /usr/share/xt_geoip/ -rf
mkdir /usr/share/xt_geoip/

mkdir $tmpdir
cd $tmpdir

wget -O dbip-country-lite.csv.gz "$(date +'%Y-%m').csv.gz"

if [ $? -ne 0 ]; then
wget -O dbip-country-lite.csv.gz "$(date -d '-1 month' +'%Y-%m').csv.gz"

gunzip dbip-country-lite.csv.gz

/usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip *.csv

cd ~
rm -rf $tmpdir

I am sure, next month, or maybe in two months, it will be broken again. But then we fix it again. Right? I swear, there is no component on my server that needs more pampering than the updater for the geo-ip-tables…

© ho1ger 2015 - 2021