mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-30 01:03:40 -04:00
added self making Sfx auto agent installers. scripts .sh and .cmd to to get everything installed quicker.
taking the initial 5 step or more process to take over remote computer to one. a temporary fix to get more in line with other remote support like software. added some scripts linux & windows to quickly setup the whole system on your server.
This commit is contained in:
parent
665165ebb1
commit
e29ac0e29d
3
installmeshcentral.cmd
Normal file
3
installmeshcentral.cmd
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
cd /D %HOMEPATH%
|
||||
npm install meshcentral node-7z
|
3
installmeshcentral.sh
Normal file
3
installmeshcentral.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
cd ~
|
||||
npm install meshcentral --save node-7z
|
15
installnodejs_7zip.cmd
Normal file
15
installnodejs_7zip.cmd
Normal file
@ -0,0 +1,15 @@
|
||||
@echo off
|
||||
cd /D %HOMEPATH%
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=x86 || set OS=x64
|
||||
powershell (new-object System.Net.WebClient).DownloadFile('http://nodejs.org/dist/v9.3.0/node-v9.3.0-%OS%.msi','node-v9.3.0-%OS%.msi')
|
||||
rem powershell (new-object System.Net.WebClient).DownloadFile('http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.1-signed.msi','mongodb-win32-x86_64-2008plus-ssl-3.6.1-signed.msi')
|
||||
msiexec /i node-v9.3.0-%OS%.msi /passive /norestart /qn
|
||||
rem msiexec /i mongodb-win32-x86_64-2008plus-ssl-3.6.1-signed.msi /passive /norestart /qn
|
||||
del node-v9.3.0-%OS%.msi
|
||||
rem del mongodb-win32-x86_64-2008plus-ssl-3.6.1-signed.msi
|
||||
npm install -g win-7zip rem -g letsencrypt-cli
|
||||
powershell (new-object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/lzma1604.7z','lzma1604.7z')
|
||||
7z x lzma1604.7z -olzma1604
|
||||
copy /B /Y /V lzma1604\bin\*.sfx AppData\Roaming\npm\node_modules\win-7zip\7zip-lite\
|
||||
del lzma1604.7z
|
||||
rmdir /S /Q lzma1604
|
42
installnodejs_7zip.sh
Normal file
42
installnodejs_7zip.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
cd ~
|
||||
sudo -s
|
||||
if command -v apt-get &> /dev/null; then
|
||||
#source /etc/lsb-release
|
||||
#apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
|
||||
#echo "deb http://repo.mongodb.org/apt/$DISTRIB_ID $DISTRIB_CODENAME/mongodb-org/3.6 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
|
||||
#apt-get install -y mongodb-org
|
||||
apt-get install -y python-software-properties
|
||||
curl -sL https://deb.nodesource.com/setup_9.x | bash -
|
||||
apt-get install -y nodejs p7zip-full
|
||||
sfxdirectory='/usr/lib/p7zip/'
|
||||
elif command -v rpm &> /dev/null; then
|
||||
# echo '[mongodb-org-3.6]
|
||||
#name=MongoDB Repository
|
||||
#baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/
|
||||
#gpgcheck=1
|
||||
#enabled=1
|
||||
#gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
|
||||
#' > /etc/yum.repos.d/mongodb-org-3.6.repo
|
||||
curl -sL https://rpm.nodesource.com/setup_9.x | bash -
|
||||
version=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)
|
||||
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-$version.noarch.rpm
|
||||
sfxdirectory='/usr/libexec/p7zip/'
|
||||
if command -v dnf &> /dev/null; then
|
||||
#dnf install -y mongodb-org
|
||||
dnf install -y nodejs p7zip p7zip-plugins
|
||||
else
|
||||
#yum install -y mongodb-org
|
||||
yum install -y nodejs p7zip p7zip-plugins
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $sfxdirectory != "" ] && command -v 7z &> /dev/null; then
|
||||
wget -q http://www.7-zip.org/a/lzma1604.7z
|
||||
7z x lzma1604.7z -olzma1604
|
||||
cp lzma1604/bin/*.sfx $sfxdirectory
|
||||
rm -f lzma1604.7z
|
||||
rm -rf lzma1604
|
||||
fi
|
||||
|
||||
npm install -g forever #-g letsencrypt-cli
|
135
meshuser.js
135
meshuser.js
@ -12,11 +12,60 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
obj.db = db;
|
||||
obj.ws = ws;
|
||||
obj.fs = parent.fs;
|
||||
obj.path = parent.path;
|
||||
obj.certificates = parent.certificates;
|
||||
obj.certificateOperations = require('./certoperations.js').CertificateOperations();
|
||||
obj.args = args;
|
||||
obj.parent = parent;
|
||||
obj.domain = domain;
|
||||
obj.common = parent.common;
|
||||
|
||||
obj.common = parent.common;
|
||||
var sfx = require('node-7z');
|
||||
|
||||
// Create windows sfx mesh agent
|
||||
function createSfxMeshAgent(mesh, sfxmeshfile) {
|
||||
var sfxmodule = '7zS2.sfx';
|
||||
var makesfx = new sfx();
|
||||
var sfx_ext = EscapeHtml(mesh.name) + '.exe';
|
||||
var sfxagent32bit = obj.path.join(__dirname, 'agents', 'MeshService.exe' );
|
||||
var sfxagent64bit = obj.path.join(__dirname, 'agents', 'MeshService64.exe' );
|
||||
|
||||
var sfxagent = obj.path.join(__dirname, 'sfx', 'meshagent_' + sfx_ext);
|
||||
var sfxagentext = obj.path.join(__dirname, 'sfx', 'meshagent.bat' );
|
||||
//var sfxbatfile = "@echo off\r\nreg Query \"HKLM\Hardware\Description\System\CentralProcessor\0\" | find /i 'x86' > NUL && set OS_bit=x86 || set OS_bit=x64\r\nif %OS_bit%=='x86' (\r\n\t rename MeshService.exe meshagent.exe\r\n) else (\r\n\t rename MeshService64.exe meshagent.exe\r\n)\r\nmeshagent.exe\r\n";
|
||||
//obj.fs.writeFileSync(sfxagentext, sfxbatfile, 'utf8');
|
||||
makesfx.add( sfxagent , [ sfxagentext ,sfxagent32bit, sfxagent64bit, sfxmeshfile ], { sfx: sfxmodule } )
|
||||
.then(function () {
|
||||
mesh.path1 = sfxagent;
|
||||
mesh.filename1 = 'meshagent_' + sfx_ext;
|
||||
sfxagent = obj.path.join(__dirname, 'sfx', 'remotesupport_' + sfx_ext);
|
||||
sfxagentext = obj.path.join(__dirname, 'sfx', 'meshinstall.bat' );
|
||||
makesfx.add( sfxagent , [ sfxagentext ,sfxagent32bit, sfxagent64bit, sfxmeshfile ], { sfx: sfxmodule } )
|
||||
.then(function () {
|
||||
mesh.path2 = sfxagent;
|
||||
mesh.filename2 = 'remotesupport_' + sfx_ext;
|
||||
sfxagent = obj.path.join(__dirname, 'sfx', 'uninstallremotesupport_' + sfx_ext);
|
||||
sfxagentext = obj.path.join(__dirname, 'sfx', 'meshuninstall.bat' );
|
||||
makesfx.add( sfxagent , [ sfxagentext ,sfxagent32bit, sfxagent64bit, sfxmeshfile ], { sfx: sfxmodule } )
|
||||
.then(function () {
|
||||
mesh.path3 = sfxagent;
|
||||
mesh.filename3 = 'uninstallremotesupport_' + sfx_ext;
|
||||
obj.db.Set(mesh);
|
||||
obj.fs.unlink(sfxmeshfile, (err) => { if (err) console.log(err); });
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
// makesfx.add([ 'mesh_' + EscapeHtml(mesh.name) ], [ 'meshagent.sh','meshagent_x86','meshagent_x86-64', sfxmeshfile ], { sfx: '7zCon.sfx' });
|
||||
return;
|
||||
}
|
||||
// Send a message to the user
|
||||
//obj.send = function (data) { try { if (typeof data == 'string') { obj.ws.send(new Buffer(data, 'binary')); } else { obj.ws.send(data); } } catch (e) { } }
|
||||
|
||||
@ -427,10 +476,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
if ((command.meshtype == 1) || (command.meshtype == 2)) {
|
||||
// Create a type 1 agent-less Intel AMT mesh.
|
||||
obj.parent.crypto.randomBytes(48, function (err, buf) {
|
||||
var meshid = 'mesh/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$');;
|
||||
var links = {}
|
||||
var meshid = 'mesh/' + domain.id + '/' + buf.toString('base64').replace(/\+/g, '@').replace(/\//g, '$');
|
||||
var links = {};
|
||||
links[user._id] = { name: user.name, rights: 0xFFFFFFFF };
|
||||
var mesh = { type: 'mesh', _id: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, domain: domain.id, links: links };
|
||||
var mesh = { type: 'mesh', _id: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, domain: domain.id, links: links, path1: '', filename1: '', path2: '', filename2: '', path3: '', filename3: '' };
|
||||
obj.db.Set(mesh);
|
||||
obj.parent.meshes[meshid] = mesh;
|
||||
obj.parent.parent.AddEventDispatch([meshid], ws);
|
||||
@ -439,7 +488,31 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
user.subscriptions = obj.parent.subscribe(user._id, ws);
|
||||
obj.db.SetUser(user);
|
||||
obj.parent.parent.DispatchEvent(['*', meshid, user._id], obj, { etype: 'mesh', username: user.name, meshid: meshid, name: command.meshname, mtype: command.meshtype, desc: command.desc, action: 'createmesh', links: links, msg: 'Mesh created: ' + command.meshname, domain: domain.id })
|
||||
});
|
||||
|
||||
// Create mesh settings file for mesh sfx agent
|
||||
obj.agentCertificateHashBase64 = new Buffer(obj.certificateOperations.forge.pki.getPublicKeyFingerprint(obj.certificateOperations.forge.pki.certificateFromPem(obj.certificates.agent.cert).publicKey, { md: obj.certificateOperations.forge.md.sha384.create(), encoding: 'binary' }), 'binary').toString('base64').replace(/\+/g, '@').replace(/\//g, '$');
|
||||
|
||||
if (domain.dns != null) {
|
||||
var WebServerName = domain.dns;
|
||||
} else {
|
||||
var WebServerName = obj.certificates.CommonName;
|
||||
}
|
||||
|
||||
var meshidhex = new Buffer(meshid.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase();
|
||||
var serveridhex = new Buffer(obj.agentCertificateHashBase64.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase();
|
||||
var xdomain = (domain.dns == null) ? domain.id : '';
|
||||
if (xdomain != '') xdomain += "/";
|
||||
var meshsettings = "MeshName=" + mesh.name + "\r\nMeshType=" + mesh.mtype + "\r\nMeshID=0x" + meshidhex + "\r\nServerID=" + serveridhex + "\r\n";
|
||||
if (obj.args.lanonly != true) {
|
||||
meshsettings += "MeshServer=ws" + (obj.args.notls ? '' : 's') + "://" + WebServerName + ":" + obj.args.port + "/" + xdomain + "agent.ashx\r\n";
|
||||
} else {
|
||||
meshsettings += "MeshServer=local";
|
||||
}
|
||||
|
||||
var sfxmeshfile = obj.path.join(__dirname, 'agents', 'meshagent.msh' );
|
||||
obj.fs.writeFileSync(sfxmeshfile, meshsettings, 'utf8');
|
||||
createSfxMeshAgent(mesh, sfxmeshfile);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -453,7 +526,13 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
// Check if this user has rights to do this
|
||||
if (mesh.links[user._id] == null || mesh.links[user._id].rights != 0xFFFFFFFF) return;
|
||||
if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
|
||||
|
||||
|
||||
// Delete mesh SFX files, except the uninstall SFX just in case some remote system still have mesh agent running.
|
||||
if (mesh.path1 != null)
|
||||
obj.fs.unlink(mesh.path1, (err) => { if (err) console.log(err); });
|
||||
if (mesh.path2 != null)
|
||||
obj.fs.unlink(mesh.path2, (err) => { if (err) console.log(err); });
|
||||
|
||||
// Fire the removal event first, because after this, the event will not route
|
||||
obj.parent.parent.DispatchEvent(['*', command.meshid], obj, { etype: 'mesh', username: user.name, meshid: command.meshid, name: command.meshname, action: 'deletemesh', msg: 'Mesh deleted: ' + command.meshname, domain: domain.id })
|
||||
|
||||
@ -473,10 +552,10 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
var meshpath = getServerRootFilePath(mesh);
|
||||
if (meshpath != null) { deleteFolderRec(meshpath); }
|
||||
} catch (e) { }
|
||||
|
||||
|
||||
obj.parent.parent.RemoveEventDispatchId(command.meshid); // Remove all subscriptions to this mesh
|
||||
obj.db.RemoveMesh(command.meshid); // Remove mesh from database
|
||||
delete obj.parent.meshes[command.meshid]; // Remove mesh from memory
|
||||
delete obj.parent.meshes[command.meshid]; // Remove mesh from memory
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -488,10 +567,44 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
|
||||
// Check if this user has rights to do this
|
||||
if (mesh.links[user._id] == null || ((mesh.links[user._id].rights & 1) == 0)) return;
|
||||
if ((command.meshid.split('/').length != 3) || (command.meshid.split('/')[1] != domain.id)) return; // Invalid domain, operation only valid for current domain
|
||||
|
||||
var sfxname = mesh.name;
|
||||
if (command.meshname && command.meshname != '' && command.meshname != mesh.name) { change = 'Mesh name changed from "' + mesh.name + '" to "' + command.meshname + '"'; mesh.name = command.meshname; }
|
||||
if (command.desc != null && command.desc != mesh.desc) { if (change != '') change += ' and description changed'; else change += 'Mesh "' + mesh.name + '" description changed'; mesh.desc = command.desc; }
|
||||
if (change != '') { obj.db.Set(mesh); obj.parent.parent.DispatchEvent(['*', mesh._id, user._id], obj, { etype: 'mesh', username: user.name, meshid: mesh._id, name: mesh.name, mtype: mesh.mtype, desc: mesh.desc, action: 'meshchange', links: mesh.links, msg: change, domain: domain.id }) }
|
||||
if (change != '') {
|
||||
|
||||
if (sfxname != mesh.name) {
|
||||
var makesfx = new sfx();
|
||||
var tempdir = obj.path.join(__dirname, 'tmp' );
|
||||
// extract current mesh policy from Sfx
|
||||
makesfx.extract( mesh.path1, tempdir )
|
||||
.then(function () {
|
||||
// Delete current mesh SFX files
|
||||
if (mesh.path1 != null)
|
||||
obj.fs.unlink(mesh.path1, (err) => { if (err) console.log(err); });
|
||||
if (mesh.path2 != null)
|
||||
obj.fs.unlink(mesh.path2, (err) => { if (err) console.log(err); });
|
||||
if (mesh.path3 != null)
|
||||
obj.fs.unlink(mesh.path3, (err) => { if (err) console.log(err); });
|
||||
// change mesh name
|
||||
var sfxmeshfile = obj.path.join( tempdir, 'meshagent.msh');
|
||||
var data = obj.fs.readFileSync(sfxmeshfile, 'utf8');
|
||||
var result = data.replace( sfxname , mesh.name );
|
||||
obj.fs.writeFileSync(sfxmeshfile, result, 'utf8');
|
||||
// recreate sfx
|
||||
createSfxMeshAgent(mesh, sfxmeshfile);
|
||||
var tempfile = obj.path.join(tempdir, 'meshagent.bat' );
|
||||
obj.fs.unlink(tempfile, (err) => { if (err) console.log(err); });
|
||||
var tempfile2 = obj.path.join(tempdir, 'MeshService.exe' );
|
||||
obj.fs.unlink(tempfile2, (err) => { if (err) console.log(err); });
|
||||
var tempfile3 = obj.path.join(tempdir, 'MeshService64.exe' );
|
||||
obj.fs.unlink(tempfile3, (err) => { if (err) console.log(err); });
|
||||
obj.fs.rmdir(tempdir, (err) => { if (err) console.log(err); });
|
||||
});
|
||||
}
|
||||
|
||||
obj.db.Set(mesh);
|
||||
obj.parent.parent.DispatchEvent(['*', mesh._id, user._id], obj, { etype: 'mesh', username: user.name, meshid: mesh._id, name: mesh.name, mtype: mesh.mtype, desc: mesh.desc, action: 'meshchange', links: mesh.links, msg: change, domain: domain.id });
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
83
package.json
83
package.json
@ -1,29 +1,37 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.1.2-b",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
"Active Management",
|
||||
"Remote Desktop"
|
||||
"_from": "meshcentral",
|
||||
"_id": "meshcentral@0.1.2-b",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-1kyiZmB0h+6WKMPlubpVSGTJ1VA=",
|
||||
"_location": "/meshcentral",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "meshcentral",
|
||||
"name": "meshcentral",
|
||||
"escapedName": "meshcentral",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/meshcentral"
|
||||
],
|
||||
"homepage": "http://meshcommander.com",
|
||||
"description": "Web based remote computer management and file server",
|
||||
"author": "Ylian Saint-Hilaire <ysainthilaire@hotmail.com>",
|
||||
"main": "meshcentral.js",
|
||||
"_resolved": "https://registry.npmjs.org/meshcentral/-/meshcentral-0.1.2-b.tgz",
|
||||
"_shasum": "d64ca266607487ee9628c3e5b9ba554864c9d550",
|
||||
"_spec": "meshcentral",
|
||||
"_where": "C:\\Users\\Lawrence",
|
||||
"author": {
|
||||
"name": "Ylian Saint-Hilaire",
|
||||
"email": "ysainthilaire@hotmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"meshcentral": "./bin/meshcentral"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
"*.js",
|
||||
"license.txt",
|
||||
"readme.txt",
|
||||
"agents",
|
||||
"public",
|
||||
"views",
|
||||
"bin"
|
||||
],
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"archiver": "^1.3.0",
|
||||
"body-parser": "^1.18.2",
|
||||
@ -35,21 +43,46 @@
|
||||
"express-ws": "^2.0.0",
|
||||
"meshcentral": "*",
|
||||
"minimist": "^1.2.0",
|
||||
"mongojs": "^2.4.1",
|
||||
"mongojs": "^2.4.0",
|
||||
"multiparty": "^4.1.3",
|
||||
"nedb": "^1.8.0",
|
||||
"node-7z": "^0.4.0",
|
||||
"node-forge": "^0.6.49",
|
||||
"node-sspi": "^0.2.2",
|
||||
"node-windows": "^0.1.14",
|
||||
"nodemailer": "^4.4.1",
|
||||
"unzip": "^0.1.11",
|
||||
"win-7zip": "^0.1.1",
|
||||
"ws": "^3.2.0",
|
||||
"xmldom": "^0.1.27"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Web based remote computer management and file server",
|
||||
"devDependencies": {},
|
||||
"files": [
|
||||
"*.js",
|
||||
"license.txt",
|
||||
"readme.txt",
|
||||
"agents",
|
||||
"public",
|
||||
"views",
|
||||
"bin"
|
||||
],
|
||||
"homepage": "http://meshcommander.com",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
"Active Management",
|
||||
"Remote Desktop"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "meshcentral.js",
|
||||
"name": "meshcentral",
|
||||
"optionalDependencies": {
|
||||
"mongojs": "^2.4.0",
|
||||
"node-sspi": "^0.2.2",
|
||||
"node-windows": "^0.1.14",
|
||||
"mongojs": "^2.4.0"
|
||||
"win-7zip": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"readme": "readme.txt"
|
||||
"version": "0.1.2-b"
|
||||
}
|
||||
|
@ -1110,8 +1110,10 @@
|
||||
var mesh = meshes[meshid];
|
||||
var meshidx = meshid.substring(5);
|
||||
if (meshidx[0] == '/') meshidx = meshidx.substring(1);
|
||||
var x = "To add a new computer to mesh " + EscapeHtml(mesh.name) + ", download the mesh agent and configuration file and install the agent on the computer to manage.<br /><br />";
|
||||
x += addHtmlValue('Mesh Agent', '<a href="meshagent?id=1" target="_blank">Windows executable (.exe)</a>');
|
||||
var x = "To add a new computer to mesh " + EscapeHtml(mesh.name) + ", download the oneclick SFX application, it has a (.bat) script file, (.exe) mesh agents 32bit & 64bit, and (.msh) configuration file, run the application agent on the computer to manage.<br /><br />For <b>" + EscapeHtml(mesh.name) + "</b> Mesh Policy:<br />";
|
||||
x += addHtmlValue(' Mesh Agent', '<a href="meshsfxagents?idx=0&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX executable (.exe)</a>');
|
||||
x += addHtmlValue(' Oneclick Install', '<a href="meshsfxagents?idx=1&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX Installer</a><br>');
|
||||
x += addHtmlValue(' Oneclick Uninstall', '<a href="meshsfxagents?idx=2&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX Uninstaller</a><br>');
|
||||
setDialogMode(2, "Add Mesh Agent", 1, null, x);
|
||||
}
|
||||
|
||||
|
8
sfx/meshagent.bat
Normal file
8
sfx/meshagent.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS_bit=x86 || set OS_bit=x64
|
||||
if %OS_bit%=="x86" (
|
||||
rename MeshService.exe meshagent.exe
|
||||
) else (
|
||||
rename MeshService64.exe meshagent.exe
|
||||
)
|
||||
meshagent.exe
|
8
sfx/meshinstall.bat
Normal file
8
sfx/meshinstall.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS_bit=x86 || set OS_bit=x64
|
||||
if %OS_bit%=="x86" (
|
||||
rename MeshService.exe meshagent.exe
|
||||
) else (
|
||||
rename MeshService64.exe meshagent.exe
|
||||
)
|
||||
meshagent.exe -fullinstall
|
8
sfx/meshuninstall.bat
Normal file
8
sfx/meshuninstall.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS_bit=x86 || set OS_bit=x64
|
||||
if %OS_bit%=="x86" (
|
||||
rename MeshService.exe meshagent.exe
|
||||
) else (
|
||||
rename MeshService64.exe meshagent.exe
|
||||
)
|
||||
meshagent.exe -fulluninstall
|
17
startmeshcentral.cmd
Normal file
17
startmeshcentral.cmd
Normal file
@ -0,0 +1,17 @@
|
||||
@echo off
|
||||
if "%1"=="" (
|
||||
set PORT=443
|
||||
) else (
|
||||
if not "%1"=="install" set PORT=%1
|
||||
)
|
||||
|
||||
if "%2"=="" (
|
||||
set RPORT=80
|
||||
) else (
|
||||
set RPORT=%2
|
||||
)
|
||||
|
||||
cd /D %HOMEPATH%
|
||||
if "%1"=="install" node node_modules/meshcentral/meshcentral.js --install --cert %USERDOMAIN%
|
||||
if exist meshcentral-data/webserver-cert-private.key if not "%1"=="install" node node_modules/meshcentral/meshcentral.js --port %PORT% --redirport %RPORT%
|
||||
if not exist meshcentral-data/webserver-cert-private.key if not "%1"=="install" node node_modules/meshcentral/meshcentral.js --cert %USERDOMAIN% --port %PORT% --redirport %RPORT%
|
32
startmeshcentral.sh
Normal file
32
startmeshcentral.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
if [ $1 == "" ] ; then
|
||||
PORT=444
|
||||
else
|
||||
PORT=$1
|
||||
fi
|
||||
|
||||
if [ $2 == "" ]; then
|
||||
RPORT=81
|
||||
else
|
||||
RPORT=$2
|
||||
fi
|
||||
|
||||
cd ~
|
||||
npmbin=$(which node)
|
||||
$npmbin install meshcentral
|
||||
foreverbin=$(which forever)
|
||||
$foreverbin start node_modules/meshcentral/meshcentral.js --cert $HOSTNAME
|
||||
sleep 10
|
||||
$foreverbin stop node_modules/meshcentral/meshcentral.js
|
||||
if [ -f ssl.key ]; then
|
||||
ln -sf ssl.key node_modules/.meshcentral-data/agentserver-cert-private.key
|
||||
ln -sf ssl.cert node_modules/.meshcentral-data/agentserver-cert-public.crt
|
||||
ln -sf ssl.key node_modules/.meshcentral-data/root-cert-private.key
|
||||
ln -sf ssl.cert node_modules/.meshcentral-data/root-cert-public.crt
|
||||
ln -sf ssl.key node_modules/.meshcentral-data/webserver-cert-private.key
|
||||
ln -sf ssl.cert node_modules/.meshcentral-data/webserver-cert-public.crt
|
||||
ln -sf ssl.key node_modules/.meshcentral-data/mpsserver-cert-private.key
|
||||
ln -sf ssl.cert node_modules/.meshcentral-data/mpsserver-cert-public.crt
|
||||
fi
|
||||
$foreverbin start node_modules/meshcentral/meshcentral.js --port $PORT --redirport $RPORT
|
||||
|
@ -1569,12 +1569,13 @@
|
||||
var meshidx = meshid.substring(5);
|
||||
if (meshidx[0] == '/') meshidx = meshidx.substring(1);
|
||||
var x = "";
|
||||
x += addHtmlValue('Operating System', '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=2>Windows (UnInstall)</option><option value=3>Linux (UnInstall)</option></select>') + '<hr>';
|
||||
x += addHtmlValue('Operating System', '<select id=aginsSelect onchange=addAgentToMeshClick() style=width:236px><option value=0>Windows</option><option value=1>Linux</option><option value=3>Linux (UnInstall)</option></select>') + '<hr>';
|
||||
|
||||
// Windows agent install
|
||||
x += "<div id=agins_windows>To add a new computer to mesh " + EscapeHtml(mesh.name) + ", download the mesh agent and configuration file and install the agent on the computer to manage.<br /><br />";
|
||||
x += addHtmlValue('Mesh Agent', '<a href="meshagents?id=3" target="_blank">Windows executable (.exe)</a>');
|
||||
x += addHtmlValue('Settings File', '<a href="meshsettings?id=' + meshid.split('/')[2] + '" target="_blank">' + EscapeHtml(mesh.name) + ' settings (.msh)</a>');
|
||||
x += "<div id=agins_windows>To add a new computer to mesh <b>" + EscapeHtml(mesh.name) + "</b>, download the oneclick SFX application, it has a (.bat) script file, (.exe) mesh agents 32bit & 64bit, and (.msh) configuration file, run the application agent on the computer to manage.<br /><br />For <b>" + EscapeHtml(mesh.name) + "</b> Mesh Policy:<br />";
|
||||
x += addHtmlValue(' Mesh Agent', '<a href="meshsfxagents?idx=0&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX executable (.exe)</a>');
|
||||
x += addHtmlValue(' Oneclick Install', '<a href="meshsfxagents?idx=1&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX Installer</a><br>');
|
||||
x += addHtmlValue(' Oneclick Uninstall', '<a href="meshsfxagents?idx=2&id=' + meshid.split('/')[2] + '" target="_blank">Windows SFX Uninstaller</a><br>');
|
||||
x += "</div>";
|
||||
|
||||
// Linux agent install
|
||||
@ -1582,11 +1583,6 @@
|
||||
x += '<textarea id=agins_linux_area rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
|
||||
x += "</div>";
|
||||
|
||||
// Windows agent uninstall
|
||||
x += "<div id=agins_windows_un style=display:none>To remove a mesh agent, download the file below, run it and click \"uninstall\".<br /><br />";
|
||||
x += addHtmlValue('Mesh Agent', '<a href="meshagents?id=3" target="_blank">Windows executable (.exe)</a>');
|
||||
x += "</div>";
|
||||
|
||||
// Linux agent uninstall
|
||||
x += "<div id=agins_linux_un style=display:none>To remove a mesh agent, run the following command. Root credentails will be needed:<br />";
|
||||
x += '<textarea id=agins_linux_area_un rows=2 cols=20 readonly=readonly style=width:100%;resize:none;height:120px;overflow:scroll;font-size:12px readonly></textarea>';
|
||||
|
29
webserver.js
29
webserver.js
@ -1486,7 +1486,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
|
||||
if (domain.dns != null) return domain.dns;
|
||||
return obj.certificates.CommonName;
|
||||
}
|
||||
|
||||
|
||||
// Handle a request to download a mesh settings
|
||||
obj.handleMeshSettingsRequest = function (req, res) {
|
||||
var domain = checkUserIpAddress(req, res);
|
||||
@ -1516,7 +1516,31 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
|
||||
res.send(meshsettings);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Handle a request to download a mesh sfx agent
|
||||
obj.handleMeshSfxAgentRequest = function (req, res) {
|
||||
var domain = checkUserIpAddress(req, res);
|
||||
if (domain == null) return;
|
||||
|
||||
obj.db.Get('mesh/' + domain.id + '/' + req.query.id, function (err, meshes) {
|
||||
if (meshes.length != 1) { res.sendStatus(401); return; }
|
||||
var mesh = meshes[0];
|
||||
|
||||
if ((req.query.id != null) && (req.query.idx != null)) {
|
||||
// Send a specific mesh sfx agent back
|
||||
var sfxagentname = '';
|
||||
var sfxagentpath = '';
|
||||
var f = req.query.idx;
|
||||
if (f == 0) { sfxagentname = mesh.filename1; sfxagentpath = mesh.path1; }
|
||||
if (f == 1) { sfxagentname = mesh.filename2; sfxagentpath = mesh.path2; }
|
||||
if (f == 2) { sfxagentname = mesh.filename3; sfxagentpath = mesh.path3; }
|
||||
if (sfxagentpath == null) { res.sendStatus(404); return; }
|
||||
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Content-Type': 'application/octet-stream', 'Content-Disposition': 'attachment; filename=' + sfxagentname });
|
||||
res.sendFile(sfxagentpath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add HTTP security headers to all responses
|
||||
obj.app.use(function (req, res, next) {
|
||||
res.removeHeader("X-Powered-By");
|
||||
@ -1571,6 +1595,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
|
||||
obj.app.ws(url + 'webrelay.ashx', handleRelayWebSocket);
|
||||
obj.app.ws(url + 'control.ashx', function (ws, req) { try { var domain = checkUserIpAddress(ws, req); if (domain != null) { obj.meshUserHandler.CreateMeshUser(obj, obj.db, ws, req, obj.args, domain); } } catch (e) { console.log(e); } });
|
||||
obj.app.get(url + 'meshagents', obj.handleMeshAgentRequest);
|
||||
obj.app.get(url + 'meshsfxagents', obj.handleMeshSfxAgentRequest);
|
||||
obj.app.get(url + 'meshsettings', obj.handleMeshSettingsRequest);
|
||||
obj.app.get(url + 'downloadfile.ashx', handleDownloadFile);
|
||||
obj.app.post(url + 'uploadfile.ashx', handleUploadFile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user