Improved MeshCentral1 migration, improved MeshAgent
Ylian Saint-Hilaire committed
Nov 9, 2017 at 17:18 UTC
4bfec1ba611af8ccd8db494d9fa371a13598ecb6
17 files changed
+22
-12
agents/MeshService.exe
Binary files a/agents/MeshService.exe and b/agents/MeshService.exe differ
agents/MeshService64.exe
Binary files a/agents/MeshService64.exe and b/agents/MeshService64.exe differ
agents/meshagent_arm
Binary files a/agents/meshagent_arm and b/agents/meshagent_arm differ
agents/meshagent_pi
Binary files a/agents/meshagent_pi and b/agents/meshagent_pi differ
agents/meshagent_pogo
Binary files a/agents/meshagent_pogo and b/agents/meshagent_pogo differ
agents/meshagent_poky
Binary files a/agents/meshagent_poky and b/agents/meshagent_poky differ
agents/meshagent_poky64
Binary files a/agents/meshagent_poky64 and b/agents/meshagent_poky64 differ
agents/meshagent_x86
Binary files a/agents/meshagent_x86 and b/agents/meshagent_x86 differ
agents/meshagent_x86-64
Binary files a/agents/meshagent_x86-64 and b/agents/meshagent_x86-64 differ
agents/meshagent_x86-64_nokvm
Binary files a/agents/meshagent_x86-64_nokvm and b/agents/meshagent_x86-64_nokvm differ
agents/meshagent_x86_nokvm
Binary files a/agents/meshagent_x86_nokvm and b/agents/meshagent_x86_nokvm differ
agents/meshcmd.js
+1
-1
@@ -31,7 +31,7 @@ var settings = {
31
// Check the server certificate fingerprint
32
function onVerifyServer(clientName, certs) {
33
try { for (var i in certs) { if (certs[i].fingerprint.replace(/:/g, '') == settings.serverHttpsHash) { return; } } } catch (e) { }
34
- if (serverhash != null) { console.log('Error: Failed to verify server certificate.'); return false; }
34
+ if (serverhash != null) { console.log('Error: Failed to verify server certificate.'); throw 'Invalid server certificate'; }
35
}
36
37
// Print a debug message
agents/meshcore.js
+5
-1
@@ -290,8 +290,11 @@ function createMeshCore(agent) {
290
// Create a new tunnel object
291
var xurl = getServerTargetUrlEx(data.value);
292
if (xurl != null) {
293
- var tunnel = http.request(http.parseUri(xurl));
293
+ var woptions = http.parseUri(xurl);
294
+ sendConsoleText(JSON.stringify(woptions));
295
+ var tunnel = http.request(woptions);
296
tunnel.upgrade = onTunnelUpgrade;
297
+ tunnel.onerror = function (e) { sendConsoleText('ERROR: ' + JSON.stringify(e)); }
298
tunnel.sessionid = data.sessionid;
299
tunnel.rights = data.rights;
300
tunnel.state = 0;
@@ -775,6 +778,7 @@ function createMeshCore(agent) {
778
} catch (e) { response = 'Invalid HTTP websocket request'; }
779
if (httprequest != null) {
780
httprequest.upgrade = onWebSocketUpgrade;
781
+ httprequest.onerror = function (e) { sendConsoleText('ERROR: ' + JSON.stringify(e)); }
782
783
var index = 1;
784
while (consoleWebSockets[index]) { index++; }
meshagent.js
+3
-1
@@ -489,7 +489,9 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
489
var node = nodes[0];
490
if (node.meshid == obj.dbMeshKey) {
491
// Update the device name & host
492
- ChangeAgentCoreInfo({ name: node.name });
492
+ var newNode = { name: node.name };
493
+ if (node.intelamt != null) { newNode.intelamt = node.intelamt; }
494
+ ChangeAgentCoreInfo(newNode);
495
496
// Delete this node including network interface information and events
497
obj.db.Remove(node._id);
meshrelay.js
+1
-1
@@ -156,7 +156,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain) {
156
// Wait for other relay connection
157
ws.pause(); // Hold traffic until the other connection
158
parent.wsrelays[obj.id] = { peer1: obj, state: 1 };
159
- obj.parent.parent.debug(1, 'Relay holding: ' + obj.id + ' (' + obj.remoteaddr + ')');
159
+ obj.parent.parent.debug(1, 'Relay holding: ' + obj.id + ' (' + obj.remoteaddr + ') ' + (obj.authenticated?'Authenticated':'') );
160
161
// Check if a peer server has this connection
162
if (parent.parent.multiServer != null) {
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.1.0-h",
3
+ "version": "0.1.0-k",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
views/default.handlebars
+11
-7
@@ -2694,8 +2694,8 @@
2694
function p10showRouterDialog() {
2695
if (xxdialogMode) return;
2696
var y = "<select id=aginsSelect onclick=meshCmdOsClick() style=width:236px>";
2697
- y += "<option value=1>Windows (32bit)</option>";
2698
- y += "<option value=2>Windows (64bit)</option>";
2697
+ y += "<option value=3>Windows (32bit)</option>";
2698
+ y += "<option value=4>Windows (64bit)</option>";
2699
y += "<option value=5>Linux x86 (32bit)</option>";
2700
y += "<option value=6>Linux x86 (64bit)</option>";
2701
y += "<option value=25>Linux ARM, Raspberry Pi (32bit)</option>";
@@ -2704,7 +2704,7 @@
2704
var x = "";
2705
x += "<div>Download \"meshcmd\" with an action file to route traffic thru this server to this device. Make sure to edit meshaction.txt and add your account password or make any changes needed.<br /><br />";
2706
x += addHtmlValue('Operating System', y);
2707
- x += addHtmlValue('Mesh Command', '<a id="meshcmddownloadid" href="meshagents?meshcmd=1" target="_blank"></a>');
2707
+ x += addHtmlValue('Mesh Command', '<a id="meshcmddownloadid" href="meshagents?meshcmd=3" target="_blank"></a>');
2708
x += addHtmlValue('Action File', '<a href="meshagents?meshaction=route&nodeid=' + currentNode._id + '" target="_blank">MeshAction (.txt)</a>');
2709
x += "</div>";
2710
@@ -2715,8 +2715,8 @@
2715
function meshCmdOsClick() {
2716
var os = Q('aginsSelect').value, osn = '';
2717
Q('meshcmddownloadid').href = "meshagents?meshcmd=" + os;
2718
- if (os == 1) { osn = 'MeshCmd (Win32 executable)'; }
2719
- if (os == 2) { osn = 'MeshCmd (Win64 executable)'; }
2718
+ if (os == 3) { osn = 'MeshCmd (Win32 executable)'; }
2719
+ if (os == 4) { osn = 'MeshCmd (Win64 executable)'; }
2720
if (os == 5) { osn = 'MeshCmd (Linux x86, 32bit)'; }
2721
if (os == 6) { osn = 'MeshCmd (Linux x86, 64bit)'; }
2722
if (os == 25) { osn = 'MeshCmd (Linux ARM, 32bit)'; }
@@ -4228,7 +4228,11 @@
4228
}
4229
if ((user.quota != undefined) && ((user.siteadmin & 8) != 0)) { msg += ", " + (user.quota / 1024) + " k"; }
4230
if (user.name != userinfo.name) { msg += "</a>"; }
4231
- msg = '<table style="width:100%"><tr><td>' + EscapeHtml(user.name) + ', <a onclick=doemail(event,\"' + user.email + '\")>' + user.email + '</a><td align=right>' + msg + '</table>';
4231
+ if (user.email != null) {
4232
+ msg = '<table style=width:100%><tr><td>' + EscapeHtml(user.name) + ', <a onclick=doemail(event,\"' + user.email + '\")>' + user.email + '</a><td align=right>' + msg + '</table>';
4233
+ } else {
4234
+ msg = '<table style=width:100%><tr><td>' + EscapeHtml(user.name) + '<td align=right>' + msg + '</table>';
4235
+ }
4236
x += '<tr><td style=cursor:pointer onclick=showUserInfoDialog(\"' + user._id + '\")><div class=' + icon + ' style=float:left;width:16px;margin-top:4px;margin-left:2px;height:16px></div><div class=g1 style=height:24px></div><div class=bar style=height:24px;width:864px;font-size:medium>' + msg + '</div><div class=g2 style=height:24px;float:left></div><div class=bar2 style=float:none></div></td></tr>';
4237
}
4238
x += '</table>';
@@ -4246,7 +4250,7 @@
4250
var user = users[userid], x = '';
4251
if (xxdialogMode) return;
4252
x += addHtmlValue('Name', EscapeHtml(user.name));
4249
- x += addHtmlValue('Email', EscapeHtml(user.email));
4253
+ if (user.email != null) { x += addHtmlValue('Email', EscapeHtml(user.email)); }
4254
x += addHtmlValue('Creation', new Date(user.creation).toLocaleString());
4255
if (user.login) x += addHtmlValue('Last Login', new Date(user.login).toLocaleString());
4256
if (user.quota) x += addHtmlValue('Server Quota', EscapeHtml(parseInt(user.quota) / 1024) + ' k');