From 5ff292ba5f2fdae32be1fc7204419ce3930e699b Mon Sep 17 00:00:00 2001 From: Vincent Catros Date: Mon, 20 Jun 2022 14:10:37 +0200 Subject: [PATCH 1/2] AUTH_LDAP_BIND_AS_AUTHENTICATING_USER is now loaded from environment --- configuration/ldap/ldap_config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configuration/ldap/ldap_config.py b/configuration/ldap/ldap_config.py index 3071b45..132996b 100644 --- a/configuration/ldap/ldap_config.py +++ b/configuration/ldap/ldap_config.py @@ -31,9 +31,12 @@ AUTH_LDAP_CONNECTION_OPTIONS = { ldap.OPT_REFERRALS: 0 } -# Set the DN and password for the NetBox service account. -AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '') -AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', '')) +AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = environ.get('AUTH_LDAP_BIND_AS_AUTHENTICATING_USER', 'True').lower() == 'true' + +# Set the DN and password for the NetBox service account if needed. +if not AUTH_LDAP_BIND_AS_AUTHENTICATING_USER: + AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '') + AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', '')) # Set a string template that describes any user’s distinguished name based on the username. AUTH_LDAP_USER_DN_TEMPLATE = environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None) From 7f285af7b4c7545e6a6406b53d133c540a08e3fb Mon Sep 17 00:00:00 2001 From: Vincent Catros Date: Fri, 9 Sep 2022 16:11:21 +0200 Subject: [PATCH 2/2] AUTH_LDAP_BIND_AS_AUTHENTICATING_USER defaults to false --- configuration/ldap/ldap_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/ldap/ldap_config.py b/configuration/ldap/ldap_config.py index 132996b..7fb62d7 100644 --- a/configuration/ldap/ldap_config.py +++ b/configuration/ldap/ldap_config.py @@ -31,7 +31,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = { ldap.OPT_REFERRALS: 0 } -AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = environ.get('AUTH_LDAP_BIND_AS_AUTHENTICATING_USER', 'True').lower() == 'true' +AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = environ.get('AUTH_LDAP_BIND_AS_AUTHENTICATING_USER', 'False').lower() == 'true' # Set the DN and password for the NetBox service account if needed. if not AUTH_LDAP_BIND_AS_AUTHENTICATING_USER: