]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/scripts/xt_geoip_update
correct wrong headline at hardwaregraphs.cgi
[ipfire-2.x.git] / src / scripts / xt_geoip_update
index 294af58e0a60a56b48845225f2644429fa70d452..0aea4d03efff514e9134231ac7cdce294691c367 100644 (file)
 TMP_PATH=$(mktemp -d)
 TMP_FILE=$(mktemp -p $TMP_PATH)
 
-SCRIPT_PATH=/usr/libexec/xtables-addons
+SCRIPT_PATH=/usr/local/bin
 DEST_PATH=/usr/share/xt_geoip
 
-DL_URL=http://geolite.maxmind.com/download/geoip/database
+DL_URL=https://geolite.maxmind.com/download/geoip/database
 DL_FILE=GeoIPCountryCSV.zip
 
 CSV_FILE=GeoIPCountryWhois.csv
 
 ARCH=LE
 
+eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings)
+
 function download() {
        echo "Downloading latest GeoIP ruleset..."
 
        # Create temporary directory.
        mkdir -pv $TMP_PATH
 
+       # Proxy settings.
+       # Check if a proxy should be used.
+       if [[ $UPSTREAM_PROXY ]]; then
+               PROXYSETTINGS="-e http_proxy=http://"
+
+               # Check if authentication against the proxy is configured.
+               if [[ $UPSTREAM_USER && $UPSTREAM_PASSWORD ]]; then
+                       PROXYSETTINGS="$PROXYSETTINGS$UPSTREAM_USER:$UPSTREAM_PASSWORD@"
+               fi
+
+               # Add proxy server.
+               PROXYSETTINGS="$PROXYSETTINGS$UPSTREAM_PROXY"
+       fi
+
        # Get the latest GeoIP database from server.
-       wget $DL_URL/$DL_FILE -O $TMP_FILE
+       wget $DL_URL/$DL_FILE $PROXYSETTINGS -O $TMP_FILE
 
        # Extract files.
        unzip $TMP_FILE -d $TMP_PATH