Additional port forwarding parameters checks in entrypoint

This commit is contained in:
Quentin McGaw
2019-09-09 12:34:05 -04:00
parent 44ae5632ef
commit f4b618cb94
2 changed files with 16 additions and 2 deletions

View File

@@ -51,6 +51,12 @@ printf "Unbound version: $(unbound -h | grep "Version" | cut -d" " -f2)\n"
printf "Iptables version: $(iptables --version | cut -d" " -f2)\n"
printf "TinyProxy version: $(tinyproxy -v | cut -d" " -f2)\n"
############################################
# BACKWARD COMPATIBILITY PARAMETERS
############################################
[ "$PORT_FORWARDING" == "false" ] && PORT_FORWARDING=on
[ "$PORT_FORWARDING" == "true" ] && PORT_FORWARDING=off
############################################
# CHECK PARAMETERS
############################################
@@ -79,6 +85,11 @@ if [ "$DOT" == "off" ]; then
exit 1
fi
fi
exitIfNotIn PORT_FORWARDING "on,off"
if [ "$PORT_FORWARDING" == "on" && -z "$PORT_FORWARDING_STATUS_FILE" ]; then
printf "PORT_FORWARDING is on but PORT_FORWARDING_STATUS_FILE is not set\n"
exit 1
fi
exitIfNotIn PROXY "on,off"
exitIfNotIn PROXY_LOG_LEVEL "Info,Warning,Error,Critical"
if [ -z $PROXY_PORT ]; then
@@ -130,6 +141,9 @@ if [ "$PROXY" = "on" ]; then
printf " * Web proxy has authentication: $proxy_auth\n"
unset -v proxy_auth
fi
printf "PIA parameters:\n"
printf " * Remote port forwarding: $PORT_FORWARDING\n"
[ "$PORT_FORWARDING" == "on" ] && printf " * Remote port forwarding status file: $PORT_FORWARDING_STATUS_FILE\n"
printf "\n"
#####################################################