From b3ce3bde07750e25fabca14faf18c0e5f0eb74dc Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Sun, 30 Nov 2014 18:49:04 -0500 Subject: pfBlockerNG Beta v0.99 pkg_config.10.xml edits and associated files for Package pfBlockerNG --- config/pfblockerng/geoipupdate.sh | 229 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 config/pfblockerng/geoipupdate.sh (limited to 'config/pfblockerng/geoipupdate.sh') diff --git a/config/pfblockerng/geoipupdate.sh b/config/pfblockerng/geoipupdate.sh new file mode 100644 index 00000000..d9e9ae0c --- /dev/null +++ b/config/pfblockerng/geoipupdate.sh @@ -0,0 +1,229 @@ +#!/bin/sh +# +# pfBlockerNG MaxMind GeoLite GeoIP Updater Script - By BBcan177@gmail.com +# Copyright (C) 2014 BBcan177@gmail.com +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License Version 2 as +# published by the Free Software Foundation. You may not use, modify or +# distribute this program under any other version of the GNU General +# Public License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The GeoLite databases by MaxMind Inc., are distributed under the Creative Commons +# Attribution-ShareAlike 3.0 Unported License. The attribution requirement +# may be met by including the following in all advertising and documentation +# mentioning features of or use of this database. + + +# Folder Locations +pathfetch=/usr/bin/fetch +pathtar=/usr/bin/tar +pathgunzip=/usr/bin/gunzip + +# File Locations +pathdb=/var/db/pfblockerng +pathlog=/var/log/pfblockerng +errorlog=$pathlog/geoip.log +pathgeoipdatgz=$pathdb/GeoIP.dat.gz +pathgeoipdatgzv6=$pathdb/GeoIPv6.dat.gz +pathgeoipdat=$pathdb/GeoIP.dat +pathgeoipdatv6=$pathdb/GeoIPv6.dat +pathgeoipcc=$pathdb/country_continent.csv +pathgeoipcsv4=$pathdb/GeoIPCountryCSV.zip +pathgeoipcsvfinal4=$pathdb/GeoIPCountryWhois.csv +pathgeoipcsv6=$pathdb/GeoIPv6.csv.gz +pathgeoipcsvfinal6=$pathdb/GeoIPv6.csv + +if [ ! -d $pathdb ]; then mkdir $pathdb; fi +if [ ! -d $pathlog ]; then mkdir $pathlog; fi + +# Collect pfSense Version +pfs_version="$(cut -c1-3 /etc/version)" +now=$(date) +echo; echo "$now - Updating pfBlockerNG - Country Database Files" +echo "pfBlockerNG uses GeoLite data created by MaxMind, available from http://www.maxmind.com" +echo "pfSense version: $pfs_version"; echo + + +########## +#Function to update MaxMind GeoIP Binary (For Reputation Process) +binaryupdate() { + +echo " ** Downloading MaxMind GeoLite IPv4 Binary Database (For Reputation/Alerts Processes) **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" + +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipdatgz -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipdatgz + echo; echo " ( MaxMind IPv4 GeoIP.dat has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipdat + echo +else + echo; echo " => MaxMind IPv4 GeoIP.dat Update [ FAILED ]"; echo + echo "MaxMind IPV4 Binary Update FAIL [ $now ]" >> $errorlog +fi + + +##### + +echo; echo " ** Downloading MaxMind GeoLite IPv6 Binary Database (For Reputation/Alerts Processes) **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz" + +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipdatgzv6 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipdatgzv6 + echo; echo " ( MaxMind IPv6 GeoIPv6.dat has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipdatv6 + echo +else + echo; echo " => MaxMind IPv6 GeoIPv6.dat Update [ FAILED ]"; echo + echo "MaxMind IPv6 Binary Update FAIL [ $now ]" >> $errorlog +fi + +} + + +########## +#Function to update MaxMind Country Code Files +csvupdate() { + +# Download Part 1 - CSV IPv4 Database + +echo; echo " ** Downloading MaxMind GeoLite IPv4 CSV Database **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcsv4 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathtar -zxvf $pathgeoipcsv4 -C $pathdb + if [ "$?" -eq "0" ]; then + echo; echo " ( MaxMind GeoIPCountryWhois has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcsvfinal4 + echo + else + echo; echo " => MaxMind IPv4 GeoIPCountryWhois [ FAILED ]"; echo + echo "MaxMind CSV Database Update FAIL - Tar extract [ $now ]" >> $errorlog + fi +else + echo; echo " => MaxMind IPv4 CSV Download [ FAILED ]"; echo + echo "MaxMind CSV Database Update FAIL [ $now ]" >> $errorlog +fi + + +# Download Part 2 - Country Definitions + +echo; echo " ** Downloading MaxMind GeoLite Database Country Definition File **"; echo +URL="http://dev.maxmind.com/static/csv/codes/country_continent.csv" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcc -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + echo; echo " ( MaxMind ISO 3166 Country Codes has been updated. )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcc + echo +else + echo; echo " => MaxMind ISO 3166 Country Codes Update [ FAILED ]"; echo + echo "MaxMind ISO 3166 Country Code Update FAIL [ $now ]" >> $errorlog +fi + +# Download Part 3 - Country Definitions IPV6 + +echo " ** Downloading MaxMind GeoLite IPv6 CSV Database **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcsv6 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipcsv6 + echo; echo " ( MaxMind GeoIPv6.csv has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcsvfinal6 + echo +else + echo; echo " => MaxMind GeoLite IPv6 Update [ FAILED ]"; echo + echo "MaxMind GeoLite IPv6 Update FAIL [ $now ]" >> $errorlog +fi + +} + +########## +# CALL APPROPRIATE PROCESSES using Script Argument $1 + +case $1 in + bu) + binaryupdate + ;; + cu) + csvupdate + ;; + all) + binaryupdate + csvupdate + ;; + *) + exit + ;; +esac +exit \ No newline at end of file -- cgit v1.2.3 From a68f5263bc92a88f92d97ddbdffb49f51514e075 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Sun, 30 Nov 2014 20:15:36 -0500 Subject: Revert "pfBlockerNG Beta v0.99" This reverts commit b3ce3bde07750e25fabca14faf18c0e5f0eb74dc. --- config/pfblockerng/geoipupdate.sh | 229 -------------------------------------- 1 file changed, 229 deletions(-) delete mode 100644 config/pfblockerng/geoipupdate.sh (limited to 'config/pfblockerng/geoipupdate.sh') diff --git a/config/pfblockerng/geoipupdate.sh b/config/pfblockerng/geoipupdate.sh deleted file mode 100644 index d9e9ae0c..00000000 --- a/config/pfblockerng/geoipupdate.sh +++ /dev/null @@ -1,229 +0,0 @@ -#!/bin/sh -# -# pfBlockerNG MaxMind GeoLite GeoIP Updater Script - By BBcan177@gmail.com -# Copyright (C) 2014 BBcan177@gmail.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License Version 2 as -# published by the Free Software Foundation. You may not use, modify or -# distribute this program under any other version of the GNU General -# Public License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The GeoLite databases by MaxMind Inc., are distributed under the Creative Commons -# Attribution-ShareAlike 3.0 Unported License. The attribution requirement -# may be met by including the following in all advertising and documentation -# mentioning features of or use of this database. - - -# Folder Locations -pathfetch=/usr/bin/fetch -pathtar=/usr/bin/tar -pathgunzip=/usr/bin/gunzip - -# File Locations -pathdb=/var/db/pfblockerng -pathlog=/var/log/pfblockerng -errorlog=$pathlog/geoip.log -pathgeoipdatgz=$pathdb/GeoIP.dat.gz -pathgeoipdatgzv6=$pathdb/GeoIPv6.dat.gz -pathgeoipdat=$pathdb/GeoIP.dat -pathgeoipdatv6=$pathdb/GeoIPv6.dat -pathgeoipcc=$pathdb/country_continent.csv -pathgeoipcsv4=$pathdb/GeoIPCountryCSV.zip -pathgeoipcsvfinal4=$pathdb/GeoIPCountryWhois.csv -pathgeoipcsv6=$pathdb/GeoIPv6.csv.gz -pathgeoipcsvfinal6=$pathdb/GeoIPv6.csv - -if [ ! -d $pathdb ]; then mkdir $pathdb; fi -if [ ! -d $pathlog ]; then mkdir $pathlog; fi - -# Collect pfSense Version -pfs_version="$(cut -c1-3 /etc/version)" -now=$(date) -echo; echo "$now - Updating pfBlockerNG - Country Database Files" -echo "pfBlockerNG uses GeoLite data created by MaxMind, available from http://www.maxmind.com" -echo "pfSense version: $pfs_version"; echo - - -########## -#Function to update MaxMind GeoIP Binary (For Reputation Process) -binaryupdate() { - -echo " ** Downloading MaxMind GeoLite IPv4 Binary Database (For Reputation/Alerts Processes) **"; echo -URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" - -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipdatgz -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL - ;; -esac - -if [ "$?" -eq "0" ]; then - $pathgunzip -f $pathgeoipdatgz - echo; echo " ( MaxMind IPv4 GeoIP.dat has been updated )"; echo - echo "Current Date/Timestamp:" - /bin/ls -alh $pathgeoipdat - echo -else - echo; echo " => MaxMind IPv4 GeoIP.dat Update [ FAILED ]"; echo - echo "MaxMind IPV4 Binary Update FAIL [ $now ]" >> $errorlog -fi - - -##### - -echo; echo " ** Downloading MaxMind GeoLite IPv6 Binary Database (For Reputation/Alerts Processes) **"; echo -URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz" - -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipdatgzv6 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL - ;; -esac - -if [ "$?" -eq "0" ]; then - $pathgunzip -f $pathgeoipdatgzv6 - echo; echo " ( MaxMind IPv6 GeoIPv6.dat has been updated )"; echo - echo "Current Date/Timestamp:" - /bin/ls -alh $pathgeoipdatv6 - echo -else - echo; echo " => MaxMind IPv6 GeoIPv6.dat Update [ FAILED ]"; echo - echo "MaxMind IPv6 Binary Update FAIL [ $now ]" >> $errorlog -fi - -} - - -########## -#Function to update MaxMind Country Code Files -csvupdate() { - -# Download Part 1 - CSV IPv4 Database - -echo; echo " ** Downloading MaxMind GeoLite IPv4 CSV Database **"; echo -URL="http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcsv4 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL - ;; -esac - -if [ "$?" -eq "0" ]; then - $pathtar -zxvf $pathgeoipcsv4 -C $pathdb - if [ "$?" -eq "0" ]; then - echo; echo " ( MaxMind GeoIPCountryWhois has been updated )"; echo - echo "Current Date/Timestamp:" - /bin/ls -alh $pathgeoipcsvfinal4 - echo - else - echo; echo " => MaxMind IPv4 GeoIPCountryWhois [ FAILED ]"; echo - echo "MaxMind CSV Database Update FAIL - Tar extract [ $now ]" >> $errorlog - fi -else - echo; echo " => MaxMind IPv4 CSV Download [ FAILED ]"; echo - echo "MaxMind CSV Database Update FAIL [ $now ]" >> $errorlog -fi - - -# Download Part 2 - Country Definitions - -echo; echo " ** Downloading MaxMind GeoLite Database Country Definition File **"; echo -URL="http://dev.maxmind.com/static/csv/codes/country_continent.csv" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcc -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL - ;; -esac - -if [ "$?" -eq "0" ]; then - echo; echo " ( MaxMind ISO 3166 Country Codes has been updated. )"; echo - echo "Current Date/Timestamp:" - /bin/ls -alh $pathgeoipcc - echo -else - echo; echo " => MaxMind ISO 3166 Country Codes Update [ FAILED ]"; echo - echo "MaxMind ISO 3166 Country Code Update FAIL [ $now ]" >> $errorlog -fi - -# Download Part 3 - Country Definitions IPV6 - -echo " ** Downloading MaxMind GeoLite IPv6 CSV Database **"; echo -URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcsv6 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL - ;; -esac - -if [ "$?" -eq "0" ]; then - $pathgunzip -f $pathgeoipcsv6 - echo; echo " ( MaxMind GeoIPv6.csv has been updated )"; echo - echo "Current Date/Timestamp:" - /bin/ls -alh $pathgeoipcsvfinal6 - echo -else - echo; echo " => MaxMind GeoLite IPv6 Update [ FAILED ]"; echo - echo "MaxMind GeoLite IPv6 Update FAIL [ $now ]" >> $errorlog -fi - -} - -########## -# CALL APPROPRIATE PROCESSES using Script Argument $1 - -case $1 in - bu) - binaryupdate - ;; - cu) - csvupdate - ;; - all) - binaryupdate - csvupdate - ;; - *) - exit - ;; -esac -exit \ No newline at end of file -- cgit v1.2.3 From f51fcf2745bbff493b026d00354642b2fcb562bb Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Sun, 30 Nov 2014 21:28:47 -0500 Subject: pkg_config.10.xml Edits and Associated pkg files Edits for pkg_config.10.xml All Associated files for pkg pfBlockerNG --- config/pfblockerng/geoipupdate.sh | 229 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 config/pfblockerng/geoipupdate.sh (limited to 'config/pfblockerng/geoipupdate.sh') diff --git a/config/pfblockerng/geoipupdate.sh b/config/pfblockerng/geoipupdate.sh new file mode 100644 index 00000000..d9e9ae0c --- /dev/null +++ b/config/pfblockerng/geoipupdate.sh @@ -0,0 +1,229 @@ +#!/bin/sh +# +# pfBlockerNG MaxMind GeoLite GeoIP Updater Script - By BBcan177@gmail.com +# Copyright (C) 2014 BBcan177@gmail.com +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License Version 2 as +# published by the Free Software Foundation. You may not use, modify or +# distribute this program under any other version of the GNU General +# Public License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The GeoLite databases by MaxMind Inc., are distributed under the Creative Commons +# Attribution-ShareAlike 3.0 Unported License. The attribution requirement +# may be met by including the following in all advertising and documentation +# mentioning features of or use of this database. + + +# Folder Locations +pathfetch=/usr/bin/fetch +pathtar=/usr/bin/tar +pathgunzip=/usr/bin/gunzip + +# File Locations +pathdb=/var/db/pfblockerng +pathlog=/var/log/pfblockerng +errorlog=$pathlog/geoip.log +pathgeoipdatgz=$pathdb/GeoIP.dat.gz +pathgeoipdatgzv6=$pathdb/GeoIPv6.dat.gz +pathgeoipdat=$pathdb/GeoIP.dat +pathgeoipdatv6=$pathdb/GeoIPv6.dat +pathgeoipcc=$pathdb/country_continent.csv +pathgeoipcsv4=$pathdb/GeoIPCountryCSV.zip +pathgeoipcsvfinal4=$pathdb/GeoIPCountryWhois.csv +pathgeoipcsv6=$pathdb/GeoIPv6.csv.gz +pathgeoipcsvfinal6=$pathdb/GeoIPv6.csv + +if [ ! -d $pathdb ]; then mkdir $pathdb; fi +if [ ! -d $pathlog ]; then mkdir $pathlog; fi + +# Collect pfSense Version +pfs_version="$(cut -c1-3 /etc/version)" +now=$(date) +echo; echo "$now - Updating pfBlockerNG - Country Database Files" +echo "pfBlockerNG uses GeoLite data created by MaxMind, available from http://www.maxmind.com" +echo "pfSense version: $pfs_version"; echo + + +########## +#Function to update MaxMind GeoIP Binary (For Reputation Process) +binaryupdate() { + +echo " ** Downloading MaxMind GeoLite IPv4 Binary Database (For Reputation/Alerts Processes) **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" + +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipdatgz -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipdatgz + echo; echo " ( MaxMind IPv4 GeoIP.dat has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipdat + echo +else + echo; echo " => MaxMind IPv4 GeoIP.dat Update [ FAILED ]"; echo + echo "MaxMind IPV4 Binary Update FAIL [ $now ]" >> $errorlog +fi + + +##### + +echo; echo " ** Downloading MaxMind GeoLite IPv6 Binary Database (For Reputation/Alerts Processes) **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz" + +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipdatgzv6 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipdatgzv6 + echo; echo " ( MaxMind IPv6 GeoIPv6.dat has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipdatv6 + echo +else + echo; echo " => MaxMind IPv6 GeoIPv6.dat Update [ FAILED ]"; echo + echo "MaxMind IPv6 Binary Update FAIL [ $now ]" >> $errorlog +fi + +} + + +########## +#Function to update MaxMind Country Code Files +csvupdate() { + +# Download Part 1 - CSV IPv4 Database + +echo; echo " ** Downloading MaxMind GeoLite IPv4 CSV Database **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcsv4 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathtar -zxvf $pathgeoipcsv4 -C $pathdb + if [ "$?" -eq "0" ]; then + echo; echo " ( MaxMind GeoIPCountryWhois has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcsvfinal4 + echo + else + echo; echo " => MaxMind IPv4 GeoIPCountryWhois [ FAILED ]"; echo + echo "MaxMind CSV Database Update FAIL - Tar extract [ $now ]" >> $errorlog + fi +else + echo; echo " => MaxMind IPv4 CSV Download [ FAILED ]"; echo + echo "MaxMind CSV Database Update FAIL [ $now ]" >> $errorlog +fi + + +# Download Part 2 - Country Definitions + +echo; echo " ** Downloading MaxMind GeoLite Database Country Definition File **"; echo +URL="http://dev.maxmind.com/static/csv/codes/country_continent.csv" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcc -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + echo; echo " ( MaxMind ISO 3166 Country Codes has been updated. )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcc + echo +else + echo; echo " => MaxMind ISO 3166 Country Codes Update [ FAILED ]"; echo + echo "MaxMind ISO 3166 Country Code Update FAIL [ $now ]" >> $errorlog +fi + +# Download Part 3 - Country Definitions IPV6 + +echo " ** Downloading MaxMind GeoLite IPv6 CSV Database **"; echo +URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz" +case $pfs_version in + 1.0|2.0|2.1) + $pathfetch -v -o $pathgeoipcsv6 -T 20 $URL + ;; + 2.2) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL + ;; + *) + $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL + ;; +esac + +if [ "$?" -eq "0" ]; then + $pathgunzip -f $pathgeoipcsv6 + echo; echo " ( MaxMind GeoIPv6.csv has been updated )"; echo + echo "Current Date/Timestamp:" + /bin/ls -alh $pathgeoipcsvfinal6 + echo +else + echo; echo " => MaxMind GeoLite IPv6 Update [ FAILED ]"; echo + echo "MaxMind GeoLite IPv6 Update FAIL [ $now ]" >> $errorlog +fi + +} + +########## +# CALL APPROPRIATE PROCESSES using Script Argument $1 + +case $1 in + bu) + binaryupdate + ;; + cu) + csvupdate + ;; + all) + binaryupdate + csvupdate + ;; + *) + exit + ;; +esac +exit \ No newline at end of file -- cgit v1.2.3 From d5a4097415b702c73b4be62f9381ed5997b724c1 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Sun, 7 Dec 2014 18:43:01 -0500 Subject: MaxMind CC Archive and Shell Script Mods. - Distribute the CC Files from MaxMind in Archive Format. - Mod the Fetch Command Arguments as the 2.2 'Fetch' issue has been resolved. --- config/pfblockerng/geoipupdate.sh | 93 ++++++--------------------------------- 1 file changed, 13 insertions(+), 80 deletions(-) (limited to 'config/pfblockerng/geoipupdate.sh') diff --git a/config/pfblockerng/geoipupdate.sh b/config/pfblockerng/geoipupdate.sh index d9e9ae0c..4b8fbb63 100644 --- a/config/pfblockerng/geoipupdate.sh +++ b/config/pfblockerng/geoipupdate.sh @@ -18,12 +18,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -# The GeoLite databases by MaxMind Inc., are distributed under the Creative Commons +# The GeoLite databases by MaxMind Inc., are distributed under the Creative Commons # Attribution-ShareAlike 3.0 Unported License. The attribution requirement # may be met by including the following in all advertising and documentation # mentioning features of or use of this database. - # Folder Locations pathfetch=/usr/bin/fetch pathtar=/usr/bin/tar @@ -46,33 +45,18 @@ pathgeoipcsvfinal6=$pathdb/GeoIPv6.csv if [ ! -d $pathdb ]; then mkdir $pathdb; fi if [ ! -d $pathlog ]; then mkdir $pathlog; fi -# Collect pfSense Version -pfs_version="$(cut -c1-3 /etc/version)" now=$(date) echo; echo "$now - Updating pfBlockerNG - Country Database Files" -echo "pfBlockerNG uses GeoLite data created by MaxMind, available from http://www.maxmind.com" -echo "pfSense version: $pfs_version"; echo - +echo "pfBlockerNG uses GeoLite data created by MaxMind, available from http://www.maxmind.com"; echo -########## #Function to update MaxMind GeoIP Binary (For Reputation Process) binaryupdate() { +# Download Part 1 - GeoLite IPv4 Binary Database + echo " ** Downloading MaxMind GeoLite IPv4 Binary Database (For Reputation/Alerts Processes) **"; echo URL="http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" - -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipdatgz -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgz -T 20 $URL - ;; -esac - +$pathfetch -v -o $pathgeoipdatgz -T 20 $URL if [ "$?" -eq "0" ]; then $pathgunzip -f $pathgeoipdatgz echo; echo " ( MaxMind IPv4 GeoIP.dat has been updated )"; echo @@ -81,27 +65,14 @@ if [ "$?" -eq "0" ]; then echo else echo; echo " => MaxMind IPv4 GeoIP.dat Update [ FAILED ]"; echo - echo "MaxMind IPV4 Binary Update FAIL [ $now ]" >> $errorlog + echo "MaxMind IPV4 Binary Update FAIL [ $now ]" >> $errorlog fi - -##### +# Download Part 2 - GeoLite IPv6 Binary Database echo; echo " ** Downloading MaxMind GeoLite IPv6 Binary Database (For Reputation/Alerts Processes) **"; echo URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz" - -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipdatgzv6 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipdatgzv6 -T 20 $URL - ;; -esac - +$pathfetch -v -o $pathgeoipdatgzv6 -T 20 $URL if [ "$?" -eq "0" ]; then $pathgunzip -f $pathgeoipdatgzv6 echo; echo " ( MaxMind IPv6 GeoIPv6.dat has been updated )"; echo @@ -112,11 +83,9 @@ else echo; echo " => MaxMind IPv6 GeoIPv6.dat Update [ FAILED ]"; echo echo "MaxMind IPv6 Binary Update FAIL [ $now ]" >> $errorlog fi - } -########## #Function to update MaxMind Country Code Files csvupdate() { @@ -124,18 +93,7 @@ csvupdate() { echo; echo " ** Downloading MaxMind GeoLite IPv4 CSV Database **"; echo URL="http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcsv4 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv4 -T 20 $URL - ;; -esac - +$pathfetch -v -o $pathgeoipcsv4 -T 20 $URL if [ "$?" -eq "0" ]; then $pathtar -zxvf $pathgeoipcsv4 -C $pathdb if [ "$?" -eq "0" ]; then @@ -152,23 +110,11 @@ else echo "MaxMind CSV Database Update FAIL [ $now ]" >> $errorlog fi - # Download Part 2 - Country Definitions echo; echo " ** Downloading MaxMind GeoLite Database Country Definition File **"; echo URL="http://dev.maxmind.com/static/csv/codes/country_continent.csv" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcc -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcc -T 20 $URL - ;; -esac - +$pathfetch -v -o $pathgeoipcc -T 20 $URL if [ "$?" -eq "0" ]; then echo; echo " ( MaxMind ISO 3166 Country Codes has been updated. )"; echo echo "Current Date/Timestamp:" @@ -183,20 +129,9 @@ fi echo " ** Downloading MaxMind GeoLite IPv6 CSV Database **"; echo URL="http://geolite.maxmind.com/download/geoip/database/GeoIPv6.csv.gz" -case $pfs_version in - 1.0|2.0|2.1) - $pathfetch -v -o $pathgeoipcsv6 -T 20 $URL - ;; - 2.2) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL - ;; - *) - $pathfetch -v --no-verify-peer -o $pathgeoipcsv6 -T 20 $URL - ;; -esac - +$pathfetch -v -o $pathgeoipcsv6 -T 20 $URL if [ "$?" -eq "0" ]; then - $pathgunzip -f $pathgeoipcsv6 + $pathgunzip -f $pathgeoipcsv6 echo; echo " ( MaxMind GeoIPv6.csv has been updated )"; echo echo "Current Date/Timestamp:" /bin/ls -alh $pathgeoipcsvfinal6 @@ -205,12 +140,10 @@ else echo; echo " => MaxMind GeoLite IPv6 Update [ FAILED ]"; echo echo "MaxMind GeoLite IPv6 Update FAIL [ $now ]" >> $errorlog fi - } -########## -# CALL APPROPRIATE PROCESSES using Script Argument $1 +# CALL APPROPRIATE PROCESSES using Script Argument $1 case $1 in bu) binaryupdate -- cgit v1.2.3