marian78
Patron
- Joined
- Jun 30, 2011
- Messages
- 210
hi,
i use openvpn to connect transmission plugin over PIA VPN. But on some trackers i need set portforward over VPN, because annnounce not working.
I wrote small script, that i run in jail. For now i test it. Maybe someone better than i can tune it (im not programer, script guru).
how script work:
1. check if some working file exists
2. install curl package
3. create inique random client id
4. get forwarded port from pia and wrote to work file "vpn_port_opened"
5. set new port in transmission
6. restart transmission
in script you must set:
XXXXXXX - user from PIA
YYYYYYYY - password from PIA
ZZZZ - user for transmission WEB UI
VVVV - password to transmission WEB UI
i use openvpn to connect transmission plugin over PIA VPN. But on some trackers i need set portforward over VPN, because annnounce not working.
I wrote small script, that i run in jail. For now i test it. Maybe someone better than i can tune it (im not programer, script guru).
how script work:
1. check if some working file exists
2. install curl package
3. create inique random client id
4. get forwarded port from pia and wrote to work file "vpn_port_opened"
5. set new port in transmission
6. restart transmission
in script you must set:
XXXXXXX - user from PIA
YYYYYYYY - password from PIA
ZZZZ - user for transmission WEB UI
VVVV - password to transmission WEB UI
Code:
#!/bin/sh # created with help PIA, 27.2.2016 #if exist file with port number, delete it if [ -e "/tmp/vpn_port_opened" ]; then rm /tmp/vpn_port_opened fi #install curl if not installed pkg install curl #create client_id - generate random id. Only do this once to generate a clientid if [ ! -e "/root/.pia_client_id" ]; then head -n 100 /dev/urandom | md5 > ~/.pia_client_id fi curl --insecure --data "user=XXXXXXX&pass=YYYYYYYY&client_id=$(cat /root/.pia_client_id)&local_ip=$(ifconfig tun0 | grep "inet " |cut -d" " -f2 | awk '{print $1}')" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment | grep --only-matching --extended-regexp '([0-9]{4,5})' | tee /tmp/vpn_port_opened /usr/pbi/transmission-amd64/bin/transmission-remote localhost:9091 --auth ZZZZ:VVVV --port $(cat /tmp/vpn_port_opened) service transmission restart
Last edited: