Last active
January 5, 2019 15:47
-
-
Save sander1/d4162f3b3b96418e8b1ac8819e515b13 to your computer and use it in GitHub Desktop.
Update geoip database for xtables
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
#!/bin/sh | |
GEOIP_CSV="https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip" | |
TMPDIR=$(/bin/mktemp -d /tmp/geoipupdate.XXXXXXXXXX) | |
/usr/bin/wget "${GEOIP_CSV}" -O "${TMPDIR}/GeoLite2-Country-CSV.zip" | |
/usr/bin/unzip -j -o -d ${TMPDIR} ${TMPDIR}/GeoLite2-Country-CSV.zip | |
/bin/mkdir -p /usr/share/xt_geoip | |
/usr/bin/perl /usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip -S ${TMPDIR} | |
[ -d "${TMPDIR}" ] && /bin/rm -rf $TMPDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installing Xtables and GeoIP on Ubuntu: Block entire countries on Ubuntu server with Xtables and GeoIP