From 72fbd0e94aeef2120072ee7939d32b606b14fe4f Mon Sep 17 00:00:00 2001 From: Sylvain Calador Date: Thu, 8 Mar 2018 22:53:26 +0100 Subject: [PATCH] [IMP] add a jocker '*' for discover or log all request environment variables --- auth_brute_force/README.rst | 7 ++++++- auth_brute_force/controllers/controllers.py | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/auth_brute_force/README.rst b/auth_brute_force/README.rst index 9b639574e..79ed0057e 100644 --- a/auth_brute_force/README.rst +++ b/auth_brute_force/README.rst @@ -39,9 +39,14 @@ of attempts allowed before the user was banned. You can also add a ir.config_parameter value for the key 'auth_brute_force.environ_log' which allows to log also specific request -environment variables. The format comma-delimited list of varible names +environment variables. + +The format is a comma-delimited list of variable names example: REMOTE_ADDR,REMOTE_PORT +or you can just use the jocker '*' for log or discover all variables, +the variable names depends of the reverse-proxy configuration. + Usage ----- diff --git a/auth_brute_force/controllers/controllers.py b/auth_brute_force/controllers/controllers.py index 14fa09e0f..acee0f3c6 100644 --- a/auth_brute_force/controllers/controllers.py +++ b/auth_brute_force/controllers/controllers.py @@ -76,10 +76,10 @@ class LoginController(Home): environ = '' if environ_log: - value = environ_log[0]['value'] - log_keys = [k.strip() for k in value.split(',')] + filter_value = environ_log[0]['value'] + filter_keys = [k.strip() for k in filter_value.split(',')] for key, value in request.httprequest.environ.items(): - if key in log_keys: + if key in filter_keys or filter_value == '*': environ += '%s=%s\n' % (key, value) attempt_obj.create(cursor, SUPERUSER_ID, {