RMerl/asuswrt-merlin — pull request #315 by dodava (2013-04-29 21:30:39+00:00)
Title: Allow compiling of Geolite geoip files for use by the netfilter geoip modules

This patch adds the gcvs2bin program which converts the free Maxmind Geolite geoip CSV files to the binary file required by the netfilter geoip module. I went back and forth between whether this should be implemented as part of the firmware or if it was better being part of entware or optware, neither currently have a package for it. I finally implemented it in the firmware because if the the module is included I figured the tool needed to take advantage of it should be included also. I understand if you have a different opinion.

Once installed you can do cool things like add the following to firewall-start to grab and install the latest geoip files when the router starts and then block SSH connections from non-US ip addresses.

```# install xt_geoip support
wget -q -P /tmp http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip
unzip -q /tmp/GeoIPCountryCSV.zip -d /tmp
mkdir -p /var/geoip
(cd /var/geoip && exec gcsv2bin /tmp/GeoIPCountryWhois.csv)
rm /tmp/GeoIPCountryCSV.zip
rm /tmp/GeoIPCountryWhois.csv
insmod xt_geoip
iptables -I SSHBFP -m geoip ! --src-cc 'US' -j DROP```