-
Notifications
You must be signed in to change notification settings - Fork 53
Add PIA Wireguard support #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Wireguard with PIA works a bit differently: - Before you connect you must call their addKey API on the server you're connecting to - PersistentKeepalive is necessary as if there is no network traffic your key will be removed
@jamesmcm This is what I have so far. The way things work is during sync we generate a Wireguard config with some placeholder values, then on wireguard_preup we get the values we need then overwrite the config file, then the Wireguard stuff connects using the new config. I wasn't able to keep everything I needed directly in the Wireguard config files so I had to add some stuff to a config.txt which is created on sync. It contains: user, pass, pubkey, mapping of domain->IP (This is needed to validate TLS cert on addKey) Only some small changes were needed outside of pia/wireguard. I also added FromStr and TryInto for Wireguard config but I didn't convert the other usages in the other configs and in the Wireguard setup but it would probably be a good idea for the future. I'll clean up the clippy lints tomorrow but let me know if you have any comments or suggestions. |
Thanks, it looks good, I like the Could you please fix the 8 Clippy issues:
They're mainly just small changes for redundant code - you can run clippy locally with |
Thanks, it looks good - is there anything to add to the README or USERGUIDE docs that users should be aware of? |
I think the main thing would be if you're running in to connection problems then try a sync (server could have been deleted etc) but I think that applies to most providers. Otherwise it should appear identical to a normal wg provider to the user. The connection should last until the server reboots but I haven't had a chance to test leaving it running for a long time yet but it should perform identically to the official https://github.com/pia-foss/manual-connections/blob/master/connect_to_wireguard_with_token.sh |
Does this provide a namespaced environment variable for port forwards? For example, if you are trying to run |
|
Except PIA provides a random port number on each connect init:
|
Oh it seems this PR doesn't do it atm, but I think the best approach if possible would be to get that port (from the API?) and then always open that port (there we can use the existing code) and print it out for the user. I don't have a PIA account to test this with atm though. |
@coquizen The problem with doing it in vopono is that with port forwarding you not only get a random port you also need to confirm that you're still using it every 15 min by polling an API.
qbitPort gets that random port then configures it in qbittorrent but it should be possible to do something similar with transmission
Both scripts are pretty rough but should be enough to get things working for you with a bit of work. If anyone figures out a better way lemme know. |
Thanks, I think we could run that in a thread while vopono is running i.e. the loop on line 133 https://github.com/pia-foss/manual-connections/blob/master/port_forwarding.sh#L133-L156 It's a bit similar to how we handle the Ctrl+C SIGINT signals to ensure it kills all parts. But both modifying the open port dynamically, and creating a thread for this (which should also handle errors) will be a fair amount of PIA-specific code. |
Wireguard with PIA works a bit differently:
you're connecting to
Resolves #9