Include agentKey check at agent only port
Noah Zalev committed
Jan 18, 2022 at 09:21 UTC
4d80499d8f264454751f2cb4f42a52d1b32a1c92
1 file changed
+1
-1
webserver.js
+1
-1
@@ -6339,7 +6339,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
6339
obj.agentapp.ws(url + 'agent.ashx', function (ws, req) {
6340
var domain = checkAgentIpAddress(ws, req);
6341
if (domain == null) { parent.debug('web', 'Got agent connection with bad domain or blocked IP address ' + req.clientIp + ', holding.'); return; }
6342
- //console.log('Agent connect: ' + req.clientIp);
6342
+ 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.
6343
try { obj.meshAgentHandler.CreateMeshAgent(obj, obj.db, ws, req, obj.args, domain); } catch (e) { console.log(e); }
6344
});
6345