Added MeshCentral Router for macOS

Ylian Saint-Hilaire committed Dec 26, 2020 at 11:58 UTC 12dd791cf69fe68ceb764305ef11afa4505e5da8
5 files changed +25 -6
agents/MeshCentralRouter.dmg
Binary files /dev/null and b/agents/MeshCentralRouter.dmg differ
meshcentral.js
+2 -1
@@ -2205,7 +2205,8 @@ function CreateMeshCentralServer(config, args) {
2205 // List of possible mesh agent install scripts
2206 var meshToolsList = {
2207 'MeshCentralRouter': { localname: 'MeshCentralRouter.exe', dlname: 'winrouter' },
2208 - 'MeshCentralAssistant': { localname: 'MeshCentralAssistant.exe', dlname: 'winassistant' }
2208 + 'MeshCentralAssistant': { localname: 'MeshCentralAssistant.exe', dlname: 'winassistant' },
2209 + 'MeshCentralRouterMacOS': { localname: 'MeshCentralRouter.dmg', dlname: 'MeshCentralRouter.dmg' }
2210 };
2211
2212 // Update the list of available mesh agents
meshuser.js
+1 -1
@@ -447,7 +447,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
447 // Build server information object
448 var serverinfo = { domain: domain.id, name: domain.dns ? domain.dns : parent.certificates.CommonName, mpsname: parent.certificates.AmtMpsName, mpsport: mpsport, mpspass: args.mpspass, port: httpport, emailcheck: ((parent.parent.mailserver != null) && (domain.auth != 'sspi') && (domain.auth != 'ldap') && (args.lanonly != true) && (parent.certificates.CommonName != null) && (parent.certificates.CommonName.indexOf('.') != -1) && (user._id.split('/')[2].startsWith('~') == false)), domainauth: (domain.auth == 'sspi'), serverTime: Date.now() };
449 serverinfo.languages = parent.renderLanguages;
450 - serverinfo.tlshash = Buffer.from(parent.webCertificateHashs[domain.id], 'binary').toString('hex').toUpperCase(); // SHA384 of server HTTPS certificate
450 + serverinfo.tlshash = Buffer.from(parent.webCertificateFullHashs[domain.id], 'binary').toString('hex').toUpperCase(); // SHA384 of server HTTPS certificate
451 if ((domain.sessionrecording) && (domain.sessionrecording.onlyselecteddevicegroups === true)) { serverinfo.devGroupSessionRecording = 1; } // Allow enabling of session recording
452 if ((parent.parent.config.domains[domain.id].amtacmactivation != null) && (parent.parent.config.domains[domain.id].amtacmactivation.acmmatch != null)) {
453 var matchingDomains = [];
views/default.handlebars
+9 -4
@@ -3672,7 +3672,7 @@
3672 }
3673 if ((userinfo.siteadmin == 0xFFFFFFFF) || ((userinfo.siteadmin & 128) == 0)) {
3674 r += '<a href=# onclick=\'return p10showMeshCmdDialog(0)\' style=cursor:pointer title="' + "Download MeshCmd, a command line tool that performs many functions." + '">' + "MeshCmd" + '</a>&nbsp';
3675 - if (navigator.platform.toLowerCase() == 'win32') { r += '<a href=# onclick=\'return p10showMeshRouterDialog()\' style=cursor:pointer title="' + "Download MeshCentral Router, a TCP port mapping tool." + '">' + "Router" + '</a>&nbsp'; }
3675 + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) { r += '<a href=# onclick=\'return p10showMeshRouterDialog()\' style=cursor:pointer title="' + "Download MeshCentral Router, a TCP port mapping tool." + '">' + "Router" + '</a>&nbsp'; }
3676 }
3677 r += '</div><br/>';
3678
@@ -5978,11 +5978,15 @@
5978 if ((args.xterm === 0) && (node.agent) && ((node.agent.caps & 2) != 0) && ((meshrights & 8) != 0) && ((meshrights == 0xFFFFFFFF) || ((meshrights & 512) == 0))) { x += '<a href=# onclick=p10openxterm(event,"' + node._id + '") title="' + "Open XTerm terminal" + '">' + "XTerm" + '</a>&nbsp;'; }
5979
5980 // RDP link, show this link only of the remote machine is Windows.
5981 - if (((connectivity & 1) != 0) && (windowsBrowser == true) && (node.agent) && ((meshrights & 8) != 0)) {
5981 + if (((connectivity & 1) != 0) && (node.agent) && ((meshrights & 8) != 0)) {
5982 if ((node.agent.id > 0) && (node.agent.id < 5)) { x += '<a href=# cmenu=altPortContextMenu id=rdpMCRouterLink onclick=p10MCRouter("' + node._id + '","RDP2") title="' + "Requires installation of MeshCentral Router" + '.">' + "RDP" + '</a>&nbsp;'; }
5983 if (node.agent.id > 4) {
5984 - x += '<a href=# onclick=p10MCRouter("' + node._id + '","PSSH",22) title="' + "Requires installation of MeshCentral Router." + '">' + "Putty" + '</a>&nbsp;';
5985 - x += '<a href=# onclick=p10MCRouter("' + node._id + '","WSCP",22) title="' + "Requires installation of MeshCentral Router." + '">' + "WinSCP" + '</a>&nbsp;';
5984 + if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) {
5985 + x += '<a href=# onclick=p10MCRouter("' + node._id + '","PSSH",22) title="' + "Requires installation of MeshCentral Router." + '">' + "SSH" + '</a>&nbsp;';
5986 + }
5987 + if (navigator.platform.toLowerCase() == 'win32') {
5988 + x += '<a href=# onclick=p10MCRouter("' + node._id + '","WSCP",22) title="' + "Requires installation of MeshCentral Router." + '">' + "SCP" + '</a>&nbsp;';
5989 + }
5990 }
5991 }
5992
@@ -6694,6 +6698,7 @@
6698 if (xxdialogMode) return;
6699 var x = '<div>' + "MeshCentral Router is a Windows tool for TCP port mapping. You can, for example, RDP into a remote device thru this server." + '</div><br />';
6700 x += addHtmlValue("Win32 Executable", '<a style=cursor:pointer onclick=downloadFile("meshagents?meshaction=winrouter' + (urlargs.key?('&key=' + urlargs.key):'') + '",null,true)>MeshCentralRouter.exe</a>');
6701 + x += addHtmlValue("MacOS Installer", '<a style=cursor:pointer onclick=downloadFile("meshagents?meshaction=macrouter' + (urlargs.key?('&key=' + urlargs.key):'') + '",null,true)>MeshCentralRouter.dwg</a>');
6702 var servername = serverinfo.name;
6703 if ((servername.indexOf('.') == -1) || ((features & 2) != 0)) { servername = window.location.hostname; } // If the server name is not set or it's in LAN-only mode, use the URL hostname as server name.
6704 var domainUrlNoSlash = domainUrl.substring(0, domainUrl.length - 1);
webserver.js
+13
@@ -4419,6 +4419,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4419 setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralAssistant.exe', null, 'MeshCentralAssistant.exe');
4420 try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
4421 } else { res.sendStatus(404); }
4422 + } else if (req.query.meshaction == 'macrouter') {
4423 + var p = obj.path.join(__dirname, 'agents', 'MeshCentralRouter.dmg');
4424 + if (obj.fs.existsSync(p)) {
4425 + setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralRouter.dmg', null, 'MeshCentralRouter.dmg');
4426 + try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
4427 + } else { res.sendStatus(404); }
4428 }
4429 return;
4430 }
@@ -4470,6 +4476,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4476 setContentDispositionHeader(res, 'application/octet-stream', 'meshaction.txt', null, 'meshaction.txt');
4477 res.send(JSON.stringify(meshaction, null, ' '));
4478 } else if (req.query.meshaction == 'winrouter') {
4479 + console.log('t2');
4480 var p = obj.path.join(__dirname, 'agents', 'MeshCentralRouter.exe');
4481 if (obj.fs.existsSync(p)) {
4482 setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralRouter.exe', null, 'MeshCentralRouter.exe');
@@ -4481,6 +4488,12 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
4488 setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralAssistant.exe', null, 'MeshCentralAssistant.exe');
4489 try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
4490 } else { res.sendStatus(404); }
4491 + } else if (req.query.meshaction == 'macrouter') {
4492 + var p = obj.path.join(__dirname, 'agents', 'MeshCentralRouter.dmg');
4493 + if (obj.fs.existsSync(p)) {
4494 + setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralRouter.dmg', null, 'MeshCentralRouter.dmg');
4495 + try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
4496 + } else { res.sendStatus(404); }
4497 } else {
4498 res.sendStatus(401);
4499 }