goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
7.8k stars 598 forks source link

Ask for help for setup authentik LDAP provider in Jupyterhub. #9159

Open renpj opened 2 months ago

renpj commented 2 months ago

Describe your question/ I'm newbie for authentik. I'm trying to use the LDAP provider within Jupyterhub authenticator. I add the following part in jupyterhub_config.py:

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 'ldap://127.0.0.1'
c.LDAPAuthenticator.server_port = 9000
c.LDAPAuthenticator.use_ssl = False
c.LDAPAuthenticator.bind_dn_template = [
    "uid={username},ou=users,DC=ldap,DC=goauthentik,DC=io",
]

It raised the connection refused error:

    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/dist-packages/tornado/web.py", line 1790, in _execute
        result = await result
      File "/usr/local/lib/python3.10/dist-packages/jupyterhub/handlers/login.py", line 163, in post
        user = await self.login_user(data)
      File "/usr/local/lib/python3.10/dist-packages/jupyterhub/handlers/base.py", line 928, in login_user
        authenticated = await self.authenticate(data)
      File "/usr/local/lib/python3.10/dist-packages/jupyterhub/auth.py", line 493, in get_authenticated_user
        authenticated = await maybe_future(self.authenticate(handler, data))
      File "/usr/local/lib/python3.10/dist-packages/ldapauthenticator/ldapauthenticator.py", line 382, in authenticate
        conn = self.get_connection(userdn, password)
      File "/usr/local/lib/python3.10/dist-packages/ldapauthenticator/ldapauthenticator.py", line 314, in get_connection
        conn = ldap3.Connection(
      File "/usr/local/lib/python3.10/dist-packages/ldap3/core/connection.py", line 363, in __init__
        self._do_auto_bind()
      File "/usr/local/lib/python3.10/dist-packages/ldap3/core/connection.py", line 387, in _do_auto_bind
        self.open(read_server_info=False)
      File "/usr/local/lib/python3.10/dist-packages/ldap3/strategy/sync.py", line 57, in open
        BaseStrategy.open(self, reset_usage, read_server_info)
      File "/usr/local/lib/python3.10/dist-packages/ldap3/strategy/base.py", line 146, in open
        raise exception_history[0][0]
    ldap3.core.exceptions.LDAPSocketOpenError: socket connection error while opening: [Errno 111] Connection refused

Relevant info

The jupyterhub was deployed by docker, and jupyterhub-LDAPAuthenticator was installed to support ldap as authenticator.

Version and Deployment:

### Tasks
Qumoo commented 1 month ago

Hey,

while I cannot help you with that issue, you may want to take a look into the generic oauth from the https://github.com/jupyterhub/oauthenticator repo. I tried LDAP for a while but did not get it to work, oauth was working in 15-20 minutes.