Skip to content

Instantly share code, notes, and snippets.

@sander1
Last active January 5, 2019 15:47
Show Gist options
  • Save sander1/d4162f3b3b96418e8b1ac8819e515b13 to your computer and use it in GitHub Desktop.
Save sander1/d4162f3b3b96418e8b1ac8819e515b13 to your computer and use it in GitHub Desktop.
Update geoip database for xtables
#!/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
@sander1
Copy link
Author

sander1 commented Jul 17, 2016

Installing Xtables and GeoIP on Ubuntu: Block entire countries on Ubuntu server with Xtables and GeoIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment