Yes, please.
On Wed, 2017-01-25 at 08:28 +0100, Stefan Schantl wrote:
Thank you. Merged this patch.
@Stefan: We have a script that regularly updates the GeoIP database for the firewall rules. Why are we not updating GeoIP.dat as well? Could you extend the script?
-Michael
Hello Michael,
we have the "xt_geoip_update" script which is responsible for downloading the latest GeoIPCountry data as a CSV coded file and call the convert script to convert the data into a format which can be used by the xt_geoip module from the iptables-xtables package.
It would be possible to extend this script to also download the "GeoIP.dat" file which is required by this perl module and place it to the correct location.
Is this the way you like to do?
Thanks in advance,
-Stefan
On Wed, 2017-01-11 at 18:38 +0100, Matthias Fischer wrote:
Database path changed to '/usr/share/GeoIP'
Signed-off-by: Matthias Fischer matthias.fischer@ipfire.org
config/rootfiles/common/GeoIP | 4 +- lfs/GeoIP | 15 +-- src/patches/geoip_1_25_change_database_path.patch | 139 ++++++++++++++++++++++ 3 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 src/patches/geoip_1_25_change_database_path.patch
diff --git a/config/rootfiles/common/GeoIP b/config/rootfiles/common/GeoIP index d9b9d1025..d76ba645e 100644 --- a/config/rootfiles/common/GeoIP +++ b/config/rootfiles/common/GeoIP @@ -6,7 +6,7 @@ usr/lib/perl5/site_perl/5.12.3/Geo/IP/PurePerl.pm #usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread- multi/auto/Geo/IP #usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread- multi/auto/Geo/IP/PurePerl #usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread- multi/auto/Geo/IP/PurePerl/.packlist -usr/local/share/GeoIP -usr/local/share/GeoIP/GeoIP.dat +#usr/share/GeoIP +usr/share/GeoIP/GeoIP.dat #usr/share/man/man1/geoip-lookup.1 #usr/share/man/man3/Geo::IP::PurePerl.3 diff --git a/lfs/GeoIP b/lfs/GeoIP index 882d1a078..3e79da544 100644 --- a/lfs/GeoIP +++ b/lfs/GeoIP @@ -1,7 +1,7 @@ ################################################################## ########### ## # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2014 IPFire Team info@ipfire.org # +# Copyright (C) 2007-2017 IPFire Team info@ipfire.org # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -24,8 +24,8 @@ include Config -VER = 1.17 -DATVER = 15022015 +VER = 1.25 +DATVER = 07012017 THISAPP = Geo-IP-PurePerl-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -42,8 +42,8 @@ objects = $(DL_FILE) GeoIP.dat-$(DATVER).gz $(DL_FILE) = $(DL_FROM)/$(DL_FILE) GeoIP.dat-$(DATVER).gz = $(DL_FROM)/GeoIP.dat-$(DATVER).gz -$(DL_FILE)_MD5 = 42a6b9d4dd2563a20c8998556216e1de -GeoIP.dat-$(DATVER).gz_MD5 = 508e3c10da15f2722774cf4014863976 +$(DL_FILE)_MD5 = a47a1b71f7cd7c46cca9efcc448e0726 +GeoIP.dat-$(DATVER).gz_MD5 = fac676d18785585568312f30b7851657 install : $(TARGET) @@ -73,11 +73,12 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && patch -Np0 -i
$(DIR_SRC)/src/patches/geoip_1_25_change_database_path.patch cd $(DIR_APP) && perl Makefile.PL cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) cd $(DIR_APP) && make install
- cd $(DIR_APP) && mkdir -p /usr/local/share/GeoIP && \
zcat $(DIR_DL)/GeoIP.dat-$(DATVER).gz >
/usr/local/share/GeoIP/GeoIP.dat
- cd $(DIR_APP) && mkdir -p /usr/share/GeoIP && \
zcat $(DIR_DL)/GeoIP.dat-$(DATVER).gz >
/usr/share/GeoIP/GeoIP.dat cd $(DIR_APP) && chmod 777 /srv/web/ipfire/html/images/flags @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/patches/geoip_1_25_change_database_path.patch b/src/patches/geoip_1_25_change_database_path.patch new file mode 100644 index 000000000..933e93d28 --- /dev/null +++ b/src/patches/geoip_1_25_change_database_path.patch @@ -0,0 +1,139 @@ +--- lib/Geo/IP/PurePerl.pm Tue Mar 30 15:41:34 2010 ++++ lib/Geo/IP/PurePerl.pm Mon Jan 09 18:58:11 2017 +@@ -129,7 +129,7 @@ + +
- # --- unfortunately we do not know the path so we assume the
+-# default path /usr/local/share/GeoIP ++# default path /usr/share/GeoIP
- # if thats not true, you can set
$Geo::IP::PurePerl::OPEN_TYPE_PATH
- #
- sub open_type {
+@@ -210,7 +210,7 @@ + # this will be less messy once deprecated new( $path, [$flags] ) + # is no longer supported (that's what open() is for) + +- my $def_db_file = '/usr/local/share/GeoIP/GeoIP.dat'; ++ my $def_db_file = '/usr/share/GeoIP/GeoIP.dat'; + if ($^O eq 'NetWare') { + $def_db_file = 'sys:/etc/GeoIP/GeoIP.dat'; + } elsif ($^O eq 'MSWin32') { +@@ -758,7 +758,7 @@
- =item $gi = Geo::IP->new( [$flags] );
+
- Constructs a new Geo::IP object with the default database located
inside your system's +-I<datadir>, typically I</usr/local/share/GeoIP/GeoIP.dat>. ++I<datadir>, typically I</usr/share/GeoIP/GeoIP.dat>. +
- Flags can be set to either GEOIP_STANDARD, or for faster
performance
- (at a cost of using more memory), GEOIP_MEMORY_CACHE.
+--- t/1_lookup.t Tue Mar 30 15:13:37 2010 ++++ t/1_lookup.t Mon Jan 09 18:58:13 2017 +@@ -2,7 +2,7 @@
- use vars qw($dat);
+
- BEGIN {
+- foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.dat') { ++ foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') { + if (-f $file) { + $dat = $file; + last; +--- t/2_namelookup.t Tue Mar 30 15:21:37 2010 ++++ t/2_namelookup.t Mon Jan 09 18:58:21 2017 +@@ -2,7 +2,7 @@
- use vars qw($dat);
+
- BEGIN {
+- foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.dat') { ++ foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') { + if (-f $file) { + $dat = $file; + last; +--- Changes Tue Mar 30 15:26:38 2010 ++++ Changes Mon Jan 09 18:57:37 2017 +@@ -35,7 +35,7 @@ + Country, City and Org requests benefit from GEOIP_MEMORY_CACHE and GEOIP_MMAP_CACHE + Add GEOIP_MMAP_CACHE support ( Peter Shipley ) + Now works with new format of GeoIP ISP +- Corrected path to /usr/local/share/GeoIP/GeoIP.dat in geoip-lookup program. ++ Corrected path to /usr/share/GeoIP/GeoIP.dat in geoip- lookup program. +
- 1.18 January 8th 2007
+ Replaced CS/Serbia and Montenegro with RS/Serbia, removed ZR/Zaire, added ME/Montenegro +--- geoip-lookup Tue Mar 30 15:13:36 2010 ++++ geoip-lookup Mon Jan 09 18:57:44 2017 +@@ -15,7 +15,7 @@ +
- The I<geoip-lookup> program will return the country for the IP
address or
- hostname given as the first command line argument.
+-It queries the GeoIP Country database in C</usr/local/share/GeoIP/GeoIP.dat>. ++It queries the GeoIP Country database in C</usr/share/GeoIP/GeoIP.dat>. +
- By default it prints the ISO 3166 country code. Use the C<-l>
option
- to print the country name.
+--- geoip-lookup-city Tue Mar 30 15:13:36 2010 ++++ geoip-lookup-city Mon Jan 09 18:57:48 2017 +@@ -6,7 +6,7 @@ +
- my $addr = shift;
+ +-my $gi = Geo::IP::PurePerl->new( "/usr/local/share/GeoIP/GeoIPCity.dat", ++my $gi = Geo::IP::PurePerl->new( "/usr/share/GeoIP/GeoIPCity.dat", + GEOIP_STANDARD ); +
- if ($addr) {
+--- geoip-lookup-isp Tue Mar 30 15:13:36 2010 ++++ geoip-lookup-isp Mon Jan 09 18:57:50 2017 +@@ -7,7 +7,7 @@ +
- my $addr = shift;
+ +-my $gi = Geo::IP::PurePerl-
new("/usr/local/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
++my $gi = Geo::IP::PurePerl-
new("/usr/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD);
+
- my $isp = $gi->org_by_name($addr);
+ +--- geoip-lookup-netspeed Tue Mar 30 15:13:36 2010 ++++ geoip-lookup-netspeed Mon Jan 09 18:57:53 2017 +@@ -6,7 +6,7 @@ +
- my $addr = $ARGV[0];
+ +-my $gi = Geo::IP::PurePerl-
new("/usr/local/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
++my $gi = Geo::IP::PurePerl-
new("/usr/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD);
+
- my $netspeed = $gi->id_by_addr($addr);
+ +--- geoip-lookup-org Tue Mar 30 15:13:36 2010 ++++ geoip-lookup-org Mon Jan 09 18:57:59 2017 +@@ -7,7 +7,7 @@ +
- my $addr = shift;
+ +-my $gi = Geo::IP::PurePerl-
new("/usr/local/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
++my $gi = Geo::IP::PurePerl-
new("/usr/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD);
+
- my $org = $gi->org_by_name($addr);
+ +--- geoip-lookup-region Tue Mar 30 15:13:36 2010 ++++ geoip-lookup-region Mon Jan 09 18:58:01 2017 +@@ -10,7 +10,7 @@ +
- my $addr = $ARGV[0];
+ +-my $gi = Geo::IP::PurePerl-
new("/usr/local/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
++my $gi = Geo::IP::PurePerl-
new("/usr/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD);
+
- my ($country,$region) = $gi->region_by_name($addr);
+ +--- INSTALL Tue Mar 30 15:13:36 2010 ++++ INSTALL Mon Jan 09 18:58:05 2017 +@@ -3,7 +3,7 @@
- # fetch latest GeoIP database, updated monthly
- wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCo
untry/GeoIP .dat.gz
- gunzip GeoIP.dat.gz
+-mv GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat ++mv GeoIP.dat /usr/share/GeoIP/GeoIP.dat +
- perl Makefile.PL
- make