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

Wrong country report for Oracle cloud and Hurricane electric network #66

Closed
unixfox opened this issue Feb 11, 2021 · 9 comments
Closed
Labels

Comments

@unixfox
Copy link
Member

unixfox commented Feb 11, 2021

searx.be is on networks from Oracle cloud and Hurricane Electric (tunnelbroker).
The reported country on searx.space is US but in fact it should be noted "DE" because the IP is from a server located in Germanay.

I used this tool for checking the real country location of an IP address: https://www.iplocation.net/ip-lookup. For IPv4 address of searx.be the reported country on this tool is Germany and for the IPv6 it's also Germany but only for DB-IP.

I know it's not a simple task to solve because I've read the code, it's using WHOIS for checking the country and Oracle cloud doesn't report the country in the WHOIS.

IP2Location offer a free Geo database which can be used locally and seems at least a bit more accurate than WHOIS, at least on the IPv4 address of searx.be: https://www.ip2location.com/demo

@unixfox unixfox added the bug label Feb 11, 2021
@unixfox unixfox changed the title Wrong country report for Oracle cloud and Hurricane electric Wrong country report for Oracle cloud and Hurricane electric network Feb 11, 2021
@unixfox
Copy link
Member Author

unixfox commented Jun 10, 2021

Now Hetzner network is being classified as US country even tho the server is in Finland.

The IPv6 address of searx.fmac.xyz is recognized as originating from the US even tho it is from Finland.

Affected searx instances: searx.prvcy.eu, searx.xyz, suche.uferwerk.org, search.snopyta.org, searx.7m.ee, recherche.catmargue.org and more.

@dalf
Copy link
Member

dalf commented Jun 12, 2021

With 631d7d1
searx.space uses ip2location.

Moreover, this commit 62bb962 fixes an issue that was (?) blocking some updates.

At least the results are on the right continent.

Also it is possible a hard-coded ; @unixfox , do you think it can useful?

@unixfox
Copy link
Member Author

unixfox commented Jun 12, 2021

Well, the issue is that hard-coding a country is not a good idea with the huge amount of Searx instances in the list. Multiple Searx instance could change their location within a month, and we would have to track that and manually update to the new country every month.

I think at least ip2location give more accurate results. It is still considering that my IPv6 address for searx.be is in the USA, but at least for the IPv4 it's the correct location. And it's the now the correct location for all the instances hosted at Hetzner.

I'll let this issue open in case I find a better IP geolocation provider, but you already did a good job with ip2location. Thank you.

@unixfox
Copy link
Member Author

unixfox commented Jun 12, 2021

I just found a better geolocation database than ip2location, it's DB-IP a free downloadable lite database which is available here: https://db-ip.com/db/download/ip-to-country-lite

They are the only one that offer very accurate country geolocation, at least it detects that my IPv6 address is in the Netherlands instead of in the USA:

[emilien@pcryzen]: ~>$ mmdblookup -f dbip-country-lite-2021-06.mmdb -i 2603:c022:c002:3500::dead:beef

  {
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fa": 
              " اروپا" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ大陸" <utf8_string>
            "ko": 
              "유럽" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          2750405 <uint32>
        "is_in_european_union": 
          true <boolean>
        "iso_code": 
          "NL" <utf8_string>
        "names": 
          {
            "de": 
              "Niederlande" <utf8_string>
            "en": 
              "Netherlands" <utf8_string>
            "es": 
              "Países Bajos (los)" <utf8_string>
            "fa": 
              "هلند" <utf8_string>
            "fr": 
              "Pays-Bas" <utf8_string>
            "ja": 
              "オランダ" <utf8_string>
            "ko": 
              "네덜란드" <utf8_string>
            "pt-BR": 
              "Holanda" <utf8_string>
            "ru": 
              "Нидерланды" <utf8_string>
            "zh-CN": 
              "荷兰" <utf8_string>
          }
      }
  }

It also recognizes the correct location of the IPv6 address for some Searx instances that are hosted at Hetzner. For instance currently the IPv6 address of searx.prvcy.eu is displayed on searx.space as being in Germany but it is in fact in Finland:

[emilien@pcryzen]: ~>$ mmdblookup -f dbip-country-lite-2021-06.mmdb -i 2a01:4f9:c010:1edb::1
  {
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fa": 
              " اروپا" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ大陸" <utf8_string>
            "ko": 
              "유럽" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          660013 <uint32>
        "is_in_european_union": 
          true <boolean>
        "iso_code": 
          "FI" <utf8_string>
        "names": 
          {
            "de": 
              "Finnland" <utf8_string>
            "en": 
              "Finland" <utf8_string>
            "es": 
              "Finlandia" <utf8_string>
            "fa": 
              "فنلاند" <utf8_string>
            "fr": 
              "Finlande" <utf8_string>
            "ja": 
              "フィンランド" <utf8_string>
            "ko": 
              "핀란드" <utf8_string>
            "pt-BR": 
              "Finlândia" <utf8_string>
            "ru": 
              "Финляндия" <utf8_string>
            "zh-CN": 
              "芬兰" <utf8_string>
          }
      }
  }

@dalf
Copy link
Member

dalf commented Jun 13, 2021

  • implemented in b376666
  • searx.space should be updated in few hours.

@unixfox unixfox closed this as completed Jun 13, 2021
@unixfox unixfox reopened this Oct 28, 2021
@unixfox
Copy link
Member Author

unixfox commented Oct 28, 2021

image

It seems like I can again reproduce this issue, not sure what changed that reverted the fix of this issue.

@dalf
Copy link
Member

dalf commented Nov 1, 2021

Fixed. The mmdb file was erased from the cache.

@unixfox
Copy link
Member Author

unixfox commented Dec 17, 2021

image

Is the mmdb out of date? It seems like it's reporting the wrong country ^^.

@dalf
Copy link
Member

dalf commented Dec 17, 2021

Is the mmdb out of date?

Yes.
It is updated now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants