pschmitt / pia-tools

Shell script to automate privateinternetaccess port forwarding and starting/stopping transmission when connected/disconnected and other stuff
https://aur.archlinux.org/packages/pia-tools
GNU General Public License v3.0
132 stars 23 forks source link

Single VPN User #17

Closed tempestnano closed 9 years ago

tempestnano commented 9 years ago

I have added the option of tunneling only the traffic from a single user, with transmission being the obvious choice. I am sure this will require some revision, as there must be a cleaner way of doing this that would be clearly visible to a more experienced coder.

Adding VPN_USER=transmission to the conf file will enable this feature. An alternate pia_common (pia_common_single_user) file has been included, but it must be manually copied over pia_common before the pia_tools -s command is executed.

This modification works by using a separate routing table and selective packet marking.

tempestnano commented 9 years ago

Thist works, and it is in use on two of my media centers, but the port curl command fails when it is run as part of the up or route-up commands of openvpn. It works fine if you invoke pia-tools -r by hand. I have a new version in the works that rectifies that using the ExecStartPost command of the service file, but I got carried away. The new version (likely pushed tonight) will allow for multiple different instances (say UK_London for user kodi and Netherlands for transmission). I will branch my work and submit a a second pull request if you like.

tempestnano commented 9 years ago

I have created a branch "multiple_vpn" which adds the ability to invoke multiple single user VPN's, with conf files located in /etc/pia-tools.d/ It may be invoked by using the included piasu@example service. I would appreciate another set of eyes for a sanity check.