Page 1 of 1

Maxmind GeoIP2 license key not accepted

Posted: 01 Jun 2023 10:21
by BOOZy
[eFa] Please enter your MaxMind License Key (c to cancel): XXXXXX_ZAJ5wHRIAkbC2uFujBv18HaT5cYy2_xxx
ERROR: Invalid entry.

My guess is that they key format has changed and EFA is not accepting the new format.

Re: Maxmind GeoIP2 license key not accepted

Posted: 06 Jun 2023 10:47
by pdwalker
When did you generate your license key?

I generated mine in 2020 and it's still usable today.
Screenshot 2023-06-06 at 18.45.png
Screenshot 2023-06-06 at 18.45.png (13.47 KiB) Viewed 17558 times
Also, your key looks longer than mine. Mine is 16 characters long. You're looks a lot longer.

Re: Maxmind GeoIP2 license key not accepted

Posted: 06 Jun 2023 13:39
by BOOZy
Mine was generated on the day I posted this, June 1st.

As far as I can deduce as of geopipupdate version 3.1.1 there is a new key format to use.

Re: Maxmind GeoIP2 license key not accepted

Posted: 07 Jun 2023 08:43
by pdwalker
Thank you, that helps.

Yes, there is a new key format and it can be used, but some changes need to be made. There are two ways you can do this:

1/ properly

2/ chuck that, let's just make this work.

Let's get you running by going with #2

- edit /var/www/html/mailscanner/conf.php
- search for 'MAXMIND_LICENSE_KEY'. It is on line 55 of my conf.php file
- change it to your new key
- save your file

edit /usr/bin/mailwatch/tools/Cron_jobs/mailwatch_geoip_update.php
comment out the following 4 lines using a # character at the start of the line 36 in my file, so

Code: Select all

if (!defined('MAXMIND_LICENSE_KEY') || !validateInput(MAXMIND_LICENSE_KEY, "maxmind")) {
    $error_message = __('geoipnokey15') . "\n\n";
    die($error_message);
}
becomes

Code: Select all

#if (!defined('MAXMIND_LICENSE_KEY') || !validateInput(MAXMIND_LICENSE_KEY, "maxmind")) {
#    $error_message = __('geoipnokey15') . "\n\n";
#    die($error_message);
#}
save your file and exit the editor

run the efa geoip update command:
# /usr/bin/mailwatch/tools/Cron_jobs/mailwatch_geoip_update.php
Downloading file, please wait...
GeoIP data file successfully downloaded
Download complete, unpacking files...

GeoIP data file successfully unpacked
Process completed!
and you should be good.

Re: Maxmind GeoIP2 license key not accepted

Posted: 07 Jun 2023 08:57
by pdwalker
Now for the proper fix, assuming the changes above haven't been made, or have been undone.

The new keys seem to have a format of 40 characters, numbers or letters and the underscore character

edit /var/www/html/mailscanner/functions.php. Search for "case 'maxmind':". It is on line 4659 of my file
change the next line from

Code: Select all

if (preg_match('/^([0-9A-Za-z]{12}|[0-9A-Za-z]{16})$/', $input)) {
to

Code: Select all

if (preg_match('/^([0-9A-Za-z]{12}|[0-9A-Za-z]{16}|[0-9A-Za-z_]{40})$/', $input)) {
save the file

edit /var/eFa/lib/eFa-Configure/func_maxmind and look for the following line (line 23 of my file)

Code: Select all

if [[ $LICENSE =~ ^([0-9A-Za-z]{12}|[0-9A-Za-z]{16})$ ]]; then
change it to

Code: Select all

if [[ $LICENSE =~ ^([0-9A-Za-z]{12}|[0-9A-Za-z]{16}|[0-9A-Za-z_]{40})$ ]]; then
then save and exit the file.

You should now be able to use the eFa-Configure program to enter in your new key.

You should also be able to run the /usr/bin/mailwatch/tools/Cron_jobs/mailwatch_geoip_update.php script to update your GeoIP database correctly.

Re: Maxmind GeoIP2 license key not accepted

Posted: 07 Jun 2023 09:21
by pdwalker

Re: Maxmind GeoIP2 license key not accepted

Posted: 07 Jun 2023 09:34
by BOOZy
Thank you.

The code change allows for the new key to be accepted.