Fix/improve port forwarding handling
This commit is contained in:
@@ -154,7 +154,7 @@ docker run --rm --network=container:pia alpine:3.10 wget -qO- https://ipinfo.io
|
|||||||
| `BLOCK_NSA` | `off` | `on` or `off`, blocks NSA hostnames |
|
| `BLOCK_NSA` | `off` | `on` or `off`, blocks NSA hostnames |
|
||||||
| `UNBLOCK` | | comma separated string (i.e. `web.com,web2.ca`) to unblock hostnames |
|
| `UNBLOCK` | | comma separated string (i.e. `web.com,web2.ca`) to unblock hostnames |
|
||||||
| `EXTRA_SUBNETS` | | comma separated subnets allowed in the container firewall (i.e. `192.168.1.0/24,192.168.10.121,10.0.0.5/28`) |
|
| `EXTRA_SUBNETS` | | comma separated subnets allowed in the container firewall (i.e. `192.168.1.0/24,192.168.10.121,10.0.0.5/28`) |
|
||||||
| `PORT_FORWARDING` | | Set to `true` to read the forwarded port |
|
| `PORT_FORWARDING` | false | Set to `true` to read the forwarded port |
|
||||||
| `PROXY` | `on` | `on` or `off`, to switch the internal HTTP proxy |
|
| `PROXY` | `on` | `on` or `off`, to switch the internal HTTP proxy |
|
||||||
| `PROXY_LOG_LEVEL` | `Critical` | `Info`, `Warning`, `Error` or `Critical` |
|
| `PROXY_LOG_LEVEL` | `Critical` | `Info`, `Warning`, `Error` or `Critical` |
|
||||||
| `PROXY_PORT` | `8888` | `1024` to `65535` internal port for HTTP proxy |
|
| `PROXY_PORT` | `8888` | `1024` to `65535` internal port for HTTP proxy |
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ exitOnError(){
|
|||||||
|
|
||||||
printf "[INFO] Reading forwarded port\n"
|
printf "[INFO] Reading forwarded port\n"
|
||||||
client_id=`head -n 100 /dev/urandom | sha256sum | tr -d " -"`
|
client_id=`head -n 100 /dev/urandom | sha256sum | tr -d " -"`
|
||||||
exitOnError $?
|
exitOnError $? "Unable to generate Client ID"
|
||||||
json=`wget -qO- "http://209.222.18.222:2000/?client_id=$client_id" 2>/dev/null`
|
json=`wget -qO- "http://209.222.18.222:2000/?client_id=$client_id"`
|
||||||
exitOnError $?
|
|
||||||
if [ "$json" == "" ]; then
|
if [ "$json" == "" ]; then
|
||||||
printf "Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding\n"
|
printf " * Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
port=`echo $json | jq .port`
|
port=`echo $json | jq .port`
|
||||||
port_file="/forwarded_port"
|
port_file="/forwarded_port"
|
||||||
@@ -26,7 +25,7 @@ echo "$port" > $port_file
|
|||||||
printf " * Written forwarded port to $port_file\n"
|
printf " * Written forwarded port to $port_file\n"
|
||||||
ip=`wget -qO- https://diagnostic.opendns.com/myip`
|
ip=`wget -qO- https://diagnostic.opendns.com/myip`
|
||||||
exitOnError $?
|
exitOnError $?
|
||||||
printf " * Forwarded port for IP $ip is: $port\n"
|
printf " * Forwarded port is $port on remote IP $ip\n"
|
||||||
printf " * Detecting target VPN interface..."
|
printf " * Detecting target VPN interface..."
|
||||||
TARGET_PATH="/openvpn/target"
|
TARGET_PATH="/openvpn/target"
|
||||||
vpn_device=$(cat $TARGET_PATH/config.ovpn | grep 'dev ' | cut -d" " -f 2)0
|
vpn_device=$(cat $TARGET_PATH/config.ovpn | grep 'dev ' | cut -d" " -f 2)0
|
||||||
|
|||||||
Reference in New Issue
Block a user