Sfoglia il codice sorgente

HUE-3975 [core] Rename login_lock_out_by_combination_user_and_ip to login_lock_out_use_user_agent

Jenny Kim 9 anni fa
parent
commit
37edd6d544

+ 3 - 2
desktop/conf.dist/hue.ini

@@ -299,8 +299,9 @@
     # If set, defines period of inactivity in seconds after which failed logins will be forgotten
     ## login_cooloff_time=60
 
-    # If True, lock out based on IP and browser user agent
-    ## login_lock_out_by_combination_browser_user_agent_and_ip=false
+    # If True, lock out based on an IP address AND a user agent.
+    # This means requests from different user agents but from the same IP are treated differently.
+    ## login_lock_out_use_user_agent=false
 
     # If True, lock out based on IP and user
     ## login_lock_out_by_combination_user_and_ip=false

+ 3 - 2
desktop/conf/pseudo-distributed.ini.tmpl

@@ -303,8 +303,9 @@
     # If set, defines period of inactivity in seconds after which failed logins will be forgotten
     ## login_cooloff_time=60
 
-    # If True, lock out based on IP and browser user agent
-    ## login_lock_out_by_combination_browser_user_agent_and_ip=false
+    # If True, lock out based on an IP address AND a user agent.
+    # This means requests from different user agents but from the same IP are treated differently.
+    ## login_lock_out_use_user_agent=false
 
     # If True, lock out based on IP and user
     ## login_lock_out_by_combination_user_and_ip=false

+ 14 - 1
desktop/core/src/desktop/conf.py

@@ -382,6 +382,10 @@ def default_ssl_validate():
   return SSL_VALIDATE.get()
 
 
+def get_deprecated_login_lock_out_by_combination_browser_user_agent():
+  return AUTH.LOGIN_LOCK_OUT_BY_COMBINATION_BROWSER_USER_AGENT_AND_IP.get()
+
+
 SMTP = ConfigSection(
   key='smtp',
   help=_('Configuration options for connecting to an external SMTP server.'),
@@ -723,12 +727,20 @@ AUTH = ConfigSection(
       type=coerce_timedelta,
       default=None,
     ),
-    LOGIN_LOCK_OUT_BY_COMBINATION_BROWSER_USER_AGENT_AND_IP = Config(
+    # Deprecated by LOGIN_LOCK_OUT_USE_USER_AGENT
+    LOGIN_LOCK_OUT_BY_COMBINATION_BROWSER_USER_AGENT_AND_IP=Config(
       key="login_lock_out_by_combination_browser_user_agent_and_ip",
       help=_("If True, lock out based on IP and browser user agent"),
       type=coerce_bool,
       default=False,
     ),
+    LOGIN_LOCK_OUT_USE_USER_AGENT = Config(
+      key="login_lock_out_use_user_agent",
+      help=_("If True, lock out based on an IP address AND a user agent."
+             "This means requests from different user agents but from the same IP are treated differently."),
+      type=coerce_bool,
+      dynamic_default=get_deprecated_login_lock_out_by_combination_browser_user_agent
+    ),
     LOGIN_LOCK_OUT_BY_COMBINATION_USER_AND_IP = Config(
       key="login_lock_out_by_combination_user_and_ip",
       help=_("If True, lock out based on IP and user"),
@@ -737,6 +749,7 @@ AUTH = ConfigSection(
     ),
 ))
 
+
 LDAP = ConfigSection(
   key="ldap",
   help=_("Configuration options for LDAP connectivity."),

+ 1 - 1
desktop/core/src/desktop/settings.py

@@ -394,7 +394,7 @@ else:
 AXES_LOGIN_FAILURE_LIMIT = desktop.conf.AUTH.LOGIN_FAILURE_LIMIT.get()
 AXES_LOCK_OUT_AT_FAILURE = desktop.conf.AUTH.LOGIN_LOCK_OUT_AT_FAILURE.get()
 AXES_COOLOFF_TIME = desktop.conf.AUTH.LOGIN_COOLOFF_TIME.get()
-AXES_USE_USER_AGENT = desktop.conf.AUTH.LOGIN_LOCK_OUT_BY_COMBINATION_BROWSER_USER_AGENT_AND_IP.get()
+AXES_USE_USER_AGENT = desktop.conf.AUTH.LOGIN_LOCK_OUT_USE_USER_AGENT.get()
 AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP = desktop.conf.AUTH.LOGIN_LOCK_OUT_BY_COMBINATION_USER_AND_IP.get()
 
 # SAML