Added actor block on failure security config

This commit is contained in:
Adolfo Gómez García 2021-03-12 15:07:03 +01:00
parent 1505fd346b
commit ba716be0f3
2 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,8 @@ class BlockAccess(Exception):
# Helpers # Helpers
def checkBlockedIp(ip: str)-> None: def checkBlockedIp(ip: str)-> None:
if GlobalConfig.BLOCK_ACTOR_FAILURES.getBool() is False:
return
cache = Cache('actorv3') cache = Cache('actorv3')
fails = cache.get(ip) or 0 fails = cache.get(ip) or 0
if fails > ALLOWED_FAILS: if fails > ALLOWED_FAILS:

View File

@ -314,6 +314,9 @@ class GlobalConfig:
# If we use new logout mechanics # If we use new logout mechanics
EXCLUSIVE_LOGOUT: Config.Value = Config.section(SECURITY_SECTION).value('Exclusive Logout', '0', type=Config.BOOLEAN_FIELD) 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 # Clusters related vars
# Maximum desired CPU Load. If cpu is over this value, a migration of a service is "desirable" # Maximum desired CPU Load. If cpu is over this value, a migration of a service is "desirable"