From 260aa5e8f17b58e60e80232010142066f930120b Mon Sep 17 00:00:00 2001 From: downhill Date: Tue, 23 Oct 2018 16:40:34 +0200 Subject: [PATCH] config for searchuser added --- dal/dal/settings.py | 9 +++++++-- dal/djangoldap.conf.example | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 dal/djangoldap.conf.example diff --git a/dal/dal/settings.py b/dal/dal/settings.py index efa4353..acd7ac8 100644 --- a/dal/dal/settings.py +++ b/dal/dal/settings.py @@ -16,12 +16,17 @@ import ldap from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion +from configparser import ConfigParser + +config = ConfigParser() +config.read('djangoldap.conf') + # LDAP config # The search user -AUTH_LDAP_BIND_DN = "" +AUTH_LDAP_BIND_DN = config['LDAP']['SEARCHUSER'] # The password for the search user -AUTH_LDAP_BIND_PASSWORD = "" +AUTH_LDAP_BIND_PASSWORD = config['LDAP']['SEARCHUSERPASSWORD'] # Search union over two ou AUTH_LDAP_USER_SEARCH = LDAPSearchUnion( LDAPSearch("ou=users,dc=ungleich,dc=ch", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"), diff --git a/dal/djangoldap.conf.example b/dal/djangoldap.conf.example new file mode 100644 index 0000000..e44099d --- /dev/null +++ b/dal/djangoldap.conf.example @@ -0,0 +1,5 @@ +[LDAP] + +# Set up the user which can search +SEARCHUSER = uid=search,ou=system,dc=ungleich,dc=ch +SEARCHUSERPASSWORD = fnord