1. added multipath protocol and schema suport

2. added SCTP protocol and schema support
3. added set of NAS models support (Asustor, ReadyNAS, Drobo, QNAP, WD, Synology, Terramaster)
4. moved to fc00::/7 private segment
5. added Windows, MacOS and Linux UI for peers edit and current status
This commit is contained in:
vadym 2022-10-27 22:03:37 +03:00
parent cfa293d189
commit d8a4000141
198 changed files with 8589 additions and 697 deletions

View file

@ -0,0 +1,4 @@
RiV-mesh is an implementation of a fully end-to-end encrypted IPv6 network.
It is lightweight, self-arranging, supported on multiple platforms and
allows pretty much any IPv6-capable application to communicate securely with
other RiV-mesh nodes.

View file

@ -0,0 +1,87 @@
#!/bin/sh
BASE="/usr/local/AppCentral/mesh-nas-asustor"
CONFIG_DIR="/usr/local/etc"
MESH_PACKAGE_LOG=/tmp/mesh.log
echo "start-stop called" >> "$MESH_PACKAGE_LOG"
exec 2>>$MESH_PACKAGE_LOG
set -x
whoami
init ()
{
config_file=${CONFIG_DIR}/mesh.conf
if [ ! -f "$CONFIG_DIR" ]; then
mkdir -p ${CONFIG_DIR}
fi
if [ -f $config_file ]; then
mkdir -p /var/backups
echo "Backing up configuration file to /var/backups/mesh.conf.`date +%Y%m%d`"
cp $config_file /var/backups/mesh.conf.`date +%Y%m%d`
echo "Normalising and updating /etc/mesh.conf"
${BASE}/bin/mesh -useconf -normaliseconf < /var/backups/mesh.conf.`date +%Y%m%d` > $config_file
else
echo "Generating initial configuration file $config_file"
echo "Please familiarise yourself with this file before starting RiV-mesh"
sh -c "umask 0027 && ${BASE}/bin/mesh -genconf > '$config_file'"
fi
#chown -R admin:administrators $config_file
#chmod -R 664 $config_file
#sudo insmod /lib/modules/5.4.x/tun.ko
# Create the necessary file structure for /dev/net/tun
if ( [ ! -c /dev/net/tun ] ); then
if ( [ ! -d /dev/net ] ); then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
chmod 0755 /dev/net/tun
fi
# Load the tun module if not already loaded
if ( !(lsmod | grep -q "^tun\s") ); then
insmod /lib/modules/5.4.x/tun.ko
fi
}
start_service ()
{
init
# Launch the mesh in the background.
${BASE}/bin/mesh -useconffile "$config_file" \
-httpaddress "http://0.0.0.0:19019" \
-wwwroot "$BASE/www" \
-logto "$BASE/var/log/mesh.log" &
return $?
}
stop_service ()
{
pid=`pidof -s mesh`
if [ -z "$pid" ]; then
echo "mesh was not running"
exit 0
fi
kill "$pid"
}
case $1 in
start)
start_service
echo "Running RiV Mesh"
exit 0
;;
stop)
stop_service
echo "Stopped RiV Mesh"
exit 0
;;
*)
exit 1
;;
esac

View file

@ -0,0 +1,6 @@
#!/bin/sh
echo vendor=Asustor
echo vendorOperatingSystemName=ADM
eval $(cat /etc/default/nas.conf | grep '\<Model\>\|\<Version\>' | sed 's/ //g')
echo firmwareVersion="$Version"
echo model=$Model

View file

@ -0,0 +1,76 @@
#!/bin/sh
#exit with zero status on auth success and 1 on error
#
#You can use our cgi to restrict access to RiV Mesh configuration page only for authenticated NAS OS users.
#==========================
#1. use login to verify authenticated NAS OS user
#
#for example:
#
#root@AS6208T-RD:/ # REMOTE_ADDR="127.0.0.1" QUERY_STRING="act=login&apptag=mesh&account=admin&password=admin888" /usr/webman/portal/apis/appCentral/applogin.cgi
#Content-type: text/plain; charset=utf-8
#
#result:
#{ "success": true, "account": "admin", "sid": "yPgoWu95eXxCxZJr", "isAdminGroup": 1, "model": "AS6208T", "hostid": "20-16-01-21-14-01" }
#
#explanation:
#apptag: application name
#account&password: which you want to verify
#
#2. When you finish verifying authenticated NAS OS user, you must logout from NAS.
#
#for example:
#
#root@AS6208T-RD:/ # QUERY_STRING="act=logout&sid=yPgoWu95eXxCxZJr" /usr/webman/portal/apis/login.cgi
#Content-type: text/plain; charset=utf-8
#
#result
#{ "success": true }
#
#explanation:
#sid: same as above (login result)
CACHE="/usr/local/AppCentral/mesh/var/lib/mesh/access_key"
if [ -f $CACHE ] && [ "$(expr $(date +%s) - $(date -r $CACHE +%s))" -lt 3600 ]; then
exit 0
fi
#we want read e.g.:
#HTTP_COOKIE='access_key=sdu45KJFDHksadulf='
IFS=';'
for x in $HTTP_COOKIE
do
eval $x
done
#we want get e.g.:
#access_key='user=admin;pwd=L4edNyoCC15.kDBLIN05480'
access_key=$(echo $access_key | base64 -d)
CACHE="/usr/local/AppCentral/mesh/var/lib/mesh/$access_key"
if [ -f $CACHE ] && [ "$(expr $(date +%s) - $(date -r $CACHE +%s))" -lt 3600 ]; then
exit 0
fi
IFS=';'
for x in $access_key
do
eval $x
done
if [ -z "${user}" ] || [ -z "${pwd}" ]; then
exit 1
fi
export REMOTE_ADDR="127.0.0.1"
export QUERY_STRING="act=login&apptag=mesh&account=${user}&password=${pwd}"
S=$(/usr/webman/portal/apis/appCentral/applogin.cgi | sed '/"sid"/!d; s/\s\+//g; s/.*"sid":"\([^"]*\)".*/\1/')
if [ -z $S ]; then
exit 1
else
export QUERY_STRING="act=logout&sid=$S"
/usr/webman/portal/apis/login.cgi >/dev/null
touch $CACHE
exit 0
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -0,0 +1,35 @@
var ed = {
partnerId: 1422,
applicationName: 'RiV Mesh Asustor ADM App',
nasOSName: 'Asustor ADM',
useAuthNASRichScreen: true,
nasVisitEDWebsiteLogin: "https://github.com/RiV-chain/RiV-mesh",
nasVisitEDWebsiteSignup: "https://github.com/RiV-chain/RiV-mesh",
nasVisitEDWebsiteLoggedin: "https://github.com/RiV-chain/RiV-mesh",
getNasAuthUrl: function () {
return "/";
},
nasLoginCall: function (nasLoginSuccess, nasLoginFailure) {
var d = new Date();
d.setTime(d.getTime() + (10 * 60 * 1000));
document.cookie = "access_key=" + btoa( "user=" + encodeURIComponent($('#nasInputUser').val()) + ";pwd=" + encodeURIComponent($('#nasInputPassword').val()))+ "; expires=" + d.toUTCString() + "; path=/";
$.ajax({url: "api/getself"}).done(function () {
window.location.reload();
}).fail(function () {
ed.nasLogoutCall();
nasLoginFailure();
});
},
nasLogoutCall: function () {
document.cookie = "access_key=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
},
getNasUser: function() {
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
return decodeURIComponent(atob(getCookie('access_key')).split(';')[0].split('=')[1]);
}
};