From 112298cf849cdd361e677c6c436b98fe3099131c Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 11 Apr 2021 22:44:43 -0700 Subject: [PATCH] Fix for #2498 --- amt/amt-wsman-comm.js | 7 ++++++- mpsserver.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/amt/amt-wsman-comm.js b/amt/amt-wsman-comm.js index d243ea18..696e001d 100644 --- a/amt/amt-wsman-comm.js +++ b/amt/amt-wsman-comm.js @@ -471,7 +471,12 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions, mpsConn obj.destroy = function () { if (obj.socket != null) { - if (obj.socket.removeAllListeners) { obj.socket.removeAllListeners(); } + if (obj.socket.removeAllListeners) { + // Do not remove the error handler since it may still get triggered. + obj.socket.removeAllListeners('data'); + obj.socket.removeAllListeners('close'); + obj.socket.removeAllListeners('timeout'); + } try { if (obj.mpsConnection == null) { obj.socket.destroy(); diff --git a/mpsserver.js b/mpsserver.js index d9bffe16..b217bd70 100644 --- a/mpsserver.js +++ b/mpsserver.js @@ -42,7 +42,7 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) { if (obj.args.mpstlsoffload) { obj.server = net.createServer(onConnection); } else { - // Note that in oder to support older Intel AMT CIRA connections, we have to turn on TLSv1. + // Note that in order to support older Intel AMT CIRA connections, we have to turn on TLSv1. 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); //obj.server.on('error', function () { console.log('MPS tls server error'); }); obj.server.on('newSession', function (id, data, cb) { if (tlsSessionStoreCount > 1000) { tlsSessionStoreCount = 0; tlsSessionStore = {}; } tlsSessionStore[id.toString('hex')] = data; tlsSessionStoreCount++; cb(); });