Fixed Intel AMT activation information and UI
Ylian Saint-Hilaire committed
May 1, 2018 at 13:44 UTC
6c593da7ffad7f503671db4f5e91d26534620470
4 files changed
+36
-21
amtscanner.js
+3
-3
@@ -206,7 +206,7 @@ module.exports.CreateAmtScanner = function (parent) {
206
obj.changeConnectState = function (tag, minorVersion, majorVersion, provisioningState, openPort, dualPorts, rinfo, user) {
207
//var provisioningStates = { 0: 'Pre', 1: 'in', 2: 'Post' };
208
//var provisioningStateStr = provisioningStates[provisioningState];
209
- //console.log('Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning at ' + rinfo.address + ', Open Ports: [' + openPorts.join(', ') + '], tag: ' + tag);
209
+ //console.log('Intel AMT ' + majorVersion + '.' + minorVersion + ', ' + provisioningStateStr + '-Provisioning at ' + rinfo.address + ', Open Ports: [' + openPort + '], tag: ' + tag);
210
var scaninfo = obj.scanTableTags[tag];
211
if (scaninfo != undefined) {
212
scaninfo.lastpong = Date.now();
@@ -255,8 +255,8 @@ module.exports.CreateAmtScanner = function (parent) {
255
var change = false;
256
if (node.intelamt == undefined) { node.intelamt = {}; }
257
if (node.intelamt.tls != tls) { node.intelamt.tls = tls; change = true; changes.push(tls==1?'TLS':'NoTLS'); }
258
- if (obj.compareAmtVersionStr(node.intelamt.ver, version)) { node.intelamt.ver = version; change = true; changes.push('Version ' + version); }
259
- if (node.intelamt.state != provisioningState) { node.intelamt.state = provisioningState; change = true; changes.push('State'); }
258
+ if (obj.compareAmtVersionStr(node.intelamt.ver, version)) { node.intelamt.ver = version; change = true; changes.push('AMT Version ' + version); }
259
+ if (node.intelamt.state != provisioningState) { node.intelamt.state = provisioningState; change = true; changes.push('AMT State'); }
260
if (change == true) {
261
// Make the change in the database
262
obj.parent.db.Set(node);
meshagent.js
+5
-5
@@ -574,11 +574,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
574
if ((device.agent.caps & 0xFFFFFFE7) != (command.caps & 0xFFFFFFE7)) { device.agent.caps = ((device.agent.caps & 24) + (command.caps & 0xFFFFFFE7)); change = 1; changes.push('agent capabilities'); } // Allow Javascript on the agent to change all capabilities except console and javascript support
575
if (command.intelamt) {
576
if (!device.intelamt) { device.intelamt = {}; }
577
- if (device.intelamt.ver != command.intelamt.ver) { device.intelamt.ver = command.intelamt.ver; change = 1; changes.push('AMT version'); }
578
- if (device.intelamt.state != command.intelamt.state) { device.intelamt.state = command.intelamt.state; change = 1; changes.push('AMT state'); }
579
- if (device.intelamt.flags != command.intelamt.flags) { device.intelamt.flags = command.intelamt.flags; change = 1; changes.push('AMT flags'); }
580
- if (device.intelamt.host != command.intelamt.host) { device.intelamt.host = command.intelamt.host; change = 1; changes.push('AMT host'); }
581
- if (device.intelamt.uuid != command.intelamt.uuid) { device.intelamt.uuid = command.intelamt.uuid; change = 1; changes.push('AMT uuid'); }
577
+ if ((command.intelamt.ver != null) && (device.intelamt.ver != command.intelamt.ver)) { device.intelamt.ver = command.intelamt.ver; change = 1; changes.push('AMT version'); }
578
+ if ((command.intelamt.state != null) && (device.intelamt.state != command.intelamt.state)) { device.intelamt.state = command.intelamt.state; change = 1; changes.push('AMT state'); }
579
+ if ((command.intelamt.flags != null) && (device.intelamt.flags != command.intelamt.flags)) { device.intelamt.flags = command.intelamt.flags; change = 1; changes.push('AMT flags'); }
580
+ if ((command.intelamt.host != null) && (device.intelamt.host != command.intelamt.host)) { device.intelamt.host = command.intelamt.host; change = 1; changes.push('AMT host'); }
581
+ if ((command.intelamt.uuid != null) && (device.intelamt.uuid != command.intelamt.uuid)) { device.intelamt.uuid = command.intelamt.uuid; change = 1; changes.push('AMT uuid'); }
582
}
583
if (mesh.mtype == 2) {
584
if (device.host != obj.remoteaddr) { device.host = obj.remoteaddr; change = 1; changes.push('host'); }
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.1.7-b",
3
+ "version": "0.1.7-c",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
views/default.handlebars
+27
-12
@@ -2109,11 +2109,23 @@
2109
function powerSort(a, b) { var ap = a.pwr?a.pwr:0; var bp = b.pwr?b.pwr:0; if (ap == bp) { if (showHostnames == true) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; } else { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; } } if (ap > bp) return 1; if (ap < bp) return -1; return 0; }
2110
function deviceSort(a, b) { if (a.namel > b.namel) return 1; if (a.namel < b.namel) return -1; return 0; }
2111
function deviceHostSort(a, b) { if (a.hostl > b.hostl) return 1; if (a.hostl < b.hostl) return -1; return 0; }
2112
- function onSearchInputChanged() { var x = Q('SearchInput').value.toLowerCase(); putstore("search", x); if (x == '') { for (var d in nodes) { nodes[d].v = true; } } else { for (var d in nodes) { nodes[d].v = (nodes[d].name.toLowerCase().indexOf(x) >= 0) || (nodes[d].hostl != null && nodes[d].hostl.toLowerCase().indexOf(x) >= 0); } } updateDevices(); }
2112
function onSearchFocus(x) { searchFocus = x; }
2113
function onMapSearchFocus(x) { mapSearchFocus = x; }
2114
function onConsoleFocus(x) { consoleFocus = x; }
2115
2116
+ function onSearchInputChanged() {
2117
+ var x = Q('SearchInput').value.toLowerCase();
2118
+ putstore("search", x);
2119
+ if (x == '') { for (var d in nodes) { nodes[d].v = true; } }
2120
+ else {
2121
+ for (var d in nodes) {
2122
+ nodes[d].v = (nodes[d].name.toLowerCase().indexOf(x) >= 0) || (nodes[d].hostl != null && nodes[d].hostl.toLowerCase().indexOf(x) >= 0);
2123
+ if (nodes[d].tags) { for (var s in nodes[d].tags) { if (nodes[d].tags[s].toLowerCase().indexOf(x) >= 0) { nodes[d].v = true; break; } } }
2124
+ }
2125
+ }
2126
+ updateDevices();
2127
+ }
2128
+
2129
var contextelement = null;
2130
function handleContextMenu(event) {
2131
hideContextMenu();
@@ -2847,23 +2859,26 @@
2859
if (node.intelamt != null) {
2860
var str = '';
2861
var provisioningStates = { 0: 'Not Activated (Pre)', 1: 'Not Activated (In)', 2: 'Activated' };
2862
+ if (node.intelamt.ver != null && node.intelamt.state == null) { str += '<i>Unknown State</i>, v' + node.intelamt.ver; } else
2863
if (node.intelamt.ver == null || node.intelamt.state == null) { str += '<i>Unknown Version & State</i>'; } else {
2864
str += provisioningStates[node.intelamt.state];
2865
if (node.intelamt.flags) { if (node.intelamt.flags & 2) { str += ' <span title="Intel AMT is activated in Client Control Mode">CCM</span>'; } else if (node.intelamt.flags & 4) { str += ' <span title="Intel AMT is activated in Admin Control Mode">ACM</span>'; } }
2866
str += (', v' + node.intelamt.ver);
2867
}
2868
if (node.intelamt.tls == 1) { str += ', <span title="Intel AMT is setup with TLS network security">TLS</span>'; }
2856
- if (node.intelamt.user == null || node.intelamt.user == '') {
2869
+ if (node.intelamt.state == 2) {
2870
+ if (node.intelamt.user == null || node.intelamt.user == '') {
2871
+ if ((meshrights & 4) != 0) {
2872
+ str += ', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("' + node._id + '")>No Credentials</i>';
2873
+ } else {
2874
+ str += ', <i style=color:#FF0000>No Credentials</i>';
2875
+ }
2876
+ }
2877
+ str += ' ';
2878
if ((meshrights & 4) != 0) {
2858
- str += ', <i style=color:#FF0000;cursor:pointer title="Edit Intel® AMT credentials" onclick=editDeviceAmtSettings("' + node._id + '")>No Credentials</i>';
2859
- } else {
2860
- str += ', <i style=color:#FF0000>No Credentials</i>';
2879
+ str += '<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
2880
}
2881
}
2863
- str += ' ';
2864
- if ((meshrights & 4) != 0) {
2865
- str += '<img src=images/link4.png height=10 width=10 title="Edit Intel® AMT credentials" style=cursor:pointer onclick=editDeviceAmtSettings("' + node._id + '")>';
2866
- }
2882
x += addDeviceAttribute('Intel® AMT', str);
2883
}
2884
@@ -2948,7 +2963,7 @@
2963
QV('MainDevDesktop', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 1) != 0)) && (meshrights & 8));
2964
QV('MainDevTerminal', ((mesh.mtype == 1) || (node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 2) != 0)) && (meshrights & 8));
2965
QV('MainDevFiles', ((mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 4) != 0))) && (meshrights & 8));
2951
- QV('MainDevAmt', (node.intelamt != null) && (meshrights & 8));
2966
+ QV('MainDevAmt', (node.intelamt != null) && (node.intelamt.state == 2) && (meshrights & 8));
2967
QV('MainDevConsole', (consoleRights && (mesh.mtype == 2) && ((node.agent == null) || (node.agent.caps == null) || ((node.agent.caps & 8) != 0))) && (meshrights & 8));
2968
QV('p15uploadCore', (node.agent != null) && (node.agent.caps != null) && ((node.agent.caps & 16) != 0) && (userinfo.siteadmin == 0xFFFFFFFF));
2969
QH('p15coreName', ((node.agent != null) && (node.agent.core != null))?node.agent.core:'');
@@ -3349,7 +3364,7 @@
3364
// Show the right buttons
3365
QV('disconnectbutton1span', (deskState != 0));
3366
QV('connectbutton1span', (deskState == 0) && (mesh.mtype == 2));
3352
- QV('connectbutton1hspan', (deskState == 0) && (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))));
3367
+ QV('connectbutton1hspan', (deskState == 0) && ((currentNode.intelamt != null) && (currentNode.intelamt.state == 2) && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))));
3368
3369
// Show the right settings
3370
QV('d7amtkvm', (currentNode.intelamt != null && ((currentNode.intelamt.ver != null) || (mesh.mtype == 1))) && ((deskState == 0) || (desktop.contype == 2)));
@@ -3676,7 +3691,7 @@
3691
// Show the right buttons
3692
QV('disconnectbutton2span', (termState == true));
3693
QV('connectbutton2span', (termState == false) && (mesh.mtype == 2));
3679
- QV('connectbutton2hspan', (termState == false) && (terminalNode.intelamt != null && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1))));
3694
+ QV('connectbutton2hspan', (termState == false) && ((terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2) && ((terminalNode.intelamt.ver != null) || (mesh.mtype == 1))));
3695
3696
// Enable buttons
3697
var online = ((terminalNode.conn & 1) != 0); // If Agent (1) connected, enable Terminal