Last active
September 24, 2024 14:47
-
-
Save TehPeGaSuS/604947957fd7bc7be89d621458339487 to your computer and use it in GitHub Desktop.
UnrealIRCd GeoIP Maxmind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ### | |
| # Set here your license key | |
| ### | |
| licenseKey="LICENSE_KEY" | |
| ### | |
| # Path to the executable | |
| ### | |
| executablePath="/home/ircd/unrealircd/unrealircd" | |
| ### | |
| # Path to UnrealIRCd's data folder | |
| ### | |
| dataFolder="/home/ircd/unrealircd/data" | |
| ### | |
| # DON'T TOUCH ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING | |
| ## | |
| # If you touch the code below and then complain the script "suddenly stopped working" I'll touch you at night. (THANKS thommey) | |
| ### | |
| ### | |
| # Get Country database | |
| ### | |
| wget -O geoip.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${licenseKey}&suffix=tar.gz" && | |
| ### | |
| # Extract ONLY the mmdb database to UnrealIRCd's data folder | |
| ### | |
| tar zxf geoip.tar.gz -C "$dataFolder" --strip-components 1 --wildcards --no-anchored '*.mmdb' && | |
| ### | |
| # Now we need to rehash UnrealIRCd so the new | |
| # database is taken in account | |
| ### | |
| "$executablePath" rehash && | |
| ### | |
| # Let's remove the tar.gz since we don't need it anymore until the next update | |
| rm "$HOME"/geoip.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ATTENTION
UnrealIRCd MUST be compiled/recompiled with libmaxminddb support. To do so, go to UnrealIRCd source folder, type
./Configand answerlibmaxminddbwhen you see the following:Then, just do the usual
makefollowed bymake installand follow the instructions below.Instructions
Edit the script to add your license key from Maxmind and to set the correct paths
Make the script executable with:
unrealircd.confand add the following to the end of the file: