NordVPN Script for Effortless Server Switching

Currently Looking for some skilled developers with spare time on their hands and patience.

I am pretty new to all of this and I recently got pretty invested in my hobby. I have currently setup my Linksys 3200ACM on OpenWrt 19.07.4. I have tried to use the guide posted at NordVPN I followed it step by step but ended up having to restart and reinstall. Frustrated, mainly because I moved over from DDWRT which FlashRouters provided an app for VPNs, I searched and came across the RouterManager app which works well enough but having to enable password logins was too insecure. So, I am wondering how can I write some script to help me switch servers. I have all ready expanded the storage on my router to help accommodate the server files and there is a similar project hosted on github I tried working this out but again being quiet new to this and doing as much research as I could I didnt get it to work and I reset and reinstalled everything.

Any help would be appreciated I am currently unemployed so I am trying to hone a new skillset.

It there any particular need for scripting?
Just import the VPN profiles and switch them as you want with LuCI.

1 Like

There are 1000's of profiles unless there is a way to automate importing them this would be a non-ideal course of action. I would also like to eventually incorporate some other features. Being new at this I figure that is pretty ambitious....

if you want it automated, there are 2 ways depending if you startup openvpn via /etc/init.d/openvpn
if you use the /etc/init.d/openvpn to start up, then you can read the nordvpn profile and transfer to /etc/config/openvpn using uci commands

or you can startup the openvpn via commandline with a nordvpn profile using


openvpn --daemon --cd "$dir" --config "$config" --dev ${dev} >/dev/null 2>&1

if you are worry about password login, you can also use ssh keys and also restrict ssh shell to nologin
root@repeater:~# cat /etc/dropbear/authorized_keys
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="[ -x /etc/wifi/vpn.sh ] && /etc/wifi/vpn.sh switch" ssh-rsa

Thank you sammo for your answer!

I have setup my SSH and secured it by deleting the old keys and generating new ones.

I am still trying out the github script it is pretty close to what I want/need. Though there is this python3 github script that is a bit more advance though I couldnt get this to work either!

Really the python3 github script is the one I want or something that works similar to the routermanager app or the flashrouters app without it being insecure.

What is the purpose of using so many profiles?
In most cases, a dozen should be more than enough.

See also:

I would agree if I had my own private vpn servers the servers I am using are used by others and there quality varies from day to day

See Also