Fix for #2498

Ylian Saint-Hilaire committed Apr 11, 2021 at 22:44 UTC 112298cf849cdd361e677c6c436b98fe3099131c
2 files changed +7 -2
amt/amt-wsman-comm.js
+6 -1
@@ -471,7 +471,12 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn
471
472 obj.destroy = function () {
473 if (obj.socket != null) {
474 - if (obj.socket.removeAllListeners) { obj.socket.removeAllListeners(); }
474 + if (obj.socket.removeAllListeners) {
475 + // Do not remove the error handler since it may still get triggered.
476 + obj.socket.removeAllListeners('data');
477 + obj.socket.removeAllListeners('close');
478 + obj.socket.removeAllListeners('timeout');
479 + }
480 try {
481 if (obj.mpsConnection == null) {
482 obj.socket.destroy();
mpsserver.js
+1 -1
@@ -42,7 +42,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
42 if (obj.args.mpstlsoffload) {
43 obj.server = net.createServer(onConnection);
44 } else {
45 - // Note that in oder to support older Intel AMT CIRA connections, we have to turn on TLSv1.
45 + // Note that in order to support older Intel AMT CIRA connections, we have to turn on TLSv1.
46 obj.server = tls.createServer({ key: certificates.mps.key, cert: certificates.mps.cert, minVersion: 'TLSv1', requestCert: true, rejectUnauthorized: false, ciphers: "HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA", secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION }, onConnection);
47 //obj.server.on('error', function () { console.log('MPS tls server error'); });
48 obj.server.on('newSession', function (id, data, cb) { if (tlsSessionStoreCount > 1000) { tlsSessionStoreCount = 0; tlsSessionStore = {}; } tlsSessionStore[id.toString('hex')] = data; tlsSessionStoreCount++; cb(); });