Fixed bug in Intel AMT password testing system.

Ylian Saint-Hilaire committed Oct 23, 2020 at 14:56 UTC b13876905a8236656c31fb71da626425598079f6
2 files changed +10 -9
amtmanager.js
+7 -6
@@ -313,7 +313,8 @@ module.exports.CreateAmtManager = function (parent) {
313 if ((typeof mesh.amt.password == 'string') && (mesh.amt.password != '')) { password = mesh.amt.password; }
314 }
315 }
316 - if (amtPolicy < 2) { ciraPolicy = 0; }
316 + if (amtPolicy == 0) { ciraPolicy = 0; } // If no policy, don't change CIRA state.
317 + if (amtPolicy == 1) { ciraPolicy = 1; } // If deactivation policy, clear CIRA.
318 dev.policy = { amtPolicy: amtPolicy, ciraPolicy: ciraPolicy, badPass: badPass, password: password };
319
320 // Setup the monitored device
@@ -371,8 +372,8 @@ module.exports.CreateAmtManager = function (parent) {
372 // Deactivate CCM.
373 deactivateIntelAmtCCM(dev);
374 } else {
374 - // Already deactivated or in ACM, do nothing.
375 - dev.consoleMsg("Done.");
375 + // Already deactivated or in ACM
376 + dev.consoleMsg("Done."); // TODO: We need to at least clear CIRA
377 removeAmtDevice(dev);
378 }
379 return;
@@ -570,7 +571,7 @@ module.exports.CreateAmtManager = function (parent) {
571 } else if (status == 401) {
572 // Authentication error, see if we can use alternative credentials
573 if ((dev.acctry == null) && (typeof dev.policy.password == 'string') && (dev.policy.password != '')) { dev.acctry = 'policy'; attemptInitialContact(dev); return; }
573 - if ((dev.acctry == null) || (dev.acctry == 'policy') && (obj.amtAdminAccounts[dev.domainid] != null) && (obj.amtAdminAccounts[dev.domainid].length > 0)) { dev.acctry = 0; attemptInitialContact(dev); return; }
574 + if (((dev.acctry == null) || (dev.acctry == 'policy')) && (obj.amtAdminAccounts[dev.domainid] != null) && (obj.amtAdminAccounts[dev.domainid].length > 0)) { dev.acctry = 0; attemptInitialContact(dev); return; }
575 if ((dev.acctry != null) && (obj.amtAdminAccounts[dev.domainid] != null) && (obj.amtAdminAccounts[dev.domainid].length > (dev.acctry + 1))) { dev.acctry++; attemptInitialContact(dev); return; }
576
577 // If this devics is in CCM mode and we have a bad password reset policy, do it now.
@@ -1209,8 +1210,8 @@ module.exports.CreateAmtManager = function (parent) {
1210 const dev = stack.dev;
1211 if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
1212 if (status != 200) { dev.consoleMsg("Failed to create new MPS server (" + status + ")."); removeAmtDevice(dev); return; }
1213 + if ((response.Body.MpServer == null) || (response.Body.MpServer.ReferenceParameters == null) || (response.Body.MpServer.ReferenceParameters.SelectorSet == null) || (response.Body.MpServer.ReferenceParameters.SelectorSet.Selector == null)) { dev.consoleMsg("Create new MPS server invalid response."); removeAmtDevice(dev); return; }
1214 dev.cira.mpsPresent = getItem(response.Body.MpServer.ReferenceParameters.SelectorSet.Selector, '@Name', 'Name').Value;
1213 - console.log(dev.cira.mpsPresent);
1215 dev.consoleMsg("Created new MPS server.");
1216 addMpsPolicy(dev);
1217 });
@@ -1832,7 +1833,7 @@ module.exports.CreateAmtManager = function (parent) {
1833 delete dev.amtstack;
1834 UpdateDevice(dev);
1835
1835 - if (dev.policy.amtPolicy == 1) { // CCM deactivation policy, we are done.
1836 + if (dev.policy.amtPolicy == 1) { // Deactivation policy, we are done.
1837 dev.consoleMsg("Deactivation successful.");
1838 dev.consoleMsg("Done.");
1839 removeAmtDevice(dev);
views/default.handlebars
+3 -3
@@ -9421,7 +9421,7 @@
9421 // Intel AMT setup
9422 var intelAmtPolicy = "No Policy";
9423 if (currentMesh.amt) {
9424 - if (currentMesh.amt.type == 1) { intelAmtPolicy = 'Deactivate Client Control Mode (CCM)'; }
9424 + if (currentMesh.amt.type == 1) { intelAmtPolicy = 'Deactivate'; }
9425 else if (currentMesh.amt.type == 2) {
9426 intelAmtPolicy = "Simple Client Control Mode (CCM)";
9427 if (currentMesh.amt.cirasetup == 2) { intelAmtPolicy += " + CIRA"; }
@@ -9519,7 +9519,7 @@
9519 if (xxdialogMode) return;
9520 var x = '', acmoption = '';
9521 if ((features & 0x100000) != 0) { acmoption = '<option value=3>' + "Simple Admin Control Mode (ACM)" + '</option>'; }
9522 - x += addHtmlValue("Type", '<select id=dp20amtpolicy style=width:230px onchange=p20editMeshAmtChange()><option value=0>' + "No Policy" + '</option><option value=1>' + "Deactivate Client Control Mode (CCM)" + '</option><option value=2>' + "Simple Client Control Mode (CCM)" + '</option>' + acmoption + '<option value=4>' + "Fully Automatic" + '</option></select>');
9522 + x += addHtmlValue("Type", '<select id=dp20amtpolicy style=width:230px onchange=p20editMeshAmtChange()><option value=0>' + "No Policy" + '</option><option value=1>' + "Deactivate" + '</option><option value=2>' + "Simple Client Control Mode (CCM)" + '</option>' + acmoption + '<option value=4>' + "Fully Automatic" + '</option></select>');
9523 x += '<div id=dp20amtpolicydiv></div>';
9524 setDialogMode(2, "Intel&reg; AMT Policy", 3, p20editMeshAmtEx, x);
9525 if (currentMesh.amt) { Q('dp20amtpolicy').value = currentMesh.amt.type; }
@@ -9553,7 +9553,7 @@
9553 }
9554 }
9555 if (ptype == 0) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/rcheckbox60.png width=60 height=60><td>' + "When this policy is selected, Intel&reg; AMT is not managed by this server. Intel AMT can still be used by manually activating and configuring it." + '</table>'; }
9556 - if (ptype == 1) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/rcheckbox60.png width=60 height=60><td>' + "When this policy is selected, any Intel&reg; AMT in Client Control Mode (CCM) will be deactivated. Devices in Admin Control Mode (ACM) can still be managed manually." + '</table>'; }
9556 + if (ptype == 1) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/rcheckbox60.png width=60 height=60><td>' + "When this policy is selected, any Intel&reg; AMT in Client Control Mode (CCM) will be deactivated. Other devices will have CIRA cleared and can still be managed manually." + '</table>'; }
9557 if (ptype == 4) { x = '<table style=padding-top:4px><tr><td><img style=padding-right:8px src=images/checkbox60.png width=60 height=60><td>' + "This is the recommanded policy. Intel&reg; AMT activation and management is completely automated and the server will attempt to make best possible use of hardware management." + '</table>'; }
9558 QH('dp20amtpolicydiv', x);
9559 setTimeout(dp20amtValidatePolicy, 1);