From ba716be0f356eee6f4ba693885129156653e51b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Fri, 12 Mar 2021 15:07:03 +0100 Subject: [PATCH] Added actor block on failure security config --- server/src/uds/REST/methods/actor_v3.py | 2 ++ server/src/uds/core/util/config.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/server/src/uds/REST/methods/actor_v3.py b/server/src/uds/REST/methods/actor_v3.py index ab54bb79b..905a667ee 100644 --- a/server/src/uds/REST/methods/actor_v3.py +++ b/server/src/uds/REST/methods/actor_v3.py @@ -66,6 +66,8 @@ class BlockAccess(Exception): # Helpers def checkBlockedIp(ip: str)-> None: + if GlobalConfig.BLOCK_ACTOR_FAILURES.getBool() is False: + return cache = Cache('actorv3') fails = cache.get(ip) or 0 if fails > ALLOWED_FAILS: diff --git a/server/src/uds/core/util/config.py b/server/src/uds/core/util/config.py index ea84d6dc9..53c0f80d8 100644 --- a/server/src/uds/core/util/config.py +++ b/server/src/uds/core/util/config.py @@ -314,6 +314,9 @@ class GlobalConfig: # If we use new logout mechanics EXCLUSIVE_LOGOUT: Config.Value = Config.section(SECURITY_SECTION).value('Exclusive Logout', '0', type=Config.BOOLEAN_FIELD) + # Enable/Disable Actor attack block + BLOCK_ACTOR_FAILURES: Config.Value = Config.section(SECURITY_SECTION).value('Block actor failures', '1', type=Config.BOOLEAN_FIELD) + # Clusters related vars # Maximum desired CPU Load. If cpu is over this value, a migration of a service is "desirable"