EssentialsX

EssentialsX

2M Downloads

EssentialsX GeoIP source database issue

OverlordFreddo opened this issue ยท 7 comments

commented

When I start a 1.15.1 server, GeoIP gives me an error that there's no database at the URL specified.

[01:40:58] [Server thread/INFO]: [EssentialsGeoIP] Enabling EssentialsGeoIP v2.17.1.47 [01:40:58] [Server thread/INFO]: [EssentialsGeoIP] Downloading GeoIP database... this might take a while (country: 1.7 MB, city: 30MB) [01:40:58] [Server thread/ERROR]: [EssentialsGeoIP] Failed to open connection. java.net.UnknownHostException: geolite.maxmind.com

When I checked, I found that you now need to register an account for access to these files.
https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/

I would have tried to find another source but without knowing if the plugin can read/use that source I don't feel I'm qualified to do that.

commented

I don't think anyone has had time to thoroughly investigate this issue yet, but it's very possible that server owners will be required to generate their own license key to continue using GeoIP. It's a bit of an inconvenience, but I think first time setup messages and license key fields could easily be incorporated into the plugin to make the entire process more user friendly.

commented

I registered an account and got a license key. I was able to modify the URL to include the license key as follows:

https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=MYLICENSEKEY&suffix=tar.gz

And the database was downloaded successfully.

I suppose this could be made more user-friendly by having a separate configuration parameter with the key, and have the plugin construct the URL automatically.

You should probably also check the MaxMind EULA to make sure we're not doing anything wrong:
https://www.maxmind.com/en/end-user-license-agreement
IANAL, but it's the server owner who is getting the license key and agreeing to abide by the terms. I don't think this is imposing any restrictions on the EssentialsX project.

commented

Yes, I'm getting an error:

2020-01-02 23:16:44 [ERROR] Failed to read GeoIP database! The MaxMind DB file's search tree is corrupt: contains pointer larger than the database.

There are four files in the downloaded gz file. It looks like the plugin is extracting all four files into the output file, instead of just the database. What did the old .gz files contain?

EDIT: This makes no sense to me. Maybe I'm looking at it wrong.

commented

I was just testing the method @Bobcat00 mentioned but wasn't able to get it to work. Maybe I did something wrong, but I don't think I did because it still downloaded, just another error appeared in its stead.

[01:33:58 ERROR]: [EssentialsGeoIP] Failed to read GeoIP database!
com.maxmind.db.InvalidDatabaseException: Could not find a MaxMind DB metadata marker in this file (GeoIP2-City.mmdb). Is this a valid MaxMind DB file?
        at com.maxmind.db.Reader.findMetadataStart(Reader.java:278) ~[?:?]
        at com.maxmind.db.Reader.<init>(Reader.java:129) ~[?:?]
        at com.maxmind.db.Reader.<init>(Reader.java:116) ~[?:?]
        at com.maxmind.geoip2.DatabaseReader.<init>(DatabaseReader.java:66) ~[?:?]
        at com.maxmind.geoip2.DatabaseReader.<init>(DatabaseReader.java:54) ~[?:?]
        at com.maxmind.geoip2.DatabaseReader$Builder.build(DatabaseReader.java:160) ~[?:?]
        at com.earth2me.essentials.geoip.EssentialsGeoIPPlayerListener.reloadConfig(EssentialsGeoIPPlayerListener.java:157) ~[?:?]
        at com.earth2me.essentials.geoip.EssentialsGeoIPPlayerListener.<init>(EssentialsGeoIPPlayerListener.java:43) ~[?:?]
        at com.earth2me.essentials.geoip.EssentialsGeoIP.onEnable(EssentialsGeoIP.java:28) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.15.1.jar:git-Paper-31]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:338) ~[patched_1.15.1.jar:git-Paper-31]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:420) ~[patched_1.15.1.jar:git-Paper-31]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin(CraftServer.java:468) ~[patched_1.15.1.jar:git-Paper-31]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins(CraftServer.java:382) ~[patched_1.15.1.jar:git-Paper-31]
        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:481) ~[patched_1.15.1.jar:git-Paper-31]
        at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:290) ~[patched_1.15.1.jar:git-Paper-31]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:884) ~[patched_1.15.1.jar:git-Paper-31]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
commented

OK this morning I got it to work via manual download. Used the link, unpacked it, and renamed the GeoLite2-City.mmdb to GeoIP2-City.mmdb and put it in the EssentialsGeoIP folder. I'm not 100% certain, but it might be that you need to turn off download-if-missing and/or update.enable if you are manually updating it.

commented

So is the Essential's unpacking broken? Did they change the file name?

EDIT: No, I see they look for the .mmdb extension and grab that file.

EDIT2: Oh, wait, I think I see the problem. The .gz file has a top-level directory in it. In my download, it's GeoLite2-City_20191231. So I think Essential's download process has to go into the first directory it finds, then start looking for the .mmdb file.

commented

Seems it was just a problem with GeoIP not recognising the new URL format in certain cases. I believe it's fixed now.