diff --git a/agents/MeshService.exe b/agents/MeshService.exe index 5c0ecdcb..b1ccb42c 100644 Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ diff --git a/agents/MeshService64.exe b/agents/MeshService64.exe index e71de3a9..8e91d939 100644 Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ diff --git a/agents/meshagent_arm b/agents/meshagent_arm index 43d07564..39584818 100644 Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ diff --git a/agents/meshagent_pi b/agents/meshagent_pi index 427c90f2..3e48f4f9 100644 Binary files a/agents/meshagent_pi and b/agents/meshagent_pi differ diff --git a/agents/meshagent_pogo b/agents/meshagent_pogo index 9fcbcc88..511faaf2 100644 Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ diff --git a/agents/meshagent_poky b/agents/meshagent_poky index 28b9f2c4..fe1b956e 100644 Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ diff --git a/agents/meshagent_poky64 b/agents/meshagent_poky64 index 742701ff..cd9f82fe 100644 Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ diff --git a/agents/meshagent_x86 b/agents/meshagent_x86 index 99554426..5926f5cf 100644 Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ diff --git a/agents/meshagent_x86-64 b/agents/meshagent_x86-64 index 9df685a4..78a517bb 100644 Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ diff --git a/agents/meshagent_x86-64_nokvm b/agents/meshagent_x86-64_nokvm index 80dd5baa..f82347b1 100644 Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ diff --git a/agents/meshagent_x86_nokvm b/agents/meshagent_x86_nokvm index c0fbd81c..93bf2ccd 100644 Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ diff --git a/meshagent.js b/meshagent.js index a6f827ca..612da51d 100644 --- a/meshagent.js +++ b/meshagent.js @@ -29,7 +29,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { obj.remoteaddr = obj.ws._socket.remoteAddress; obj.useSHA386 = false; if (obj.remoteaddr.startsWith('::ffff:')) { obj.remoteaddr = obj.remoteaddr.substring(7); } - ws._socket.setKeepAlive(true, 0); // Set TCP keep alive + ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive, 4 minutes // Send a message to the mesh agent obj.send = function (data) { try { if (typeof data == 'string') { obj.ws.send(new Buffer(data, 'binary')); } else { obj.ws.send(data); } } catch (e) { } } @@ -127,12 +127,12 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) { } else { // Send the next block to the agent obj.agentUpdate.ptr += len; - //console.log("Agent update send next block: " + len); + //console.log("Agent update send next block", obj.agentUpdate.ptr, len); if (len == agentUpdateBlockSize) { obj.ws.send(obj.agentUpdate.buf); } else { obj.ws.send(obj.agentUpdate.buf.slice(0, len + 4)); } // Command 14, mesh agent next data block if (len < agentUpdateBlockSize) { - //console.log("Agent update sent"); - obj.send(obj.common.ShortToStr(13) + obj.common.ShortToStr(0) + obj.common.hex2rstr(obj.agentInfo.hash)); // Command 13, end mesh agent download, send agent SHA384 hash + console.log("Agent update sent"); + obj.send(obj.common.ShortToStr(13) + obj.common.ShortToStr(0) + obj.common.hex2rstr(obj.agentExeInfo.hash)); // Command 13, end mesh agent download, send agent SHA384 hash obj.fs.close(obj.agentUpdate.fd); obj.agentUpdate = null; } diff --git a/meshcentral.js b/meshcentral.js index b0478a50..2535a4ff 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -296,55 +296,56 @@ function CreateMeshCentralServer() { // Load the list of mesh agents and install scripts if (obj.args.noagentupdate == 1) { for (var i in meshAgentsArchitectureNumbers) { meshAgentsArchitectureNumbers[i].update = false; } } - obj.updateMeshAgentsTable(); - obj.updateMeshAgentInstallScripts(); + obj.updateMeshAgentsTable(function () { + obj.updateMeshAgentInstallScripts(); - // Setup and start the web server - require('crypto').randomBytes(48, function (err, buf) { - // Setup Mesh Multi-Server if needed - obj.multiServer = require('./multiserver.js').CreateMultiServer(obj, obj.args); - if (obj.multiServer != null) { - obj.serverId = obj.multiServer.serverid; - for (var serverid in obj.config.peers.servers) { obj.peerConnectivityByNode[serverid] = {}; } - } + // Setup and start the web server + require('crypto').randomBytes(48, function (err, buf) { + // Setup Mesh Multi-Server if needed + obj.multiServer = require('./multiserver.js').CreateMultiServer(obj, obj.args); + if (obj.multiServer != null) { + obj.serverId = obj.multiServer.serverid; + for (var serverid in obj.config.peers.servers) { obj.peerConnectivityByNode[serverid] = {}; } + } - // If the server is set to "nousers", allow only loopback unless IP filter is set - if ((obj.args.nousers == true) && (obj.args.userallowedip == null)) { obj.args.userallowedip = "::1,127.0.0.1"; } + // If the server is set to "nousers", allow only loopback unless IP filter is set + if ((obj.args.nousers == true) && (obj.args.userallowedip == null)) { obj.args.userallowedip = "::1,127.0.0.1"; } - if (obj.args.secret) { - // This secret is used to encrypt HTTP session information, if specified, user it. - obj.webserver = require('./webserver.js').CreateWebServer(obj, obj.db, obj.args, obj.args.secret, obj.certificates); - } else { - // If the secret is not specified, generate a random number. - obj.webserver = require('./webserver.js').CreateWebServer(obj, obj.db, obj.args, buf.toString('hex').toUpperCase(), obj.certificates); - } + if (obj.args.secret) { + // This secret is used to encrypt HTTP session information, if specified, user it. + obj.webserver = require('./webserver.js').CreateWebServer(obj, obj.db, obj.args, obj.args.secret, obj.certificates); + } else { + // If the secret is not specified, generate a random number. + obj.webserver = require('./webserver.js').CreateWebServer(obj, obj.db, obj.args, buf.toString('hex').toUpperCase(), obj.certificates); + } - // Setup and start the redirection server if needed - if ((obj.args.redirport != null) && (typeof obj.args.redirport == 'number') && (obj.args.redirport != 0)) { - obj.redirserver = require('./redirserver.js').CreateRedirServer(obj, obj.db, obj.args, obj.certificates); - } + // Setup and start the redirection server if needed + if ((obj.args.redirport != null) && (typeof obj.args.redirport == 'number') && (obj.args.redirport != 0)) { + obj.redirserver = require('./redirserver.js').CreateRedirServer(obj, obj.db, obj.args, obj.certificates); + } - // Setup the Intel AMT event handler - obj.amtEventHandler = require('./amtevents.js').CreateAmtEventsHandler(obj); + // Setup the Intel AMT event handler + obj.amtEventHandler = require('./amtevents.js').CreateAmtEventsHandler(obj); - // Setup the Intel AMT local network scanner - if (obj.args.wanonly != true) { - obj.amtScanner = require('./amtscanner.js').CreateAmtScanner(obj).start(); - obj.meshScanner = require('./meshscanner.js').CreateMeshScanner(obj).start(); - } + // Setup the Intel AMT local network scanner + if (obj.args.wanonly != true) { + obj.amtScanner = require('./amtscanner.js').CreateAmtScanner(obj).start(); + obj.meshScanner = require('./meshscanner.js').CreateMeshScanner(obj).start(); + } - // Setup and start the MPS server - if (obj.args.lanonly != true) { - obj.mpsserver = require('./mpsserver.js').CreateMpsServer(obj, obj.db, obj.args, obj.certificates); - } + // Setup and start the MPS server + if (obj.args.lanonly != true) { + obj.mpsserver = require('./mpsserver.js').CreateMpsServer(obj, obj.db, obj.args, obj.certificates); + } - // Start periodic maintenance - obj.maintenanceTimer = setInterval(obj.maintenanceActions, 1000 * 60 * 60); // Run this every hour + // Start periodic maintenance + obj.maintenanceTimer = setInterval(obj.maintenanceActions, 1000 * 60 * 60); // Run this every hour - // Dispatch an event that the server is now running - obj.DispatchEvent(['*'], obj, { etype: 'server', action: 'started', msg: 'Server started' }) + // Dispatch an event that the server is now running + obj.DispatchEvent(['*'], obj, { etype: 'server', action: 'started', msg: 'Server started' }) - obj.debug(1, 'Server started'); + obj.debug(1, 'Server started'); + }); }); }); }); @@ -728,7 +729,9 @@ function CreateMeshCentralServer() { }; // Update the list of available mesh agents - obj.updateMeshAgentsTable = function () { + obj.updateMeshAgentsTable = function (func) { + var archcount = 0; + for (var archid in meshAgentsArchitectureNumbers) { archcount++; } for (var archid in meshAgentsArchitectureNumbers) { var agentpath = obj.path.join(__dirname, 'agents', meshAgentsArchitectureNumbers[archid].localname); var stream = null; @@ -738,6 +741,7 @@ function CreateMeshCentralServer() { stream.on('error', function (data) { // If there is an error reading this file, make sure this agent is not in the agent table if (obj.meshAgentBinaries[this.info.id] != null) { delete obj.meshAgentBinaries[this.info.id]; } + if ((--archcount == 0) && (func != null)) { func(); } }); stream.on('end', function () { // Add the agent to the agent table with all information and the hash @@ -748,11 +752,12 @@ function CreateMeshCentralServer() { var stats = null; try { stats = obj.fs.statSync(this.agentpath) } catch (e) { } if (stats != null) { obj.meshAgentBinaries[this.info.id].size = stats.size; } + if ((--archcount == 0) && (func != null)) { func(); } }); stream.info = meshAgentsArchitectureNumbers[archid]; stream.agentpath = agentpath; stream.hash = obj.crypto.createHash('sha384', stream); - } catch (e) { } + } catch (e) { if ((--archcount == 0) && (func != null)) { func(); } } } } diff --git a/meshrelay.js b/meshrelay.js index bbef19a3..b94eaeee 100644 --- a/meshrelay.js +++ b/meshrelay.js @@ -80,7 +80,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req) { } if (obj.id == null) { try { obj.close(); } catch (e) { } return null; } // Attempt to connect without id, drop this. - ws._socket.setKeepAlive(true, 0); // Set TCP keep alive + ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive // Validate that the id is valid, we only need to do this on non-authenticated sessions. // TODO: Figure out when this needs to be done. diff --git a/meshuser.js b/meshuser.js index 4ecba5ed..11a26f98 100644 --- a/meshuser.js +++ b/meshuser.js @@ -59,7 +59,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) { } user.subscriptions = obj.parent.subscribe(user._id, ws); // Subscribe to events - obj.ws._socket.setKeepAlive(true, 0); // Set TCP keep alive + obj.ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive // When data is received from the web socket ws.on('message', function (msg) { diff --git a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.application b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.application new file mode 100644 index 00000000..dd2c79a1 --- /dev/null +++ b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.application @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + nAtlMki8bI8WHgD0B1tC4ZVmxIYy41iUEGTj8OMxNmU= + + + + \ No newline at end of file diff --git a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.config.deploy b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.config.deploy new file mode 100644 index 00000000..3f1c1821 --- /dev/null +++ b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.config.deploy @@ -0,0 +1,42 @@ + + + + +
+
+
+ + + + + + + + + False + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.deploy b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.deploy new file mode 100644 index 00000000..fcb90281 Binary files /dev/null and b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.deploy differ diff --git a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.manifest b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.manifest new file mode 100644 index 00000000..f8bff496 --- /dev/null +++ b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.exe.manifest @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HHqrJ3vBMkqfPDfdzKBtZW4mtE/Sg5O5LdPB6KmBv3E= + + + + + + + + + + UylUFD4/o0KBti+5/eodTDgq4BkUJD0J0aUXNd3yHbY= + + + + + + + + + mkjbDQuo7YXa8wZxdKEu/ECXrORwwtpRgNj8NBKbzHo= + + + + + + + + + + \ No newline at end of file diff --git a/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.ico.deploy b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.ico.deploy new file mode 100644 index 00000000..6c82eccb Binary files /dev/null and b/public/clickonce/minirouter/Application Files/MeshMiniRouter_2_0_0_10/MeshMiniRouter.ico.deploy differ diff --git a/public/clickonce/minirouter/MeshMiniRouter.application b/public/clickonce/minirouter/MeshMiniRouter.application index fcd98cf0..dd2c79a1 100644 --- a/public/clickonce/minirouter/MeshMiniRouter.application +++ b/public/clickonce/minirouter/MeshMiniRouter.application @@ -1,20 +1,20 @@  - + - - + + - VsPkLYR71TSqI8oGBBeXzb5hGi4R2xtQaGQJ0zmsTic= + nAtlMki8bI8WHgD0B1tC4ZVmxIYy41iUEGTj8OMxNmU= diff --git a/public/clickonce/minirouter/publish.htm b/public/clickonce/minirouter/publish.htm index e004683e..dc9122d2 100644 --- a/public/clickonce/minirouter/publish.htm +++ b/public/clickonce/minirouter/publish.htm @@ -59,7 +59,7 @@ FONT.key {font-weight: bold; color: darkgreen}
-
 
Name:Meshcentral Mini-Router
 
Version:2.0.0.7
 
Publisher:Meshcentral.com
 
+
 
Name:Meshcentral Mini-Router
 
Version:2.0.0.10
 
Publisher:Meshcentral.com
 
diff --git a/views/default.handlebars b/views/default.handlebars index 7f438062..4da4c109 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2416,8 +2416,13 @@ if (xxmap != null) x += 'Location '; // RDP link, show this link only of the remote machine is Windows. - if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0) && (node.agent.id > 0) && (node.agent.id < 5)) { x += 'RDP '; } - + if (((connectivity & 1) != 0) && (clickOnce == true) && (mesh.mtype == 2) && ((meshrights & 8) != 0)) { + if ((node.agent.id > 0) && (node.agent.id < 5)) { x += 'RDP '; } + if (node.agent.id > 4) { + x += 'Putty '; + x += 'WinSCP '; + } + } x += '
' QH('p10html3', x); @@ -2626,8 +2631,8 @@ meshserver.Send({ action: 'removedevices', nodeids: [ nodeid ] }); } - function p10clickOnce(nodeid, protocol) { - meshserver.Send({ action: 'getcookie', nodeid: nodeid, tcpport: 3389, tag: 'clickonce', protocol: 'rdp' }); + function p10clickOnce(nodeid, protocol, port) { + meshserver.Send({ action: 'getcookie', nodeid: nodeid, tcpport: port, tag: 'clickonce', protocol: protocol }); } // Show current location diff --git a/webserver.js b/webserver.js index a2e8dac5..70721e6c 100644 --- a/webserver.js +++ b/webserver.js @@ -704,7 +704,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate Debug(1, 'Websocket relay connected from ' + user.name + ' for ' + req.query.host + '.'); ws.pause(); // Hold this socket until we are ready. - ws._socket.setKeepAlive(true, 0); // Set TCP keep alive + ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive // Fetch information about the target obj.db.Get(req.query.host, function (err, docs) { @@ -940,7 +940,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate function handleEchoWebSocket(ws, req) { var domain = checkUserIpAddress(ws, req); if (domain == null) return; - ws._socket.setKeepAlive(true, 0); // Set TCP keep alive + ws._socket.setKeepAlive(true, 240000); // Set TCP keep alive // When data is received from the web socket, echo it back ws.on('message', function (data) { @@ -1419,7 +1419,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate if ((o.time == null) || (o.time == null) || (typeof o.time != 'number')) { return null; } o.time = o.time * 1000; // Decode the cookie creation time o.dtime = Date.now() - o.time; // Decode how long ago the cookie was created (in milliseconds) - if ((o.dtime > 120000) || (o.dtime < 30000)) return null; // The cookie is only valid 120 seconds, or 30 seconds back in time (in case other server's clock is not quite right) + if ((o.dtime > 120000) || (o.dtime < -30000)) return null; // The cookie is only valid 120 seconds, or 30 seconds back in time (in case other server's clock is not quite right) return o; } catch (e) { return null; } }