Skip to content

New Installer: GeoIP

Ladislav Slezák edited this page Oct 16, 2013 · 1 revision

Using GeoIP service to automatically find out time zone information

GeoIP is the service that finds out country data from given IP address. Using such data, we could preselect locale information (language, keyboard, time zone) for user automatically.

We currently have GeoIP package in openSUSE (in SLE it is included in the additional WebYaST repository, it is needed by nginx).

GeoIP package contains static database (free one downloaded from maxmind.com). It can be queried using command line tool as well with various (Perl/Ruby) bindings. CLI tool supports also IPv6.

It is not big (about 1.5 MB), so the size in inst-sys would not be problem.

Local database looks like a big advantage, since we do not have to query any Internet service.

On the other hand:

  • static database still needs to be updated regularly, as data are changed over time. Package itself provides the updating tool.
  • GeoIP package data do not provide time zone information
  • we need to provide a public IP address

How to get time zone information from country/region data

We might have this or some other table stored locally.

How to find out public IP

GeoIP tools need to have public IP as input, which is not known to systems behind proxy.

We can find out public IP address by asking various public services, such as:

dig @resolver1.opendns.com myip.opendns.com +short
curl ifconfig.me
curl ipecho.net/plain wget -qO- ipecho.net/plain
curl ident.me

Possible problems:

  • Are there legal issues with using external service?
  • Could we overload those services?

If we'd go this way, it would be better to have some dedicated server we can rely on. Could we use Build service redirector? Anyway, this is only a partial problem, better to use a solution for everything, as described in the next part.

Using online services directly

Instead of relying on local database, we can ask online Geo IP services. Network needs to be available anyway, because:

  • it is a requirement of Installer in general
  • needed for resolving public IP in particular

No need to resolve public IPs here, of course.

Examples of public services:

  • curl http://freegeoip.net/json/ - JSON output, nice!
  • curl http://geoip.ubuntu.com/lookup - provides also time zone, yea! No need to have another table for it.

Possible problems (same as in previous section):

  • Are there any legal issues with using external services?
  • Could we rely on their functionality/stability?
  • Again, can we overload them with a huge number of requests? (likely not)

Proposal for implementation team: Ignore local installed package. Use in-house on-line solution that would provide full information just like the Ubuntu servers: country, language, keyboard and time zone. Internally, it can use GeoIP with MaxMind data. Installer only asks our server (location could be provided in control file, with fixed default value) and knows everything.

Could we extend the current mirrorbrain solution? See http://mirrorbrain.org/ So far, mirrorbrain maintainers do not really like such idea.

Other option would be to provide such service via SCC. Or maybe we'd need both, one for openSUSE, one for SLE (SCC). Talk to SCC team if they can provide the service.

Technically, it should be easy lookup to local geoip table and to the table with time zones. Server also needs to keep up-to-date databases.