Tip of the day: Exempt your IP address from bans, just in case you or a fellow IRCOp accidentally GLINES you.

GeoIP

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

UnrealIRCd 6.0.0+ has GeoIP support. It will lookup the country code for IP addresses of users and show this information to IRCOps, make it available in bans, etc.

How to use[edit]

GeoIP is enabled by default and works out of the box. No configuration needed. On boot and REHASH it will fetch the latest GeoIP database (if the current db is older than 14 days).

As an IRCOp, you can view GeoIP information:

  • When a user connects you see it show up as [country: NL] in the connect snomask (+c/+C)
  • If you WHOIS a user

You can use the GeoIP information in:

  • Extended bans: +b ~country:BE to ban everyone from Belgium
  • Extended server bans:
    • A hard GLINE: GLINE ~country:BD Too much spam to gline everyone from Bangladesh
    • A soft gline to force everyone from one country to authenticate to their services account: GLINE %~country:BD Access from this country is restricted. Please authenticate with your services account
    • You can also add exceptions via /ELINE command, lets say you want all Greeks not get G-Lined ELINE ~country:GR G 0 Exception for Greece country users to not get GLINE any more.

Accuracy[edit]

GeoIP is by definition not always accurate. First of all, it may not be available. For example for the LAN IP range 192.168.* you will never see an associated country. Similarly, for some IP's the country could be wrongly detected. That's why, if you use the default module with the default settings, it will fetch the latest version of the database on boot and rehash (if the db is older than 14 days). So these issues can get corrected over time at the GeoIP provider.

Please do NOT contact the UnrealIRCd team if a particular IP does not result in a successful country lookup or if it is the wrong country. There's nothing we can do about this. We don't manage the database ourselves.

Settings[edit]

In UnrealIRCd 6 if you want to use GeoIP features you have 3 options:

  • classic: this is the default. It works out of the box and fetches the latest database on-boot and on rehash. No configuration needed. We recommend everyone to stick with this default.
  • csv: this uses the CSV format. You do not get automatic database updates.
  • maxmind: this uses another library. You do not get automatic database updates. (If you want to use this geoip engine then you need to run ./Config and answer "libmaxminddb" to the GeoIP question)

set::geoip-classic[edit]

This is the default module. It requires no configuration. On boot and REHASH it will fetch the latest GeoIP database if the current one is older than 14 days.

This module has a few options to set database files. Normally you would NOT set these and stick with the defaults. You can, however, choose to override them, for example if you don't want to use the database updates from unrealircd.org or if you have no internet connection:

set {
    geoip-classic {
        ipv4-database "GeoIP.dat";
        ipv6-database "GeoIPv6.dat";
    }
}

set::geoip-csv[edit]

We recommend not to use this module and use the classic GeoIP module with the default settings instead.

If you choose to use this CSV variant then you must download the database files yourself (put them in the data/ directory, keep them up to date, and set the paths:

set {
    geoip-csv {
        ipv4-blocks-file "GeoLite2-Country-Blocks-IPv4.csv"; // don't set for ipv6-only
        ipv6-blocks-file "GeoLite2-Country-Blocks-IPv6.csv"; // don't set for ipv4-only
        countries-file "GeoLite2-Country-Locations-en.csv"; // required
    }
}

set::geoip-maxmind[edit]

We recommend not to use this module and use the classic GeoIP module with the default settings instead.

If you choose to use this libmaxminddb variant then you must download the database file yourself (put them in the data/ directory, keep them up to date, and set the paths:

set {
    geoip-maxmind {
        database "GeoLite2-Country.mmdb";
    }
}