I made a Nordvpn html/script for r7800 with voxel firmware
This is a really basic script to change the nordvpn server from the web gui of the router
After the change it restarts the vpn client .
maybe someone can use it.
//
the 4 files that are needed:
https://github.com/martijnxd/nordvpn-r7800/archive/master.zip
https://github.com/martijnxd/nordvpn-r7800
/etc/openvpn/config/client/Nordvpn.auth
/www/nvpn-addon.htm
/www/cgi-bin/nvpn-addon.cgi
/www/cgi-bin/nvpn-addon.sh
I have replaced /www/license.html, with nvpn-addon.html, so i can now use the license info link in the gui of the router to access this page
enable telnet at http://routerip/debug.htm
login and
create the following file with your user name and password for nordvpn
/etc/openvpn/config/client/nordvpn.auth
/www/nvpn-addon.htm
/www/cgi-bin/nvpn-addon.cgi
and create the shell script file
/www/cgi-bin/nvpn-addon.sh
make the cgi and sh files executuble:
and you can test the script with to http://routerip/nvpn-addon.htm

This is a really basic script to change the nordvpn server from the web gui of the router
After the change it restarts the vpn client .
maybe someone can use it.
//
V2.2
added a stop vpn function
added a stop vpn function
the 4 files that are needed:
https://github.com/martijnxd/nordvpn-r7800/archive/master.zip
https://github.com/martijnxd/nordvpn-r7800
/etc/openvpn/config/client/Nordvpn.auth
/www/nvpn-addon.htm
/www/cgi-bin/nvpn-addon.cgi
/www/cgi-bin/nvpn-addon.sh
I have replaced /www/license.html, with nvpn-addon.html, so i can now use the license info link in the gui of the router to access this page
enable telnet at http://routerip/debug.htm
login and
create the following file with your user name and password for nordvpn
/etc/openvpn/config/client/nordvpn.auth
Code:
user@user.com
password
/www/nvpn-addon.htm
Code:
<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
}
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
input[type=submit] {
background-color: blue;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: right;
}
input[type=submit]:hover {
background-color: lightblue;
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
.col-25 {
float: left;
width: 25%;
margin-top: 6px;
}
.col-75 {
float: left;
width: 75%;
margin-top: 6px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
}
</style>
</head>
<body>
<h2>Nordvpn add-on</h2>
<p>Select country</p>
<div class="container">
<form id ="country" action="cgi-bin/nvpn-addon.cgi" method="get">
<div class="row">
<div class="col-25">
<label for="country">Country</label>
</div>
<div class="col-75">
<select id="countrypd" name="country">
</select>
<script>
let dropdown = document.getElementById('countrypd');
dropdown.length = 0;
let defaultOption = document.createElement('option');
defaultOption.text = 'Choose Country';
dropdown.add(defaultOption);
dropdown.selectedIndex = 0;
const request = new XMLHttpRequest();
request.open('GET','./cgi-bin/nvpn-addon.cgi',true);
request.onload = function() {
if (request.status === 200) {
const data = JSON.parse(request.responseText);
let option;
for (let i = 0; i < data.length; i++) {
option = document.createElement('option');
option.text = data[i].name;
option.value = data[i].id;
dropdown.add(option);
}
} else {
}
}
request.onerror = function() {
console.error('An error occurred fetching the JSON from ' + url);
};
request.send();
</script>
</div>
</div>
<div class="row">
<input type="submit" value="Submit">
</div>
<div class="row">
<div class="col-25">
<label for="country">Stop vpn server</label>
</div>
<div class="row">
<input type="Submit" name="country"value="stop">
</div>
</form>
</div>
</body>
</html>
/www/cgi-bin/nvpn-addon.cgi
Code:
#!/bin/sh
echo "Content-type: text/html"
echo ""
COUNTRY=$(echo ${QUERY_STRING##*=})
if [ ! -n "$COUNTRY" ]
then
echo $(cgi-bin/nvpn-addon.sh)
else
echo Changed server to recommended server
echo restarting...
echo $(cgi-bin/nvpn-addon.sh $COUNTRY)
fi
and create the shell script file
/www/cgi-bin/nvpn-addon.sh
Code:
if [ ! -n "$1" ]
then
curl --silent https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_countries
else
/etc/init.d/openvpn-client stop
/etc/init.d/dnscrypt-proxy-2 stop
fi
if [ $1 != "stop" ]
then
server="$(curl --silent 'https://nordvpn.com/wp-admin/admin-ajax.php?action=servers_recommendations&filters=\{%22country_id%22:'$1'\}' | jq --raw-output 'limit(1;.[])|.hostname')"
wget -O /etc/openvpn/config/client/nordvpn.ovpn https://downloads.nordcdn.com/configs/files/ovpn_legacy/servers/$server.udp1194.ovpn
sed -i 's/auth-user-pass/auth-user-pass nordvpn.auth/g' /etc/openvpn/config/client/nordvpn.ovpn
echo "nice -20" >> /etc/openvpn/config/client/nordvpn.ovpn
echo "sndbuf 393216" >> /etc/openvpn/config/client/nordvpn.ovpn
echo "rcvbuf 393216" >> /etc/openvpn/config/client/nordvpn.ovpn
echo push \"rcvbuf 393216\" >> /etc/openvpn/config/client/nordvpn.ovpn
echo push \"sndbuf 393216\" >> /etc/openvpn/config/client/nordvpn.ovpn
sed -i 's/mssfix 1450/mssfix 1460/g' /etc/openvpn/config/client/nordvpn.ovpn
/etc/init.d/openvpn-client start
/etc/init.d/dnscrypt-proxy-2 start
fi
make the cgi and sh files executuble:
Code:
chmod +x /www/cgi-bin/nvpn-addon.sh
chmod +x /www/cgi-bin/nvpn-addon.cgi
and you can test the script with to http://routerip/nvpn-addon.htm
Last edited: