/[smecontribs]/rpms/smeserver-xt_geoip/contribs9/smeserver-xt_geoip-1.0.1-bz10860-download_mmdblookup.patch
ViewVC logotype

Annotation of /rpms/smeserver-xt_geoip/contribs9/smeserver-xt_geoip-1.0.1-bz10860-download_mmdblookup.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Sun Jan 19 12:01:47 2020 UTC (4 years, 10 months ago) by michel
Branch: MAIN
CVS Tags: smeserver-xt_geoip-1_0_1-26_el6_sme, smeserver-xt_geoip-1_0_1-25_el6_sme, smeserver-xt_geoip-1_0_1-24_el6_sme, HEAD
* Sat Jan 18 2020 Michel Begue <mab974@gmail.com> 1.0.1-24.sme
- new download script adapted to SME (from xtables-addons) [SME: 10860]
- change geoiplookup to mmdblookup

1 michel 1.1 diff -urN smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/templates/usr/share/xt_geoip/update_base/10All smeserver-xt_geoip-1.0.1/root/etc/e-smith/templates/usr/share/xt_geoip/update_base/10All
2     --- smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/templates/usr/share/xt_geoip/update_base/10All 2020-01-12 22:22:08.000000000 +0400
3     +++ smeserver-xt_geoip-1.0.1/root/etc/e-smith/templates/usr/share/xt_geoip/update_base/10All 1970-01-01 04:00:00.000000000 +0400
4     @@ -1,5 +0,0 @@
5     -cd /usr/share/xt_geoip
6     -if ( /usr/libexec/xtables-addons/xt_geoip_dl )
7     -then
8     - /usr/libexec/xtables-addons/xt_geoip_build GeoIPCountryWhois.csv
9     -fi
10     \ Pas de fin de ligne à la fin du fichier
11     diff -urN smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/templates.metadata/usr/share/xt_geoip/update_base smeserver-xt_geoip-1.0.1/root/etc/e-smith/templates.metadata/usr/share/xt_geoip/update_base
12     --- smeserver-xt_geoip-1.0.1.old/root/etc/e-smith/templates.metadata/usr/share/xt_geoip/update_base 2017-09-13 22:43:37.000000000 +0400
13     +++ smeserver-xt_geoip-1.0.1/root/etc/e-smith/templates.metadata/usr/share/xt_geoip/update_base 1970-01-01 04:00:00.000000000 +0400
14     @@ -1,3 +0,0 @@
15     -UID="root"
16     -GID="root"
17     -PERMS=0750
18     diff -urN smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/geoip_look smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/geoip_look
19     --- smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/geoip_look 2020-01-11 09:35:29.000000000 +0400
20     +++ smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/geoip_look 2020-01-18 19:34:00.675000000 +0400
21     @@ -1,14 +1,11 @@
22     #! /bin/bash
23    
24     -if [ "X$1" == "X" ]; then exit 1; fi
25     -if [ ! $(which geoiplookup 2>/dev/null) ]; then echo "??"; exit 9; fi
26     +for par in "$@"
27     +do
28    
29     -CN=$(geoiplookup $1 2>/dev/null | grep 'GeoIP Country' | sed -e 's/^.*: //' -e 's/,.*$//')
30     -if [ "$CN" = "IP Address not found" ]
31     -then
32     - echo "XX"
33     -else
34     - echo $CN
35     -fi
36     +CN=$(/usr/bin/mmdblookup --file /usr/share/GeoIP/GeoLite2-Country.mmdb --ip $par country iso_code 2>/dev/null | cut -d\" -f2| tr -d '\n')
37     +if [ -z $CN ]; then echo 'XX'; else echo $CN; fi
38     +
39     +done
40    
41    
42     diff -urN smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/update_base smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/update_base
43     --- smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/update_base 1970-01-01 04:00:00.000000000 +0400
44     +++ smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/update_base 2020-01-18 19:26:21.592000000 +0400
45     @@ -0,0 +1,5 @@
46     +cd /usr/share/xt_geoip
47     +if ( ./xt_geoip_dl )
48     +then
49     + /usr/libexec/xtables-addons/xt_geoip_build GeoIPCountryWhois.csv
50     +fi
51     \ Pas de fin de ligne à la fin du fichier
52     diff -urN smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/xt_geoip_dl smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/xt_geoip_dl
53     --- smeserver-xt_geoip-1.0.1.old/root/usr/share/xt_geoip/xt_geoip_dl 1970-01-01 04:00:00.000000000 +0400
54     +++ smeserver-xt_geoip-1.0.1/root/usr/share/xt_geoip/xt_geoip_dl 2020-01-18 19:31:32.377000000 +0400
55     @@ -0,0 +1,30 @@
56     +#!/bin/sh
57     +
58     +# Original script from xtables-addons
59     +# SME specific use of ConfigDB
60     +# replace /usr/libexec/xtables-addons/xt_geoip_dl in /usr/share/xt_geoip/update_base
61     +
62     +status=$(/sbin/e-smith/config getprop geoip status)
63     +if [[ "$status" != "enabled" ]]
64     +then
65     + echo "Geoip is not enabled. No download."
66     + exit 1
67     +fi
68     +
69     +LicenseKey=$(/sbin/e-smith/config getprop geoip LicenseKey)
70     +if [ -z $LicenseKey ]
71     +then
72     + echo "No License Key available. Downloading cannot be performed"
73     + exit 1
74     +fi
75     +
76     +rm -rf GeoLite2-Country-CSV_*
77     +
78     +if ( ! wget -O GeoLite2-Country-CSV.zip -q "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LicenseKey}&suffix=zip" )
79     +then
80     + echo "Error while downloading"
81     + exit 2
82     +fi
83     +
84     +unzip -q GeoLite2-Country-CSV.zip
85     +rm -f GeoLite2-Country-CSV.zip

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed