maxmind: download fails (new MaxMind policy 2024)
Per a message on the MaxMind dashboard:
We will begin enforcing our API endpoint policies which could cause breaking changes if you you have not configured your integration correct. Read more on our release note
From there, an additional link says that you now need to use a curl command similar to this (ignoring the -CSV edition and zip format):
curl -O -J -L -u YOUR_ACCOUNT_ID:YOUR_LICENSE_KEY 'https://download.maxmind.com/geoip/databases/GeoIP2-City-CSV/download?suffix=zip'
rather than what is currently used in libmaxminddb.cron:
curl --silent "${MAXMINDDB_URL}?edition_id=${EDITION_ID}&license_key=${MAXMINDDB_LICENSE_KEY}&suffix=tar.gz" -o "$TMPDIR/${filename}.tar.gz"
(It may be that this new incantation is only being enforced for new accounts)
I'm using a downstream via the lscr.io/linuxserver/swag docker image and its maxmind mod linuxserver/mods:swag-maxmind; I reported it there, but was told to report upstream -- which is here.
The following works for me:
--- libmaxminddb.cron.orig 2024-02-25 21:57:46.568145300 -0500
+++ libmaxminddb.cron 2024-02-25 21:59:38.337372400 -0500
@@ -5,9 +5,10 @@
set -e
[ -z "$MAXMINDDB_FILES" ] && MAXMINDDB_FILES="GeoLite2-City.mmdb"
-[ -z "$MAXMINDDB_URL" ] && MAXMINDDB_URL="https://download.maxmind.com/app/geoip_download"
+[ -z "$MAXMINDDB_URL" ] && MAXMINDDB_URL="https://download.maxmind.com/geoip/databases"
[ -z "$MAXMINDDB_LIBDIR" ] && MAXMINDDB_LIBDIR="/var/lib/libmaxminddb"
[ -z "$MAXMINDDB_LICENSE_KEY" ] && { echo "No MaxMind license key found; exiting. Please enter your license key into /etc/libmaxminddb.cron.conf"; exit 1; }
+[ -z "$MAXMINDDB_USER_ID" ] && { echo "No MaxMind user id found; exiting. Please enter your user id into /etc/libmaxminddb.cron.conf"; exit 1; }
clean_up() {
[ -n "$TMPDIR" ] && rm -rf "$TMPDIR"
@@ -17,7 +18,7 @@
TMPDIR="$(mktemp -d)"
for filename in $MAXMINDDB_FILES; do
EDITION_ID=$(echo "${filename}" | sed 's/\.mmdb$//')
- curl --silent "${MAXMINDDB_URL}?edition_id=${EDITION_ID}&license_key=${MAXMINDDB_LICENSE_KEY}&suffix=tar.gz" -o "$TMPDIR/${filename}.tar.gz"
+ curl --silent -L -J -u "${MAXMINDDB_USER_ID}:${MAXMINDDB_LICENSE_KEY}" "${MAXMINDDB_URL}/${EDITION_ID}/download?suffix=tar.gz" -o "$TMPDIR/${filename}.tar.gz"
tar xf "$TMPDIR/${filename}.tar.gz" -C "$TMPDIR" --strip-components=1
mv "$TMPDIR/$filename" "$MAXMINDDB_LIBDIR"
done
with
--- libmaxminddb.confd.orig 2024-02-25 21:57:55.642304000 -0500
+++ libmaxminddb.confd 2024-02-25 22:00:34.311058900 -0500
@@ -2,10 +2,11 @@
# MAXMINDDB_FILES="GeoLite2-City.mmdb"
# Database download directory
-# MAXMINDDB_URL="https://download.maxmind.com/app/geoip_download"
+# MAXMINDDB_URL="https://download.maxmind.com/geoip/databases"
# Local target directory
# MAXMINDDB_LIBDIR="/var/lib/libmaxminddb"
# MaxMind license key, can be retrieved through https://www.maxmind.com/en/geolite2/signup
MAXMINDDB_LICENSE_KEY=""
+MAXMINDDB_USER_ID=""
Because of the addition of the new MAXMINDDB_USER_ID configuration item, there may be some documentation somewhere that also would need to be updated?
References: https://dev.maxmind.com/geoip/updating-databases#directly-downloading-databases https://github.com/linuxserver/docker-mods/issues/853