Viktor Jaep
Part of the Furniture
Hi Everyone,
I created a modified script (by heavily borrowing from our wonderful community on this) that would randomly connect to 1 of 5 different configured NordVPN endpoints. I'm not going to lie, there continue to be some issues where it gets into an endless "unable to connect" loop, but I'm thinking it's mostly either due to NordVPN not providing the right info, or vpnmgr not completing its refresh correctly? It's basically the same behavior I was seeing if I let vpnmgr reset my connection on a regular basis. @Jack Yaz said he was going to revisit this at a later point when he's going some more time to dedicate to coding/troubleshooting.
So, in vpnmgr, I have 5 different vpnclient configurations set up identically, but each one pointing to a different city... ie. Atlanta, Chicago, etc...
Here's the vpnon.sh script I modified... credits to those who worked on this from this thread: https://www.snbforums.com/threads/vpn-on-off-via-cron-script.55022/ I tried adding some pauses, hoping that vpnmgr may need some time when it comes to querying the NordVPN APIs for updated server lists for these city locations, but it does not seem to have any effect. I'm using a cron job to call this script 1x a week at this point, just to give me some more stability for longer.
The errors I still seem to be getting stem from when vpnmgr query the NordVPN API and try to establish a new connection. I will get an endless loop where it tries to connect back to NordVPN unsuccessfully. Here's a snippet of what I see in the logs:
If anyone has any suggestions on how to make this better, or more reliable, or see where I'm going wrong... I'm all ears.
Thanks!
I created a modified script (by heavily borrowing from our wonderful community on this) that would randomly connect to 1 of 5 different configured NordVPN endpoints. I'm not going to lie, there continue to be some issues where it gets into an endless "unable to connect" loop, but I'm thinking it's mostly either due to NordVPN not providing the right info, or vpnmgr not completing its refresh correctly? It's basically the same behavior I was seeing if I let vpnmgr reset my connection on a regular basis. @Jack Yaz said he was going to revisit this at a later point when he's going some more time to dedicate to coding/troubleshooting.
So, in vpnmgr, I have 5 different vpnclient configurations set up identically, but each one pointing to a different city... ie. Atlanta, Chicago, etc...
Here's the vpnon.sh script I modified... credits to those who worked on this from this thread: https://www.snbforums.com/threads/vpn-on-off-via-cron-script.55022/ I tried adding some pauses, hoping that vpnmgr may need some time when it comes to querying the NordVPN APIs for updated server lists for these city locations, but it does not seem to have any effect. I'm using a cron job to call this script 1x a week at this point, just to give me some more stability for longer.
Code:
#!/bin/sh
service stop_vpnclient1
service stop_vpnclient2
service stop_vpnclient3
service stop_vpnclient4
service stop_vpnclient5
sh /jffs/scripts/service-event start vpnmgrrefreshcacheddata
sleep 10
sh /jffs/scripts/service-event start vpnmgr
sleep 10
# Generate a number between BASE and N, ie.1 and 3 to choose which vpnclient is started
let N=5 #number of configured vpnclients to choose from, max 5 on Asus 86U
let BASE=1 #random numbers start at BASE upto N, ie. 1..3
RANDOM=$(awk 'BEGIN {srand(); print int(32768 * rand())}')
option=$(( RANDOM % N + BASE ))
case ${option} in
1)
service start_vpnclient1
logger -t VPN client1 "on"
;;
2)
service start_vpnclient2
logger -t VPN client2 "on"
;;
3)
service start_vpnclient3
logger -t VPN client3 "on"
;;
4)
service start_vpnclient4
logger -t VPN client4 "on"
;;
5)
service start_vpnclient5
logger -t VPN client5 "on"
;;
esac
exit 0
The errors I still seem to be getting stem from when vpnmgr query the NordVPN API and try to establish a new connection. I will get an endless loop where it tries to connect back to NordVPN unsuccessfully. Here's a snippet of what I see in the logs:
Code:
Dec 29 11:03:42 ovpn-client3[6332]: write UDP: Operation not permitted (code=1)
Dec 29 11:04:28 ovpn-client3[6332]: TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Dec 29 11:04:28 ovpn-client3[6332]: TLS Error: TLS handshake failed
Dec 29 11:04:28 ovpn-client3[6332]: SIGUSR1[soft,tls-error] received, process restarting
Dec 29 11:04:28 ovpn-client3[6332]: Restart pause, 5 second(s)
Dec 29 11:04:33 ovpn-client3[6332]: WARNING: --ping should normally be used with --ping-restart or --ping-exit
Dec 29 11:04:33 ovpn-client3[6332]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Dec 29 11:04:33 ovpn-client3[6332]: Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Dec 29 11:04:33 ovpn-client3[6332]: Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Dec 29 11:04:33 ovpn-client3[6332]: TCP/UDP: Preserving recently used remote address: [AF_INET]37.120.215.83:1194
Dec 29 11:04:33 ovpn-client3[6332]: Socket Buffers: R=[524288->1048576] S=[524288->1048576]
Dec 29 11:04:33 ovpn-client3[6332]: UDP link local: (not bound)
Dec 29 11:04:33 ovpn-client3[6332]: UDP link remote: [AF_INET]37.120.215.83:1194
Dec 29 11:04:33 ovpn-client3[6332]: write UDP: Operation not permitted (code=1)
Dec 29 11:04:35 ovpn-client3[6332]: write UDP: Operation not permitted (code=1)
Dec 29 11:04:39 ovpn-client3[6332]: write UDP: Operation not permitted (code=1)
If anyone has any suggestions on how to make this better, or more reliable, or see where I'm going wrong... I'm all ears.
Thanks!
Last edited: