Intel AMT password discovery added to amtactivation.log.
Ylian Saint-Hilaire committed
Apr 5, 2021 at 14:55 UTC
a32081d7d306e54f9dd7a80ea9af5d4b2f4c70be
2 files changed
+11
-4
amtmanager.js
+5
@@ -606,6 +606,11 @@ module.exports.CreateAmtManager = function (parent) {
606
if (stack.wsman.comm.xtls == 1) { dev.aquired.hash = stack.wsman.comm.xtlsCertificate.fingerprint.split(':').join('').toLowerCase(); } else { delete dev.aquired.hash; }
607
UpdateDevice(dev);
608
609
+ // If this is the new first user/pass for the device UUID, update the activation log now.
610
+ if ((parent.amtPasswords != null) && (dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null) && (dev.mpsConnection.tag.meiState.UUID != null) && (parent.amtPasswords[dev.mpsConnection.tag.meiState.UUID] != null) && (parent.amtPasswords[dev.mpsConnection.tag.meiState.UUID][0] != dev.aquired.pass)) {
611
+ parent.certificateOperations.logAmtActivation(parent.config.domains[dev.domainid], { time: new Date(), action: 'amtpassword', domain: dev.domainid, amtUuid: dev.mpsConnection.tag.meiState.UUID, amtRealm: dev.aquired.realm, user: dev.aquired.user, password: dev.aquired.pass, computerName: dev.name });
612
+ }
613
+
614
// Perform Intel AMT clock sync
615
attemptSyncClock(dev, function (dev) {
616
// Check Intel AMT TLS state
meshcentral.js
+6
-4
@@ -2700,14 +2700,16 @@ function CreateMeshCentralServer(config, args) {
2700
if (amtPasswords[j.amtUuid] == null) {
2701
amtPasswords[j.amtUuid] = [j.password]; // Add password to array
2702
} else {
2703
- if (amtPasswords[j.amtUuid].indexOf(j.password) == -1) {
2704
- amtPasswords[j.amtUuid].unshift(j.password); // Add password at the start of the array
2705
- while (amtPasswords[j.amtUuid].length > 3) { amtPasswords[j.amtUuid].pop(); } // Only keep the 3 last passwords for any given device
2706
- }
2703
+ amtPasswords[j.amtUuid].unshift(j.password); // Add password at the start of the array
2704
}
2705
}
2706
}
2707
}
2708
+ // Remove all duplicates and only keep the 3 last passwords for any given device
2709
+ for (var i in amtPasswords) {
2710
+ amtPasswords[i] = [...new Set(amtPasswords[i])];
2711
+ while (amtPasswords[i].length > 3) { amtPasswords[i].pop(); }
2712
+ }
2713
}
2714
func(obj.common.sortObj(amtPasswords)); // Sort by UUID
2715
});