mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
xt_geoip_update: Add support for upstream proxy.
This commit is contained in:
@@ -32,14 +32,30 @@ CSV_FILE=GeoIPCountryWhois.csv
|
|||||||
|
|
||||||
ARCH=LE
|
ARCH=LE
|
||||||
|
|
||||||
|
eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings)
|
||||||
|
|
||||||
function download() {
|
function download() {
|
||||||
echo "Downloading latest GeoIP ruleset..."
|
echo "Downloading latest GeoIP ruleset..."
|
||||||
|
|
||||||
# Create temporary directory.
|
# Create temporary directory.
|
||||||
mkdir -pv $TMP_PATH
|
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.
|
# 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.
|
# Extract files.
|
||||||
unzip $TMP_FILE -d $TMP_PATH
|
unzip $TMP_FILE -d $TMP_PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user