Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5516] Account for new MaxMind license restrictions #5524

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

garethrees
Copy link
Member

Relevant issue(s)

Fixes #5516

What does this do?

  • Add MAXMIND_LICENSE_KEY config. Allows us to supply a license_key
    parameter to the new direct download URL [2].
  • Update geoip:download_data task to use the new authenticated URL.

Why was this needed?

As of December 30 2019 GeoLite2 databases are no longer served from a
public URL [1]. Downloads now require a license key, obtained through a
free maxmind.com account.

Implementation notes

Screenshots

Notes to reviewer

  • Removed existing db (rm vendor/data/*)
  • Added key to MAXMIND_LICENSE_KEY
  • Downloaded database with rake geoip:download_data
  • Tested some lookups:
# IPs partially redacted
AlaveteliGeoIP.country_code_from_ip('204.xx.xxx.78')
# => "US"
AlaveteliGeoIP.country_code_from_ip('81.xxx.xxx.143')
# => "GB"

Can also see records of download in MaxMind account download history:

Screenshot 2020-01-02 at 10 42 13


[1] https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
[2] https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads

@@ -73,6 +73,7 @@ module AlaveteliConfiguration
:ISO_COUNTRY_CODE => 'GB',
:ISO_CURRENCY_CODE => 'GBP',
:MINIMUM_REQUESTS_FOR_STATISTICS => 100,
:MAXMIND_LICENSE_KEY => '',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring for now to make this commit easier to cherry-pick to older releases.

lib/tasks/geoip.rake Outdated Show resolved Hide resolved
@gbp gbp assigned garethrees and unassigned gbp Jan 6, 2020
As of December 30 2019 GeoLite2 databases are no longer served from a
public URL [1]. Downloads now require a license key, obtained through a
free maxmind.com account.

* Add MAXMIND_LICENSE_KEY config. Allows us to supply a `license_key`
  parameter to the new direct download URL [2].
* Update `geoip:download_data` task to use the new authenticated URL.

Fixes #5516

[1] https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-geolite2-databases/
[2] https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads
@mysociety-pusher mysociety-pusher force-pushed the 5516-maxmind-license-key branch from f44c220 to 2d6672c Compare January 6, 2020 16:00
@mysociety-pusher mysociety-pusher merged commit 2d6672c into develop Jan 6, 2020
@mysociety-pusher mysociety-pusher deleted the 5516-maxmind-license-key branch January 6, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ERROR] SocketError: Failed to open TCP connection to geolite.maxmind.com:443
4 participants