PowerDNS/weakforced

Add GeoIPv2 traits to attributes exposed by interface

sshipway opened this issue · 5 comments

With GeoIPv2, a new attribute 'traits' is exposed, which includes is_anonymous_proxy which is, clearly, very useful for certain weakforced rules.
Can we have the 'is_anonymous_proxy' trait exposed by the weakforced as part of the loginrecord structure? The is_in_european_union flag might be useful to some people as well. Ideally, all attributes would be accessible from the loginrecord structure.

e.g.

$ mmdblookup --file /usr/share/GeoIP/GeoIP2-City.mmdb --ip 185.121.168.254
  {
    "registered_country": 
      {
        "geoname_id": 
          3202326 <uint32>
        "is_in_european_union": 
          true <boolean>
        "iso_code": 
          "HR" <utf8_string>
        "names": 
          {
               ...
          }
      }
    "traits": 
      {
        "is_anonymous_proxy": 
          true <boolean>
      }
  }

I can look into adding these new attributes. The way the data is passed to Lua makes this tricky to implement in a generic way (i.e. for any new attribute which is exposed). I'll have a look at ways to implement that

BTW looking at the maxim documentation it seems that the is_anonymous_proxy attribute is deprecated. https://dev.maxmind.com/geoip/geoip2/web-services/#traits

At least the data are still available under different attributes; though it looks like you need to pay for the traits database in order to obtain them as they are no longer in the City database
The is_tor_exit_node and is_anonymous_vpn would be useful too

See #271 - this allows you to lookup any values you like.

Release in v2.2