From d9f47d9b9e5041ee9b9d5fc40471cffe67d2a35e Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Thu, 19 Mar 2015 22:09:24 +0100 Subject: [PATCH] xt_geoip_update: Add support for upstream proxy. --- src/scripts/xt_geoip_update | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 -- 2.39.5