Include agentKey check at agent only port

This commit is contained in:
Noah Zalev 2022-01-18 09:21:09 -05:00
parent 0290ba7f8b
commit 4d80499d8f
1 changed files with 1 additions and 1 deletions

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); }
});