Merge pull request #3478 from nzalev/fix-agentKeys-agentPort

Include agentKey check at agent only port
This commit is contained in:
Ylian Saint-Hilaire 2022-01-18 10:04:38 -08:00 committed by GitHub
commit 0eb269bc0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6339,7 +6339,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
obj.agentapp.ws(url + 'agent.ashx', function (ws, req) {
var domain = checkAgentIpAddress(ws, req);
if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; }
//console.log('Agent connect: ' + req.clientIp);
if (domain.agentkey && ((req.query.key == null) || (domain.agentkey.indexOf(req.query.key) == -1))) { return; } // If agent key is required and not provided or not valid, just hold the websocket and do nothing.
try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); }
});