30

How to convert MaxMinds MMDB GeoIP to DAT format so that I can use with modsecurity+Apache. Modsecurity supports only DAT format.

4
  • 1
    Why can't you use an existing a legacy database (i.e., .dat file)? MaxMind provides GeoLite and GeoIP in both formats. Commented Jan 10, 2014 at 19:12
  • 1
    Thanks for your response Oschwald. Yes I can use the .dat file as long as they provide. But I was not sure in future they may stop supporting .dat format.
    – Dev3182805
    Commented Jan 15, 2014 at 20:42
  • 3
    The .dat files are now taken off the website. geoiplookup doesn't seem to notice the .mmdb files. Does anyone know why this is. I am running arch linux with geoip and the new mmdb files downloaded but there is no city output unless I find and copy the old .dat files. Thanks. Commented Jan 20, 2019 at 20:43
  • This change affects/breaks many of answers given on this page: "Due to upcoming data privacy regulations, we are making significant changes to how you access free GeoLite2 databases starting December 30, 2019." READ: blog.maxmind.com/2019/12/18/…
    – B. Shea
    Commented Feb 10, 2020 at 16:47

4 Answers 4

26

As of February 2019, the following Python script is the best option for converting GeoIP2 MMDB format to legacy .dat format:

https://github.com/sherpya/geolite2legacy

Using this script, somebody has done the conversion and made the resulting .dat files available for download:

https://www.miyuru.lk/geoiplegacy

0
6

The Legacy GeoIP builds (.dat) are not going away in the near future. If they do ever go away, you could build off of the .dat build program that Debian uses for its GeoLite databases (copy of it on GitHub) or this (untested) Python script.

8
  • 3
    Unfortunately, this is no longer true; the legacy .dat files are going away, and they're already (as of April 2018) no longer being updated; see notice on dev.maxmind.com/geoip/legacy/geolite Commented Jun 1, 2018 at 15:31
  • You are correct that the legacy GeoLite databases are going away. Currently, there is no EOL date for the legacy GeoIP databases. Commented Jun 9, 2018 at 17:43
  • 6
    I can confirm that the files are now gone from the MaxMind website.
    – dmulter
    Commented Jan 2, 2019 at 22:02
  • 4
    If anyone want them, I posts the DAT files I convert here
    – miyuru
    Commented Feb 7, 2019 at 8:27
  • @miyuru,your DAT files cause broken in piwik 2.18
    – kittygirl
    Commented Feb 26, 2019 at 8:22
1

Firstly, what I have to say to some here: You are required by MaxMind to update to new databases until 30 days after they get released (EULA point 4.c), so using old databases is actually not legit; also, the data from old databases is simply outdated (probably not valid anymore), so why use it in the first place?

1
  • I consider this an answer - at least a valid contribution to the problem solving. But you might want to rephrase to make the answering part more obvious. The "Thanks" better go into a comment.
    – Yunnosch
    Commented Oct 10, 2020 at 7:42
0

An alternative solution is to install the geoip-database package from the Debian repo.

It'll install the country database at /usr/share/GeoDB/GeoIP.dat

Currently the stable branch has an old version, but testing is relatively up-to-date.

Not the answer you're looking for? Browse other questions tagged or ask your own question.