So for reference i got this to work by doing the following:
instead of adding it to requirements.txt directly i added the following to the Dockerfile:
RUN apt-get update && apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev
RUN pip install sentry-ldap-auth
Then i added all configuration options to sentry.conf.py. It is very cumbersome to debug issues in the ldap setup through docker though. As a side note what helped me a lot was adding the following to the end of sentry.conf.py to enable logging to a non-detached docker container (e.g. docker-compose up rather than docker-compose -d up).
import logging
logger = logging.getLogger(‘django_auth_ldap’)
logger.addHandler(logging.StreamHandler())
logger.addHandler(logging.FileHandler(r"/tmp/ldap2.log"))
logger.setLevel(‘DEBUG’)
LOGGING[‘overridable’] = [‘sentry’, ‘django_auth_ldap’ ]
LOGGING[‘loggers’][‘django_auth_ldap’] = {
‘handlers’: [‘console’],
‘level’: ‘DEBUG’
}
As an important note if you are working against an Active Directory rathern than LDAP the following setting is crucial or you won’t be able to do a successful bind. As far as i understood the referrals one is required.
AUTH_LDAP_CONNECTION_OPTIONS = {
ldap.OPT_DEBUG_LEVEL: 0,
ldap.OPT_REFERRALS: 0,
}
Still struggling a little with various issues, but generally it’s working like this.
Hope that helps,
Thorsten