jamesmcm / vopono

Run applications through VPN tunnels with temporary network namespaces
GNU General Public License v3.0
790 stars 44 forks source link

Sync is broke for Mullvad and Mozilla #243

Open mcexit opened 6 months ago

mcexit commented 6 months ago

I don't know if it is permanent, but the URL used to sync WireGuard connections for Mullvad and Mozilla has been causing sync to fail for a couple days. This appears to be primarily because one of the servers in the JSON result is returning null for the socks_name. I tried modifying the code a bit to use Option<String> for socks_name and got further, but then got an error regarding auth_token. I'm not versed in Rust—so the error could have been due to my change—but it is possible the API itself has changed.

I figured out how to use the downloaded zip from my Mullvad account, but the server naming convention is a bit different than before. If you're up for it, then it would be helpful to add some instructions to the user guide or an option to sync "offline" using a zip file or local JSON. I'm happy to submit a PR with instructions for using the zip provided by Mullvad, but I'm not sure if my method exposes any flaws that your method prevents.

jamesmcm commented 6 months ago

Thanks, for the heads-up. Unfortunately it seems Mullvad have deprecrated the APIs for working with the Wireguard keys, etc. - https://api.mullvad.net/app/documentation/

(I think we can actually remove socks_name btw, I don't think it's used anywhere internally in the end).

Yeah, if there's no way to deal with the API then it seems that will be the only approach (a bit like what we do with ProtonVPN). It's mainly a pain for having to create and upload your own wireguard key, etc. manually though.

FWIW I think OpenVPN sync should still be doable though as it just uses the relay lists.

For the zip file are you referring to OpenVPN or Wireguard configs btw?

cg9999 commented 6 months ago

Would https://api.mullvad.net/accounts/v1/#operation/createDevice work as a replacement?

jamesmcm commented 6 months ago

Thanks, it looks good, I just need to look in to how you get the access token.

jamesmcm commented 5 months ago

Cool looking at their code, it seems it is:

$ curl https://api.mullvad.net/auth/v1/token -H "Content-Type: application/json" --request POST --data '{"account_number": "$ACCOUNT_NUMBER"}'

Then it's more or less the same logic as before, just all of the calls need to be updated for the new versions and passing the token differently.

jamesmcm commented 5 months ago

Fixed for Mullvad in #246 , unfortunately I couldn't find Mozilla's API docs online and I don't have an account right now to try it.