Added Intel AMT CCM to ACM activation.
Ylian Saint-Hilaire committed
Oct 22, 2020 at 20:54 UTC
56c4346ebe57713266b1b661e85dd756e5bf487e
1 file changed
+23
-7
amtmanager.js
+23
-7
@@ -353,6 +353,11 @@ module.exports.CreateAmtManager = function (parent) {
353
activateIntelAmt(dev);
354
return;
355
}
356
+ // Check if we have an ACM activation policy, but the device is in CCM
357
+ if ((dev.policy.amtPolicy == 3) && ((dev.mpsConnection.tag.meiState.Flags & 2) != 0)) {
358
+ // This device in is CCM, check if we can upgrade to ACM
359
+ if (activateIntelAmt(dev) == false) return; // If this return true, the platform is in CCM and can't go to ACM, keep going with management.
360
+ }
361
// Intel AMT CCM deactivation policy
362
if (dev.policy.amtPolicy == 1) {
363
if ((dev.mpsConnection.tag.meiState.ProvisioningState == 2) && ((dev.mpsConnection.tag.meiState.Flags & 2) != 0)) {
@@ -994,11 +999,11 @@ module.exports.CreateAmtManager = function (parent) {
999
for (var j in devProfiles) { if (devProfiles[j].match == true) { prioritiesInUse.push(devProfiles[j].Priority); } }
1000
1001
// Notify of WIFI profile changes
997
- if ((profilesToAdd.length > 0) && (profilesToRemove.length > 0)) { dev.consoleMsg("Changing WIFI profiles, adding " + profilesToAdd.length + ", removing " + profilesToRemove.length + "."); }
1002
+ if ((profilesToAdd.length > 0) || (profilesToRemove.length > 0)) { dev.consoleMsg("Changing WIFI profiles, adding " + profilesToAdd.length + ", removing " + profilesToRemove.length + "."); }
1003
1004
// Remove any extra WIFI profiles
1005
for (var i in profilesToRemove) {
1001
- dev.amtstack.Delete('CIM_WiFiEndpointSettings', { InstanceID: 'Intel(r) AMT:WiFi Endpoint Settings ' + profilesToRemove[i].ElementName }, function (stack, name, responses, status) { console.log('removed', status); }, 0, 1);
1006
+ dev.amtstack.Delete('CIM_WiFiEndpointSettings', { InstanceID: 'Intel(r) AMT:WiFi Endpoint Settings ' + profilesToRemove[i].ElementName }, function (stack, name, responses, status) { }, 0, 1);
1007
}
1008
1009
// Add missing WIFI profiles
@@ -1023,7 +1028,7 @@ module.exports.CreateAmtManager = function (parent) {
1028
PSKPassPhrase: profileToAdd.password
1029
}
1030
prioritiesInUse.push(nextPriority); // Occupy the priority slot and add the WIFI profile.
1026
- dev.amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings(wifiep, wifiepsettinginput, null, null, null, function (stack, name, responses, status) { console.log('added', status); });
1031
+ dev.amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings(wifiep, wifiepsettinginput, null, null, null, function (stack, name, responses, status) { });
1032
}
1033
1034
// Compute how many WIFI profiles will be in the device and change the state if needed
@@ -1566,20 +1571,31 @@ module.exports.CreateAmtManager = function (parent) {
1571
function activateIntelAmt(dev) {
1572
// Find the Intel AMT policy
1573
const mesh = parent.webserver.meshes[dev.meshid];
1569
- if (mesh == null) { dev.consoleMsg("Unable to find device group."); removeAmtDevice(dev); return; }
1574
+ if (mesh == null) { dev.consoleMsg("Unable to find device group."); removeAmtDevice(dev); return false; }
1575
var amtPolicy = 0; // 0 = Do nothing, 1 = Deactivate CCM, 2 = CCM, 3 = ACM
1576
if (mesh.amt != null) { if (mesh.amt.type) { amtPolicy = mesh.amt.type; } }
1577
if ((typeof dev.mpsConnection.tag.meiState.OsAdmin != 'object') || (typeof dev.mpsConnection.tag.meiState.OsAdmin.user != 'string') || (typeof dev.mpsConnection.tag.meiState.OsAdmin.pass != 'string')) { amtPolicy = 0; }
1573
- if (amtPolicy == 0) { removeAmtDevice(dev); return; } // Do nothing, we should not have gotten this CIRA-LMS connection.
1578
+ if (amtPolicy == 0) { removeAmtDevice(dev); return false; } // Do nothing, we should not have gotten this CIRA-LMS connection.
1579
if (amtPolicy == 2) { activateIntelAmtCcm(dev, mesh.amt.password); } // Activate to CCM policy
1580
if (amtPolicy == 3) { // Activate to ACM policy
1581
var acminfo = checkAcmActivation(dev);
1582
if (acminfo == null) {
1578
- activateIntelAmtCcm(dev, mesh.amt.password); // No ACM certificate found, fallback to CCM.
1583
+ // No opportunity to activate to ACM, check if we are already in CCM
1584
+ if ((dev.mpsConnection.tag.meiState.Flags & 2) != 0) return true; // We are in CCM, keep going
1585
+ // We are not already in CCM, go to CCM now
1586
+ activateIntelAmtCcm(dev, mesh.amt.password);
1587
} else {
1580
- activateIntelAmtAcm(dev, mesh.amt.password, acminfo); // Found a certificate, activate to ACM.
1588
+ // Found a certificate to activate to ACM.
1589
+ if ((dev.mpsConnection.tag.meiState.Flags & 2) != 0) {
1590
+ // We are in CCM, deactivate CCM first.
1591
+ deactivateIntelAmtCCM(dev);
1592
+ } else {
1593
+ // We are not activated now, go to ACM directly.
1594
+ activateIntelAmtAcm(dev, mesh.amt.password, acminfo);
1595
+ }
1596
}
1597
}
1598
+ return false;
1599
}
1600
1601
function activateIntelAmtCcm(dev, password) {