I'm attempting to setup django_auth_ldap against an openldap server
and am not having much luck.
This is the initial login and a subsequent login from the debug.log:
===============================================================
search_s('ou=People,o=mtt', 2, '(uid=jschroeder)') returned 1 objects:
uid=jschroeder,ou=People,o=int
search_s('ou=People,o=mtt', 2, '(uid=jschroeder)') returned 1 objects:
uid=jschroeder,ou=People,o=int
Created Django user jschroeder
Created Django user jschroeder
Populating Django user jschroeder
Populating Django user jschroeder
Caught LDAPError while authenticating jschroeder:
NO_SUCH_ATTRIBUTE({'desc': 'No such attribute'},)
Caught LDAPError while authenticating jschroeder:
NO_SUCH_ATTRIBUTE({'desc': 'No such attribute'},)
search_s('ou=People,o=mtt', 2, '(uid=jschroeder)') returned 1 objects:
uid=jschroeder,ou=People,o=int
search_s('ou=People,o=mtt', 2, '(uid=jschroeder)') returned 1 objects:
uid=jschroeder,ou=People,o=int
Populating Django user jschroeder
Populating Django user jschroeder
Caught LDAPError while authenticating jschroeder:
NO_SUCH_ATTRIBUTE({'desc': 'No such attribute'},)
Caught LDAPError while authenticating jschroeder:
NO_SUCH_ATTRIBUTE({'desc': 'No such attribute'},)
===============================================================
I copied and edited this to taste:
http://packages.python.org/django-auth-ldap/#example-configuration and
came up with this:
===============================================================
import logging, logging.handlers
LOG_FILENAME = "/tmp/django-ldap/debug.log"
my_logger = logging.getLogger('django_auth_ldap')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.RotatingFileHandler(
LOG_FILENAME, maxBytes=1024 * 500, backupCount=5)
my_logger.addHandler(handler)
# Baseline configuration.
AUTH_LDAP_SERVER_URI = "ldap://
ldap.site1.int"
# Disabled for now
#AUTH_LDAP_BIND_DN = "cn=django-agent,dc=example,dc=com"
#AUTH_LDAP_BIND_PASSWORD = "phlebotinum"
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=People,o=int",
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
# or perhaps:
# AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=example,dc=com"
# Set up the basic group parameters.
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Groups,o=int",
ldap.SCOPE_SUBTREE, "(objectClass=posixGroup)"
)
AUTH_LDAP_GROUP_TYPE = GroupOfNamesType(name_attr="cn")
# Only users in this group can log in.
#AUTH_LDAP_REQUIRE_GROUP = "cn=enabled,ou=django,ou=groups,dc=example,dc=com"
# Populate the Django user from the LDAP directory.
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": "cn=users,ou=Groups,o=int",
"is_staff": "cn=users,ou=Groups,o=int",
"is_superuser": "cn=users,ou=Groups,o=int",
}
# This is the default, but I like to be explicit.
AUTH_LDAP_ALWAYS_UPDATE_USER = True
# Use LDAP group membership to calculate group permissions.
AUTH_LDAP_FIND_GROUP_PERMS = True
# Cache group memberships for an hour to minimize LDAP traffic
AUTH_LDAP_CACHE_GROUPS = True
AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600
# Keep ModelBackend around for per-user permissions and maybe a local
# superuser.
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
===============================================================
What am I doing wrong? This is for an ldap tree using the posixAccount
/ inetOrgPerson / posixGroup objectClasses.
Thankyou
--
Jeff Schroeder
Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com
--
Subscription settings:
http://groups.google.com/group/django-auth-ldap/subscribe?hl=en