Hi all,
I wrote a script that polls NordVPN API (documentation by Milosz Galazka), for a recommended server by parameters given by the user, then grabs the appropriate .ovpn
profile from NordVPN's servers and sets OpenVPN to use it.
The script uses the bare minimum I was able to get by with, so it can run on pretty much any router that already runs OpenVPN and has approximately 200kB extra (for sending GET
requests, requires package for TLS).
The script can be found at https://github.com/UriShX/vpn-profile-switcher. I believe the README describes pretty much everything, but if I left something out or something needs clarification drop me a note here, or open an issue on Github. PRs are welcome.
I saw a couple of threads on the forum (1, 2) discussing a need for a similar thing, so hopefully it will be useful to others beside me too.
I've been using the script to maintain my connection with the VPN server, by running it from crontab every hour. It could maybe do with a bit of improvements, but it's still better in my opinion then checking the NordVPN's recommendation and setting the profile manually each the load on the server increases.