cabotapp / docker-cabot

Docker and docker-compose files for Cabot
https://hub.docker.com/r/cabotapp/cabot/
58 stars 31 forks source link

some error about ldap #7

Closed gordanyang closed 6 years ago

gordanyang commented 7 years ago
web_1       | ERROR 2017-05-10 14:47:36,427 exception 43 140440765537064 Internal Server Error: /accounts/login/
web_1       | Traceback (most recent call last):
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner
web_1       |     response = get_response(request)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
web_1       |     response = self._get_response(request)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
web_1       |     response = self.process_exception_by_middleware(e, request)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
web_1       |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/cabot/urls.py", line 42, in wrapper
web_1       |     return func(*args, **kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/views.py", line 47, in inner
web_1       |     return func(*args, **kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
web_1       |     return view(request, *args, **kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
web_1       |     response = view_func(request, *args, **kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
web_1       |     response = view_func(request, *args, **kwargs)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/views.py", line 81, in login
web_1       |     if form.is_valid():
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/forms/forms.py", line 169, in is_valid
web_1       |     return self.is_bound and not self.errors
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/forms/forms.py", line 161, in errors
web_1       |     self.full_clean()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/forms/forms.py", line 371, in full_clean
web_1       |     self._clean_form()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/forms/forms.py", line 398, in _clean_form
web_1       |     cleaned_data = self.clean()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/forms.py", line 191, in clean
web_1       |     self.user_cache = authenticate(username=username, password=password)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 74, in authenticate
web_1       |     user = backend.authenticate(**credentials)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 169, in authenticate
web_1       |     user = ldap_user.authenticate(password)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 342, in authenticate
web_1       |     self._authenticate_user_dn(password)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 452, in _authenticate_user_dn
web_1       |     if self.dn is None:
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 416, in _get_user_dn
web_1       |     self._load_user_dn()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 479, in _load_user_dn
web_1       |     self._search_for_user_dn()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 499, in _search_for_user_dn
web_1       |     results = search.execute(self.connection, {'user': self._username})
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 438, in _get_bound_connection
web_1       |     self._bind()
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 723, in _bind
web_1       |     sticky=True)
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 734, in _bind_as
web_1       |     self._get_connection().simple_bind_s(force_str(bind_dn),
web_1       |   File "/usr/local/lib/python2.7/site-packages/django_auth_ldap/backend.py", line 748, in _get_connection
web_1       |     self._connection = self.backend.ldap.initialize(uri)
web_1       |   File "/usr/local/lib/python2.7/site-packages/ldap/functions.py", line 96, in initialize
web_1       |     return LDAPObject(uri,trace_level,trace_file,trace_stack_limit,bytes_mode)
web_1       | TypeError: __init__() takes at most 5 arguments (6 given)
sherzberg commented 7 years ago

I have this same error on >= 0.10.5. I was upgrading from 0.9.2 which worked fine with LDAP.

< 0.10.5 also has an issue with AssertionError: Should return text, got bytes instead ('CN=redacted,OU=users,OU=groups_users,DC=int,DC=example,DC=com')

dbuxton commented 7 years ago

Hmm. We are on pyldap 2.4.28 and the most recent version is 2.4.37. That object constructor seems to have changed (bytes_mode drops off, which presumably has something to do with @sherzberg's second issue). Suggest bumping the version @JeanFred @frankh and seeing if that fixes?

frankh commented 7 years ago

I've pushed a new docker image: cabotapp/cabot:0.11.8 with updated ldap libraries.

Please try it and let us know if it works.

sherzberg commented 7 years ago

Thanks for the quick response!

Upgrading to 0.11.8 fixes my ldap issue! I no longer get either of the above exceptions.

rorysavage77 commented 6 years ago

I am seeing this same problem as well. It's fundamentally a python ldap library issue.

frankh commented 6 years ago

Please re-open if this isn't working for on v0.11.8+