From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH] GeoIP: Update to 1.25 / changed database path Date: Mon, 16 Jan 2017 16:58:13 +0000 Message-ID: <1484585893.30934.28.camel@ipfire.org> In-Reply-To: <20170111173813.16778-1-matthias.fischer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1116551643534267914==" List-Id: --===============1116551643534267914== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 t= he script? -Michael On Wed, 2017-01-11 at 18:38 +0100, Matthias Fischer wrote: > Database path changed to '/usr/share/GeoIP' >=20 > Signed-off-by: Matthias Fischer > --- > =C2=A0config/rootfiles/common/GeoIP=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0|=C2=A0=C2=A0=C2=A04 +- > =C2=A0lfs/GeoIP=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A015 +-- > =C2=A0src/patches/geoip_1_25_change_database_path.patch | 139 > ++++++++++++++++++++++ > =C2=A03 files changed, 149 insertions(+), 9 deletions(-) > =C2=A0create mode 100644 src/patches/geoip_1_25_change_database_path.patch >=20 > 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 > =C2=A0#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/Geo/IP > =C2=A0#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread- > multi/auto/Geo/IP/PurePerl > =C2=A0#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 > =C2=A0#usr/share/man/man1/geoip-lookup.1 > =C2=A0#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 @@ > =C2=A0#####################################################################= ######## > ## > =C2=A0#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 > =C2=A0# > =C2=A0#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A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 > =C2=A0# > =C2=A0# This program is free software: you can redistribute it and/or > modify=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# > =C2=A0# it under the terms of the GNU General Public License as published > by=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# > @@ -24,8 +24,8 @@ > =C2=A0 > =C2=A0include Config > =C2=A0 > -VER=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D 1.17 > -DATVER=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D 15022015 > +VER=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D 1.25 > +DATVER=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=3D 07012017 > =C2=A0 > =C2=A0THISAPP=C2=A0=C2=A0=C2=A0=C2=A0=3D Geo-IP-PurePerl-$(VER) > =C2=A0DL_FILE=C2=A0=C2=A0=C2=A0=C2=A0=3D $(THISAPP).tar.gz > @@ -42,8 +42,8 @@ objects =3D $(DL_FILE) GeoIP.dat-$(DATVER).gz > =C2=A0$(DL_FILE) =3D $(DL_FROM)/$(DL_FILE) > =C2=A0GeoIP.dat-$(DATVER).gz =3D $(DL_FROM)/GeoIP.dat-$(DATVER).gz > =C2=A0 > -$(DL_FILE)_MD5 =3D 42a6b9d4dd2563a20c8998556216e1de > -GeoIP.dat-$(DATVER).gz_MD5 =3D 508e3c10da15f2722774cf4014863976 > +$(DL_FILE)_MD5 =3D a47a1b71f7cd7c46cca9efcc448e0726 > +GeoIP.dat-$(DATVER).gz_MD5 =3D fac676d18785585568312f30b7851657 > =C2=A0 > =C2=A0install : $(TARGET) > =C2=A0 > @@ -73,11 +73,12 @@ $(subst %,%_MD5,$(objects)) : > =C2=A0$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) > =C2=A0 @$(PREBUILD) > =C2=A0 @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 > =C2=A0 cd $(DIR_APP) && perl Makefile.PL > =C2=A0 cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) > =C2=A0 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 > =C2=A0 cd $(DIR_APP) && chmod 777 /srv/web/ipfire/html/images/flags > =C2=A0 @rm -rf $(DIR_APP) > =C2=A0 @$(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 @@ > +=C2=A0 > +=C2=A0 > + # --- unfortunately we do not know the path so we assume the=C2=A0 > +-# 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 @@ > +=C2=A0=C2=A0=C2=A0# this will be less messy once deprecated new( $path, [$= flags] ) > +=C2=A0=C2=A0=C2=A0# is no longer supported (that's what open() is for) > +=C2=A0 > +-=C2=A0=C2=A0my $def_db_file =3D '/usr/local/share/GeoIP/GeoIP.dat'; > ++=C2=A0=C2=A0my $def_db_file =3D '/usr/share/GeoIP/GeoIP.dat'; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ($^O eq 'NetWare') { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$def_db_file =3D 'sys:/etc/GeoIP/GeoIP.dat'; > +=C2=A0=C2=A0=C2=A0} elsif ($^O eq 'MSWin32') { > +@@ -758,7 +758,7 @@ > + =3Ditem $gi =3D Geo::IP->new( [$flags] ); > +=C2=A0 > + Constructs a new Geo::IP object with the default database located inside > your system's > +-I, typically I. > ++I, typically I. > +=C2=A0 > + 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); > +=C2=A0 > + BEGIN { > +-=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.d= at') { > ++=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (-f $file) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$dat =3D $file; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last; > +--- 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); > +=C2=A0 > + BEGIN { > +-=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/local/share/GeoIP/GeoIP.d= at') { > ++=C2=A0=C2=A0foreach my $file ("GeoIP.dat",'/usr/share/GeoIP/GeoIP.dat') { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (-f $file) { > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$dat =3D $file; > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last; > +--- Changes Tue Mar 30 15:26:38 2010 > ++++ Changes Mon Jan 09 18:57:37 2017 > +@@ -35,7 +35,7 @@ > +=C2=A0 Country, City and Org requests benefit from GEOIP_MEMORY_CACHE and > GEOIP_MMAP_CACHE > +=C2=A0 Add GEOIP_MMAP_CACHE support ( Peter Shipley )=C2=A0 > +=C2=A0 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. > +=C2=A0 > + 1.18=C2=A0=C2=A0January 8th 2007 > +=C2=A0 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 @@ > +=C2=A0 > + The I 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. > ++It queries the GeoIP Country database in C. > +=C2=A0 > + By default it prints the ISO 3166 country code.=C2=A0=C2=A0Use 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 @@ > +=C2=A0 > + my $addr =3D shift; > +=C2=A0 > +-my $gi =3D Geo::IP::PurePerl->new( "/usr/local/share/GeoIP/GeoIPCity.dat", > ++my $gi =3D Geo::IP::PurePerl->new( "/usr/share/GeoIP/GeoIPCity.dat", > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0GEOIP_STANDARD ); > +=C2=A0 > + 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 @@ > +=C2=A0 > + my $addr =3D shift; > +=C2=A0 > +-my $gi =3D Geo::IP::PurePerl- > >new("/usr/local/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD); > ++my $gi =3D Geo::IP::PurePerl- > >new("/usr/share/GeoIP/GeoIPISP.dat",GEOIP_STANDARD); > +=C2=A0 > + my $isp =3D $gi->org_by_name($addr); > +=C2=A0 > +--- geoip-lookup-netspeed Tue Mar 30 15:13:36 2010 > ++++ geoip-lookup-netspeed Mon Jan 09 18:57:53 2017 > +@@ -6,7 +6,7 @@ > +=C2=A0 > + my $addr =3D $ARGV[0]; > +=C2=A0 > +-my $gi =3D Geo::IP::PurePerl- > >new("/usr/local/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD); > ++my $gi =3D Geo::IP::PurePerl- > >new("/usr/share/GeoIP/GeoIPNetSpeed.dat",GEOIP_STANDARD); > +=C2=A0 > + my $netspeed =3D $gi->id_by_addr($addr); > +=C2=A0 > +--- geoip-lookup-org Tue Mar 30 15:13:36 2010 > ++++ geoip-lookup-org Mon Jan 09 18:57:59 2017 > +@@ -7,7 +7,7 @@ > +=C2=A0 > + my $addr =3D shift; > +=C2=A0 > +-my $gi =3D Geo::IP::PurePerl- > >new("/usr/local/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD); > ++my $gi =3D Geo::IP::PurePerl- > >new("/usr/share/GeoIP/GeoIPOrg.dat",GEOIP_STANDARD); > +=C2=A0 > + my $org =3D $gi->org_by_name($addr); > +=C2=A0 > +--- geoip-lookup-region Tue Mar 30 15:13:36 2010 > ++++ geoip-lookup-region Mon Jan 09 18:58:01 2017 > +@@ -10,7 +10,7 @@ > +=C2=A0 > + my $addr =3D $ARGV[0]; > +=C2=A0 > +-my $gi =3D Geo::IP::PurePerl- > >new("/usr/local/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD); > ++my $gi =3D Geo::IP::PurePerl- > >new("/usr/share/GeoIP/GeoIPRegion.dat",GEOIP_STANDARD); > +=C2=A0 > + my ($country,$region) =3D $gi->region_by_name($addr); > +=C2=A0 > +--- 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/GeoLiteCountry/Ge= oIP > .dat.gz > + gunzip GeoIP.dat.gz > +-mv GeoIP.dat /usr/local/share/GeoIP/GeoIP.dat > ++mv GeoIP.dat /usr/share/GeoIP/GeoIP.dat > +=C2=A0 > + perl Makefile.PL > + make --===============1116551643534267914== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC Q2dBR0JRSllmUHVsQUFvSkVJQjU4UDl2a0FrSC9Xc1FBSk5QYmd0UW80TkYwcFVINzJJSXlVZUUK cTNXUWRnM1M1cmtTNjlpcDFpYTZxSXJXek84dytlZENIRnQ0NFN3SkJJdGZsRHozZ1FzazBhcDJG Rmp2R05yZAo5d0Jla3FweHlpUVVzUU5JZndVQ2NrSzlGSnY4OTgzZ3lzVXZ0dDFrZkd4VXg4TmJ2 cGloTnFaZHh0UHd4TXg3CmVVRUpVNlROWWYreHFmM0pTamhBcHZnTU5pSGZua3I5aXkyS2lYN0dz aUtRNkhTWm9rNFlyU09KNmNodFVvaTcKbWNINFVPZGFPSXl6ZHJ0bndKS25nOFhOOGx5M0RFbGlj MTM5OFpWNHpsdDRyaXIrcjRyZjZNWk9jMDdKdWNBWQozeFJHVXhEVkovQ0IxbFhzT0pBcUEwOGFI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