From: Stefan Schantl Date: Thu, 19 Mar 2015 21:09:24 +0000 (+0100) Subject: xt_geoip_update: Add support for upstream proxy. X-Git-Tag: v2.17-core91~128^2~6^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9f47d9b9e5041ee9b9d5fc40471cffe67d2a35e;p=people%2Fstevee%2Fipfire-2.x.git xt_geoip_update: Add support for upstream proxy. --- diff --git a/src/scripts/xt_geoip_update b/src/scripts/xt_geoip_update index 42e214366f..0ee774470a 100644 --- a/src/scripts/xt_geoip_update +++ b/src/scripts/xt_geoip_update @@ -32,14 +32,30 @@ 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