mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 22:25:52 -05:00
Disconnect agents that send the same console value in a loop.
This commit is contained in:
parent
42a0ff960b
commit
aed785f147
11
meshagent.js
11
meshagent.js
@ -1203,6 +1203,17 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
switch (command.action) {
|
||||
case 'msg':
|
||||
{
|
||||
// If the same console command is processed many times, kick out this agent.
|
||||
// This is a safety mesure to guard against the agent DOS'ing the server.
|
||||
if (command.type == 'console') {
|
||||
if (obj.consoleKickValue == command.value) {
|
||||
if (obj.consoleKickCount) { obj.consoleKickCount++; } else { obj.consoleKickCount = 1; }
|
||||
if (obj.consoleKickCount > 30) { obj.close(); return; } // 30 identical console messages received, kick out this agent.
|
||||
} else {
|
||||
obj.consoleKickValue = command.value;
|
||||
}
|
||||
}
|
||||
|
||||
// Route a message
|
||||
parent.routeAgentCommand(command, obj.domain.id, obj.dbNodeKey, obj.dbMeshKey);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user