-
-
Save verisgit/a603bd13c77dfe932e25064ffc4782e1 to your computer and use it in GitHub Desktop.
Enable port forwarding from freenas jail using openvpn transmission and PIA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/local/bin/bash | |
# | |
# Script also based on Nodja's script at https://forums.freenas.org/index.php?threads/guide-setting-up-transmission-with-openvpn-and-pia.24566/page-10#post-248580 | |
# | |
# to generate a new client id run | |
# head -n 100 /dev/urandom | md5 -r | tr -d " -" | |
# in any terminal | |
# | |
# usage: ./port_forward.sh | |
# note: you must install bash in the jail first "pkg install bash" | |
# once working setup a cron job in freenas "jexec transmission_1 bash /port_forward.sh" obviously change transmission_1 to match your transmission jail name and port_forward.sh to match your script name and location | |
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
PROGRAM=`basename $0` | |
USER=xxxxxxxxxxx | |
PASSWORD=xxxxxxxxxxx | |
RPCUSER=xxxxxxxxxxx | |
RPCPASSWORD=xxxxxxxxxxx | |
CLIENT_ID=xxxxxxxxxxx | |
local_ip=`ifconfig tun0 | grep "inet " | cut -d\ -f2|tee /tmp/vpn_ip` | |
json=`wget --no-check-certificate -q --post-data="user=$USER&pass=$PASSWORD&client_id=$CLIENT_ID&local_ip=$local_ip" -O - "https://www.privateinternetaccess.com/vpninfo/port_forward_assignment" | head -1` | |
PORTNUM=`echo $json | grep -oE "[0-9]+"` | |
echo $PORTNUM | |
transmission-remote --auth $RPCUSER:$RPCPASSWORD -l -p $PORTNUM | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment