mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-24 12:20:54 -04: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) {
|
switch (command.action) {
|
||||||
case 'msg':
|
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
|
// Route a message
|
||||||
parent.routeAgentCommand(command, obj.domain.id, obj.dbNodeKey, obj.dbMeshKey);
|
parent.routeAgentCommand(command, obj.domain.id, obj.dbNodeKey, obj.dbMeshKey);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user