Tip of the day: If you still have users on plaintext port 6667, consider enabling Strict Transport Security to gently move users to SSL/TLS on port 6697. |
GeoIP
UnrealIRCd 6.0.0+ has GeoIP support. It will lookup the country code and AS number for IP addresses of users and show this information to IRCOps, make it available in bans, etc.
How to use
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.
- A hard GLINE:
- In security groups and mask items:
require authentication { mask { country { US; UK; AU; NZ; } reason "Authentication required for your country, please login using SASL"; } }
Similarly, this module also shows the ASN of users and provides Extended server bans like ~asn:64496
. For more information about AS numbers and where they can be used, see the ASN article.
Accuracy
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
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
This is the default module. It uses GeoLite2 data created by MaxMind, available from https://www.maxmind.com. 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
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
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"; } }