PROJECT IS ARCHIVED. NO LONGER FUNCTIONAL WITH NEW PIA API
This is a script that monitors assigned privateinternetaccess.com port forwarding ports and the bind address, and adjusts the values in Transmission-daemon's settings.json to ensure continuous operation and no information leakage outside the VPN.
Warning
The OpenVPN setup I use routes all internet traffic through the VPN, so if you are expecting to retain SSH access to a remote server, don't use this without modification! I haven't tried to setup a separate network for torrent traffic...but I have locked myself out by starting up OpenVPN on a remote server!
- Linux Server, VPS or LXC container
- Should work with any distro using 'service' or 'systemctl' to start/stop daemons
- PrivateInternetAccess.com account
- You need your User and Password from here
- Good info on port forwarding setup and on generating a client_id
- client_id
- Working OpenVPN setup with privateinternetaccess
- Make sure you use one of the gateways listed there that support port forwarding.
- Working transmission-daemon
- Python (python 2.7+ or python 3+)
Copy script to location of your choice (/usr/local/bin, ~/.local/bin/, etc.)
OR
# python setup.py install
OR$ python setup.py install --user
- Generate client_id and store in a file (e.g. ~/.pia_client_id)
- Copy config.ini.sample to /etc/pia_transmission_monitor/config.ini or ~/.config/pia_transmission_monitor/config.ini
- Edit config.ini as necessary. It should be self-explanatory
- Make sure that the client_id file and the pia_cred file have appropriate permissions to be read by the user running this script.
Use whatever startup mechanism you desire to have port_check.py start at boot time. For example, here is /etc/rc.local on a Debian system:
su -l -c "/home/<user>/.local/bin/port_check.py" <user> &
The script will start and stop openvpn and transmission-daemon as required if the forwarded port changes.
- Experiment with supervisord to manage the port_check.py script. This may make configuration manager (ansible, et. al.) deployment easier