Reverse proxy improvements.
Ylian Saint-Hilaire committed
Oct 29, 2019 at 16:31 UTC
33eca58670502603ddfe5bb3c4291956273ed719
3 files changed
+10
-9
meshagent.js
+1
-1
@@ -387,7 +387,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
387
if (parent.parent.supportsProxyCertificatesRequest !== false) {
388
obj.badWebCert = Buffer.from(parent.crypto.randomBytes(16), 'binary').toString('base64');
389
parent.wsagentsWithBadWebCerts[obj.badWebCert] = obj; // Add this agent to the list of of agents with bad web certificates.
390
- parent.parent.updateProxyCertificates();
390
+ parent.parent.updateProxyCertificates(false);
391
}
392
parent.agentStats.agentBadWebCertHashCount++;
393
console.log('Agent bad web cert hash (Agent:' + (Buffer.from(msg.substring(2, 50), 'binary').toString('hex').substring(0, 10)) + ' != Server:' + (Buffer.from(getWebCertHash(domain), 'binary').toString('hex').substring(0, 10)) + ' or ' + (new Buffer(getWebCertFullHash(domain), 'binary').toString('hex').substring(0, 10)) + '), holding connection (' + obj.remoteaddrport + ').');
meshcentral.js
+8
-7
@@ -862,7 +862,7 @@ function CreateMeshCentralServer(config, args) {
862
}
863
}
864
865
- if (obj.supportsProxyCertificatesRequest == true) { obj.updateProxyCertificates(); }
865
+ if (obj.supportsProxyCertificatesRequest == true) { obj.updateProxyCertificates(true); }
866
obj.StartEx4(); // Keep going
867
}
868
@@ -1022,14 +1022,15 @@ function CreateMeshCentralServer(config, args) {
1022
obj.pendingProxyCertificatesRequests = 0;
1023
obj.lastProxyCertificatesRequest = null;
1024
obj.supportsProxyCertificatesRequest = false;
1025
- obj.updateProxyCertificates = function () {
1026
- var i;
1027
- if ((obj.pendingProxyCertificatesRequests > 0) || (obj.supportsProxyCertificatesRequest == false)) { return; }
1028
- if ((obj.lastProxyCertificatesRequest != null) && ((Date.now() - obj.lastProxyCertificatesRequest) < 120000)) { return; } // Don't allow this call more than every 2 minutes.
1029
- obj.lastProxyCertificatesRequest = Date.now();
1025
+ obj.updateProxyCertificates = function (force) {
1026
+ if (force !== true) {
1027
+ if ((obj.pendingProxyCertificatesRequests > 0) || (obj.supportsProxyCertificatesRequest == false)) return;
1028
+ if ((obj.lastProxyCertificatesRequest != null) && ((Date.now() - obj.lastProxyCertificatesRequest) < 120000)) return; // Don't allow this call more than every 2 minutes.
1029
+ obj.lastProxyCertificatesRequest = Date.now();
1030
+ }
1031
1032
// Load any domain web certificates
1032
- for (i in obj.config.domains) {
1033
+ for (var i in obj.config.domains) {
1034
if (obj.config.domains[i].certurl != null) {
1035
// Load web certs
1036
obj.pendingProxyCertificatesRequests++;
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.3-p",
3
+ "version": "0.4.3-q",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",