I’m trying to enable the AD authentication, but failed. use use the docker to run the stash.
here is the doocker-compose.yml
[root@localhost redash]# cat docker-compose.yml
version: “2”
x-redash-service: &redash-service
build: .
depends_on:
- postgres
- redis
env_file: /opt/redash/env
restart: always
services:
server:
<<: *redash-service
command: server
ports:
- “5000:5000”
environment:
REDASH_WEB_WORKERS: 4
GUNICORN_CMD_ARGS: “–timeout 300”
scheduler:
<<: *redash-service
command: scheduler
environment:
QUEUES: “celery”
WORKERS_COUNT: 1
scheduled_worker:
<<: *redash-service
command: worker
environment:
QUEUES: “scheduled_queries,schemas”
WORKERS_COUNT: 1
adhoc_worker:
<<: *redash-service
command: worker
environment:
QUEUES: “queries”
WORKERS_COUNT: 2
worker:
<<: *redash-service
command: worker
environment:
QUEUES: “periodic emails default”
WORKERS_COUNT: 1
redis:
image: redis:5.0-alpine
restart: always
postgres:
image: postgres:9.6-alpine
ports:
- “5432:5432”
env_file: /opt/redash/env
volumes:
- /opt/redash/postgres-data:/var/lib/postgresql/data
restart: always
nginx:
image: redash/nginx:latest
ports:
- “80:80”
depends_on:
- server
links:
- server:redash
volumes:
- ./nginx/html:/usr/share/nginx/html
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d
restart: always
– here is the Dockerfile.
[root@localhost redash]# cat Dockerfile
FROM redash/redash:10.1.0.b50633
COPY ./python-packages/*.whl /tmp/
RUN pip install /tmp/pyasn1-0.4.8-py2.py3-none-any.whl
RUN pip install /tmp/ldap3-2.9.1-py2.py3-none-any.whl
I original use the RUN pip ldap3 in dockerfile as suggestion of document. but it always fail to download the ldap3, maybe my server network has issue, anyway, I download the ldap3, and install it from local.
– here is the evn.
PYTHONUNBUFFERED=0
REDASH_LOG_LEVEL=INFO
REDASH_REDIS_URL=redis://redis:6379/0
POSTGRES_PASSWORD=xxxxxxxxxxxxxxxxxxxx
REDASH_COOKIE_SECRET=xxxxxxxxxxxxxxxxx
REDASH_SECRET_KEY=xxxxxxxxxxxxxxxxxxxx
REDASH_DATABASE_URL=postgresql://postgres:xxxxx@xx/xx
REDASH_MAIL_SERVER=“xxxx”
REDASH_MAIL_DEFAULT_SENDER=“xxxx”
REDASH_HOST=“x.x.x.x”
REDASH_LDAP_LOGIN_ENABLED=“true”
REDASH_PASSWORD_LOGIN_ENABLED=“false”
REDASH_LDAP_URL=“xxx:x”
REDASH_LDAP_BIND_DN=“xx/xx/xx”
REDASH_LDAP_BIND_DN_PASSWORD=“xxxx”
REDASH_LDAP_CUSTOM_USERNAME_PROMPT=" Please enter login account"
REDASH_LDAP_SEARCH_TEMPLATE=“(sAMAccountName=%(username)s)”
REDASH_LDAP_DN=“cn=xx,dc=xx,dc=xx”
I rebuilt everything and start the container.
docker-compose down
docker-compose up -d
then opened the login page of redash.
when I click the login. I got erros as below
# Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
checked the logs, I got TypeError: cannot convert ‘NoneType’ object to bytes.
docker-compose logs -f
redash-server-1 | [2022-06-30 08:19:13,236][PID:12][ERROR][redash.app] Exception on /ldap/login [POST]
redash-server-1 | Traceback (most recent call last):
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 2446, in wsgi_app
redash-server-1 | response = self.full_dispatch_request()
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1951, in full_dispatch_request
redash-server-1 | rv = self.handle_user_exception(e)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask_restful/init.py”, line 269, in error_router
redash-server-1 | return original_handler(e)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1820, in handle_user_exception
redash-server-1 | reraise(exc_type, exc_value, tb)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/_compat.py”, line 39, in reraise
redash-server-1 | raise value
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1949, in full_dispatch_request
redash-server-1 | rv = self.dispatch_request()
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/flask/app.py”, line 1935, in dispatch_request
redash-server-1 | return self.view_functionsrule.endpoint
redash-server-1 | File “/app/redash/authentication/ldap_auth.py”, line 45, in login
redash-server-1 | ldap_user = auth_ldap_user(request.form[“email”], request.form[“password”])
redash-server-1 | File “/app/redash/authentication/ldap_auth.py”, line 87, in auth_ldap_user
redash-server-1 | attributes=[settings.LDAP_DISPLAY_NAME_KEY, settings.LDAP_EMAIL_KEY],
redash-server-1 | File “/home/redash/.local/lib/python3.7/site-packages/ldap3/core/connection.py”, line 850, in search
redash-server-1 | check_names=self.check_names)
redash-server-1 | File “/home/redash/.local/lib/python3.7/site-packages/ldap3/operation/search.py”, line 346, in search_operation
redash-server-1 | request[‘baseObject’] = LDAPDN(search_base)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/pyasn1/type/univ.py”, line 837, in init
redash-server-1 | base.SimpleAsn1Type.init(self, value, **kwargs)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/pyasn1/type/base.py”, line 267, in init
redash-server-1 | value = self.prettyIn(value)
redash-server-1 | File “/usr/local/lib/python3.7/site-packages/pyasn1/type/univ.py”, line 912, in prettyIn
redash-server-1 | return bytes(value)
redash-server-1 | TypeError: cannot convert ‘NoneType’ object to bytes
redash-server-1 | [2022-06-30 08:19:13,240][PID:12][INFO][metrics] method=POST path=/ldap/login endpoint=ldap_auth_login status=500 content_type=text/html content_length=290 duration=258.83 query_count=0 query_duration=0.00
redash-server-1 | [2022-06-30 08:19:13,242][PID:12][INFO][metrics] method=POST path=/ldap/login endpoint=ldap_auth_login status=500 content_type=? content_length=-1 duration=261.34 query_count=0 query_duration=0.00