Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #sets script dir as working dir
- cd "$(dirname "$0")"
- PIA_CERT="ca.rsa.4096.crt"
- PIA_TOKEN=$(cat PIA_TOKEN)
- PIA_SERVER_IP=$(cat PIA_SERVER_IP)
- PIA_WG_CN=$(cat PIA_WG_CN)
- PF_PAYLOAD_RAW=$(cat PF_PAYLOAD_RAW)
- PF_GETSIGNATURE=$(cat PF_GETSIGNATURE)
- PF_PORT=$(cat PF_PORT)
- #binds the port to your wireguard tunnel. This needs to be done at least every 15mins or the you will loose the port, Setup a cron job with '*/14 * * * * root /opt/wireguard/portforwardbind.sh' or where ever you put the scripts
- PF_BIND="$(curl --interface oet1 --CAcert $PIA_CERT --get --silent --show-error --retry 5 --retry-delay 1 --max-time 2 --data-urlencode payload=$PF_PAYLOAD_RAW --data-urlencode signature=$PF_GETSIGNATURE --resolve $PIA_WG_CN:19999:$PIA_SERVER_IP https://$PIA_WG_CN:19999/bindPort)"
- echo $PF_BIND
- #sets up routing for port to our transmission ip bind 192.168.168.168
- iptables -t nat -I PREROUTING -p tcp --dport $PF_PORT -j DNAT --to 192.168.168.168
- iptables -t nat -I PREROUTING -p udp --dport $PF_PORT -j DNAT --to 192.168.168.168
- #allows port through firewall
- iptables -I INPUT -i oet1 -p tcp -d 192.168.168.168 --dport $PF_PORT -j ACCEPT
- iptables -I INPUT -i oet1 -p udp -d 192.168.168.168 --dport $PF_PORT -j ACCEPT
- #updates transmission with port need package 'opkg install transmission-remote' enter you transmission username and pass if used
- transmission-remote -n username:pass -p $PF_PORT
- #unused code to edit transmission settings file with port
- #sed -i 's/.*peer-port.*/ "peer-port": "'$PF_PORT'",/' /opt/transmission/config/settings.json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement