Skip to main content

GeoIP

authentik supports GeoIP to add additional information to login/authorization/enrollment requests. Additionally, a GeoIP Policy can be used to make policy decisions based on the lookup result.

authentik reads two databases in the MaxMind DB (.mmdb) format:

  • a City database, which provides the continent, country, city, and coordinates of an IP address
  • an ASN database, which provides the autonomous system number and organization of an IP address

Bundled databases​

The authentik server image includes the free DB-IP Lite City and ASN databases, so GeoIP works without any additional setup. DB-IP publishes a new edition of these databases each month, and each authentik image contains the edition that was current when the image was built.

DatabaseDefault path
City/geoip/dbip-city-lite.mmdb
ASN/geoip/dbip-asn-lite.mmdb

To load a database from another path, set AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__GEOIP and AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__ASN. authentik automatically reloads a database file when it changes.

Attribution

The DB-IP Lite databases are licensed under the Creative Commons Attribution 4.0 International License. IP geolocation by DB-IP.

MaxMind GeoLite2 databases​

authentik versions before 2026.11 bundled the MaxMind GeoLite2 databases. You can still use them, or any other database in the same format, by mounting the files into the container and setting the paths described above.

If the default DB-IP file is missing and a MaxMind file exists at its previous default path (/geoip/GeoLite2-City.mmdb or /geoip/GeoLite2-ASN.mmdb), authentik loads the MaxMind file instead and logs a warning. This keeps existing setups that mount a volume over /geoip working. To silence the warning, set the paths explicitly.

Deactivate GeoIP​

If you want to disable GeoIP, you can set the path to a non-existent path and authentik will skip the GeoIP.

Add the following block to your .env file:

AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__GEOIP=/tmp/non-existent-file
AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__ASN=/tmp/non-existent-file

Afterwards, run the upgrade commands from the latest release notes.

External updates​

To get database updates without upgrading authentik, mount a volume to /geoip and keep the files in it up to date. The volume replaces the bundled databases.

DB-IP​

DB-IP does not require an account. The following Docker Compose example downloads the current edition once a day:

Add the following block to a compose.override.yml file in the same folder as the authentik compose.yml file:

services:
server:
volumes:
- geoip:/geoip
worker:
volumes:
- geoip:/geoip
geoipupdate:
image: docker.io/library/alpine:3.22
volumes:
- geoip:/geoip
command:
- sh
- -c
- |
while true; do
month="$$(date -u +%Y-%m)"
for edition in city asn; do
wget -q -O - "https://download.db-ip.com/free/dbip-$$edition-lite-$$month.mmdb.gz" \
| gunzip > "/geoip/dbip-$$edition-lite.mmdb.tmp" \
&& mv "/geoip/dbip-$$edition-lite.mmdb.tmp" "/geoip/dbip-$$edition-lite.mmdb"
done
sleep 86400
done
volumes:
geoip:
driver: local

Afterwards, run the upgrade commands from the latest release notes.

MaxMind​

Create a free MaxMind account.

Add the following block to a compose.override.yml file in the same folder as the authentik compose.yml file:

services:
server:
environment:
AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__GEOIP: /geoip/GeoLite2-City.mmdb
AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__ASN: /geoip/GeoLite2-ASN.mmdb
volumes:
- geoip:/geoip
worker:
environment:
AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__GEOIP: /geoip/GeoLite2-City.mmdb
AUTHENTIK_EVENTS__CONTEXT_PROCESSORS__ASN: /geoip/GeoLite2-ASN.mmdb
volumes:
- geoip:/geoip
geoipupdate:
image: "maxmindinc/geoipupdate:latest"
volumes:
- "geoip:/usr/share/GeoIP"
environment:
GEOIPUPDATE_EDITION_IDS: "GeoLite2-City GeoLite2-ASN"
GEOIPUPDATE_FREQUENCY: "8"
GEOIPUPDATE_ACCOUNT_ID: "*your account ID*"
GEOIPUPDATE_LICENSE_KEY: "*your license key*"
volumes:
geoip:
driver: local

Afterwards, run the upgrade commands from the latest release notes.