Improved AMT manager tracing.
Ylian Saint-Hilaire committed
Jan 7, 2021 at 01:29 UTC
b9eff75127cee8b58367677017f5a51c79385268
1 file changed
+11
-11
amtmanager.js
+11
-11
@@ -115,7 +115,7 @@ module.exports.CreateAmtManager = function (parent) {
115
116
// Remove an Intel AMT managed device
117
function removeAmtDevice(dev) {
118
- parent.debug('amt', "Remove device", dev.nodeid, dev.connType);
118
+ parent.debug('amt', dev.name, "Remove device", dev.nodeid, dev.connType);
119
120
// Find the device in the list
121
var devices = obj.amtDevices[dev.nodeid];
@@ -175,7 +175,7 @@ module.exports.CreateAmtManager = function (parent) {
175
dev = { nodeid: nodeid, connType: connType, domainid: nodeid.split('/')[1] };
176
if (typeof connection == 'string') { dev.host = connection; }
177
if (typeof connection == 'object') { dev.mpsConnection = connection; }
178
- dev.consoleMsg = function deviceConsoleMsg(msg) { if (typeof deviceConsoleMsg.conn == 'object') { deviceConsoleMsg.conn.ControlMsg({ action: 'console', msg: msg }); } }
178
+ dev.consoleMsg = function deviceConsoleMsg(msg) { parent.debug('amt', deviceConsoleMsg.dev.name, msg); if (typeof deviceConsoleMsg.conn == 'object') { deviceConsoleMsg.conn.ControlMsg({ action: 'console', msg: msg }); } }
179
dev.consoleMsg.conn = connection;
180
dev.consoleMsg.dev = dev;
181
dev.controlMsg = function deviceControlMsg(msg) { if (typeof deviceControlMsg.conn == 'object') { deviceControlMsg.conn.ControlMsg(msg); } }
@@ -201,7 +201,7 @@ module.exports.CreateAmtManager = function (parent) {
201
var devices = obj.amtDevices[nodeid], dev = null;
202
if (devices != null) { for (var i in devices) { if ((devices[i].mpsConnection == connection) || (devices[i].host == connection)) { dev = devices[i]; } } }
203
if (dev == null) return false; // We are not managing this device on this connection
204
- parent.debug('amt', "Stop Management", nodeid, connType);
204
+ parent.debug('amt', dev.name, "Stop Management", nodeid, connType);
205
return removeAmtDevice(dev);
206
}
207
@@ -358,7 +358,7 @@ module.exports.CreateAmtManager = function (parent) {
358
// Attempt to perform initial contact with Intel AMT
359
function attemptInitialContact(dev) {
360
delete dev.amtstack; // If there is a WSMAn stack setup, clean it up now.
361
- parent.debug('amt', "Attempt Initial Contact", dev.name, ["CIRA", "CIRA-Relay", "CIRA-LMS", "Local"][dev.connType]);
361
+ parent.debug('amt', dev.name, "Attempt Initial Contact", ["CIRA", "CIRA-Relay", "CIRA-LMS", "Local"][dev.connType]);
362
363
// Check Intel AMT policy when CIRA-LMS connection is in use.
364
if ((dev.connType == 2) && (dev.mpsConnection != null) && (dev.mpsConnection.tag != null) && (dev.mpsConnection.tag.meiState != null)) {
@@ -410,7 +410,7 @@ module.exports.CreateAmtManager = function (parent) {
410
if (dotls == -1) { removeAmtDevice(dev); return; } // The Intel AMT ports are not open, not a device we can deal with.
411
412
// Connect now
413
- parent.debug('amt', 'CIRA-Connect', (dotls == 1) ? "TLS" : "NoTLS", dev.name, user, pass);
413
+ parent.debug('amt', dev.name, 'CIRA-Connect', (dotls == 1) ? "TLS" : "NoTLS", user, pass);
414
var comm;
415
if (dotls == 1) {
416
comm = CreateWsmanComm(dev.nodeid, 16993, user, pass, 1, null, ciraconn); // Perform TLS
@@ -439,11 +439,11 @@ module.exports.CreateAmtManager = function (parent) {
439
// Connect now
440
var comm;
441
if (dev.tlsfail !== true) {
442
- parent.debug('amt', (dev.connType == 1) ? 'Relay-Connect' : 'LMS-Connect', "TLS", dev.name, user, pass);
442
+ parent.debug('amt', dev.name, (dev.connType == 1) ? 'Relay-Connect' : 'LMS-Connect', "TLS", user, pass);
443
comm = CreateWsmanComm(dev.nodeid, 16993, user, pass, 1, null, ciraconn); // Perform TLS
444
comm.xtlsFingerprint = 0; // Perform no certificate checking
445
} else {
446
- parent.debug('amt', (dev.connType == 1) ? 'Relay-Connect' : 'LMS-Connect', "NoTLS", dev.name, user, pass);
446
+ parent.debug('amt', dev.name, (dev.connType == 1) ? 'Relay-Connect' : 'LMS-Connect', "NoTLS", user, pass);
447
comm = CreateWsmanComm(dev.nodeid, 16992, user, pass, 0, null, ciraconn); // No TLS
448
}
449
var wsstack = WsmanStackCreateService(comm);
@@ -453,7 +453,7 @@ module.exports.CreateAmtManager = function (parent) {
453
break;
454
case 3: // Local LAN
455
// Handle the case where the Intel AMT local scanner found the device (connType 3)
456
- parent.debug('amt', "Attempt Initial Local Contact", dev.name, dev.connType, dev.host);
456
+ parent.debug('amt', dev.name, "Attempt Initial Local Contact", dev.connType, dev.host);
457
if (typeof dev.host != 'string') { removeAmtDevice(dev); return; } // Local connection not valid
458
459
// Since we don't allow two or more connections to the same host, check if a pending connection is active.
@@ -474,11 +474,11 @@ module.exports.CreateAmtManager = function (parent) {
474
// Connect now
475
var comm;
476
if (dev.tlsfail !== true) {
477
- parent.debug('amt', 'Direct-Connect', "TLS", dev.name, dev.host, user, pass);
477
+ parent.debug('amt', dev.name, 'Direct-Connect', "TLS", dev.host, user);
478
comm = CreateWsmanComm(dev.host, 16993, user, pass, 1); // Always try with TLS first
479
comm.xtlsFingerprint = 0; // Perform no certificate checking
480
} else {
481
- parent.debug('amt', 'Direct-Connect', "NoTLS", dev.name, dev.host, user, pass);
481
+ parent.debug('amt', dev.name, 'Direct-Connect', "NoTLS", dev.host, user);
482
comm = CreateWsmanComm(dev.host, 16992, user, pass, 0); // Try without TLS
483
}
484
var wsstack = WsmanStackCreateService(comm);
@@ -494,7 +494,7 @@ module.exports.CreateAmtManager = function (parent) {
494
495
function attemptLocalConnectResponse(stack, name, responses, status) {
496
const dev = stack.dev;
497
- parent.debug('amt', "Initial Contact Response", dev.name, status);
497
+ parent.debug('amt', dev.name, "Initial Contact Response", status);
498
499
// If this is a local connection device, release active connection to this host.
500
if (dev.connType == 3) { delete obj.activeLocalConnections[dev.host]; }