LOOK at this post for corrected scripts https://www.snbforums.com/threads/s...ient2-route-up-script-fail.49634/#post-441378
This is for PIA
ClIENT_ID shows up in file. However the JSON does not show up in file. This script just creates an empty file. I am just using echo to debug where things are going wrong and those lines will be deleted once this is running properly.
Code:
#!/bin/sh
#
# Enable port forwarding when using Private Internet Access
#
TRANSUSER=USER
TRANSPASS=PASSWORD
TRANSHOST=IP1
TRANSGUI=IP2
TRANSPORT=IP1PORT
#port_forward_assignment
CLIENT_ID=`head -n 100 /dev/urandom | sha256sum | tr -d " -"`
echo $CLIENT_ID > /tmp/mnt/Merlin/openvpn.d/client.id
JSON=`curl --interface $dev "http://209.222.18.222:2000/?client_id=$CLIENT_ID" 2>/dev/null`
echo $JSON > /tmp/mnt/Merlin/openvpn.d/json
# delete old port from file and add new port
PORT=$(echo $JSON | awk 'BEGIN{r=1;FS="[{}\":]+"} /port/{r=0; print $3} END{exit r}')
echo $PORT > /tmp/mnt/Merlin/openvpn.d/port.forward
#echo "Creating New Forwarding rules for port:"$PORT" on device "$dev" and forwading to "$TRANSHOST
iptables -I FORWARD -i $dev -p udp -d $TRANSHOST --dport $PORT -j ACCEPT
iptables -I FORWARD -i $dev -p tcp -d $TRANSHOST --dport $PORT -j ACCEPT
iptables -t nat -I PREROUTING -i $dev -p udp --dport $PORT -j DNAT --to-destination $TRANSHOST
iptables -t nat -I PREROUTING -i $dev -p tcp --dport $PORT -j DNAT --to-destination $TRANSHOST
#transmission_change_port
transmission-remote $TRANSGUI:$TRANSPORT --auth $TRANSUSER:$TRANSPASS --port $PORT
This is for PIA
ClIENT_ID shows up in file. However the JSON does not show up in file. This script just creates an empty file. I am just using echo to debug where things are going wrong and those lines will be deleted once this is running properly.
Last edited: