Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP refuses connection when using pip to install JupyterHub and LDAP Authenticator #200

Closed
z3ky opened this issue Sep 7, 2021 · 4 comments

Comments

@z3ky
Copy link

z3ky commented Sep 7, 2021

Bug description

Ldap Authenticator does not connect to Active Directory when JupyterHub and LDAP Authenticator have been installed using pip. The connection to LDAP and the user authentication work when JupyterHub and LDAP Authenticator have been installed using conda.

Expected behaviour

Connection to LDAP should work independently of the installation method.

Actual behaviour

LDAP server refuses the connection when pip has been used

File "/usr/local/lib/python3.8/dist-packages/ldap3/core/tls.py", line 280, in start_tls
        return self._start_tls(connection)
      File "/usr/local/lib/python3.8/dist-packages/ldap3/core/tls.py", line 289, in _start_tls
        raise start_tls_exception_factory(e)(connection.last_error)
    ldap3.core.exceptions.LDAPStartTLSError: wrap socket error: [Errno 104] Connection reset by peer

How to reproduce

  1. pip install jupyterhub jupyterhub-ldapauthenticator configurable-http-proxy
  2. configure hub to connect to LDAP:
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.user_search_base = 
c.LDAPAuthenticator.user_attribute = 'sAMAccountName'
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn'
c.LDAPAuthenticator.lookup_dn_search_filter = '({login_attr}={login})'
c.LDAPAuthenticator.use_ssl = False
c.LDAPAuthenticator.lookup_dn_search_user = 
c.LDAPAuthenticator.lookup_dn_search_password = 
  1. run jupyterhub
  2. try to login

Your personal set up

  • Ubuntu 20.4
  • Tested on the machine, and in docker ubuntu container, and with kubernetes using Zero to JupyterHub with Kubernetes helm chart
  • Python 3.8.10
  • pip 20.0.2
  • JupyterHub 1.4.2
  • jupyterhub-ldapauthenticator 1.3.2
Python Configuration pip freeze

alembic==1.7.1
async-generator==1.10
attrs==21.2.0
certifi==2021.5.30
certipy==0.1.3
cffi==1.14.6
charset-normalizer==2.0.4
click==8.0.1
configurable-http-proxy==0.2.2
cryptography==3.4.8
entrypoints==0.3
greenlet==1.1.1
idna==3.2
importlib-resources==5.2.2
Jinja2==3.0.1
jsonschema==3.2.0
jupyter-telemetry==0.1.0
jupyterhub==1.4.2
jupyterhub-ldapauthenticator==1.3.2
ldap3==2.9.1
Mako==1.1.5
MarkupSafe==2.0.1
oauthlib==3.1.1
pamela==1.0.0
prometheus-client==0.11.0
pyasn1==0.4.8
pycparser==2.20
pyOpenSSL==20.0.1
pyrsistent==0.18.0
python-dateutil==2.8.2
python-json-logger==2.0.2
requests==2.26.0
ruamel.yaml==0.17.16
ruamel.yaml.clib==0.2.6
six==1.16.0
SQLAlchemy==1.4.23
tornado==6.1
traitlets==5.1.0
urllib3==1.26.6
zipp==3.5.0

Conda Configuration conda list

_libgcc_mutex 0.1 main
_openmp_mutex 4.5 1_gnu
alembic 1.7.1 pyhd8ed1ab_0 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
blinker 1.4 py_1 conda-forge
brotlipy 0.7.0 py39h27cfd23_1003
c-ares 1.17.1 h27cfd23_0
ca-certificates 2021.7.5 h06a4308_1
certifi 2021.5.30 py39h06a4308_0
certipy 0.1.3 py_0 conda-forge
cffi 1.14.6 py39h400218f_0
chardet 4.0.0 py39h06a4308_1003
conda 4.10.3 py39h06a4308_0
conda-package-handling 1.7.3 py39h27cfd23_1
configurable-http-proxy 4.0.1 node14_0
cryptography 3.4.7 py39hd23ed53_0
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
icu 68.1 h58526e2_0 conda-forge
idna 2.10 pyhd3eb1b0_0
importlib-metadata 4.8.1 py39hf3d152e_0 conda-forge
importlib_resources 5.2.2 pyhd8ed1ab_0 conda-forge
jinja2 3.0.1 pyhd8ed1ab_0 conda-forge
jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge
jupyter_telemetry 0.1.0 pyhd8ed1ab_1 conda-forge
jupyterhub 1.4.2 py39hf3d152e_0 conda-forge
jupyterhub-base 1.4.2 py39hf3d152e_0 conda-forge
jupyterhub-ldapauthenticator 1.3.2 pyhd3eb1b0_0
krb5 1.19.2 hcc1bbae_0 conda-forge
ld_impl_linux-64 2.35.1 h7274673_9
ldap3 2.9.1 pyhd3eb1b0_0
libcurl 7.78.0 h2574ce0_0 conda-forge
libedit 3.1.20191231 he28a2e2_2 conda-forge
libev 4.33 h516909a_1 conda-forge
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h5101ec6_17
libgomp 9.3.0 h5101ec6_17
libnghttp2 1.43.0 h812cca2_0 conda-forge
libssh2 1.9.0 h1ba5d50_1
libstdcxx-ng 9.3.0 hd4cf53a_17
libuv 1.42.0 h7f98852_0 conda-forge
mako 1.1.5 pyhd8ed1ab_0 conda-forge
markupsafe 2.0.1 py39h3811e60_0 conda-forge
ncurses 6.2 he6710b0_1
nodejs 14.17.4 h92b4a50_0 conda-forge
oauthlib 3.1.1

@welcome
Copy link

welcome bot commented Sep 7, 2021

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@z3ky z3ky changed the title LDAP/AD refuses connection when using pip to install JupyterHub and LDAP Authenticator LDAP refuses connection when using pip to install JupyterHub and LDAP Authenticator Sep 8, 2021
@legion49f
Copy link

I have the same issue but i used the jupyterhub bootstrap installation method on ubuntu 20.04

@z3ky
Copy link
Author

z3ky commented Sep 24, 2021

Try to install the hub inside a conda environment. This works for me, no matter whether I use pip or conda to install the hub.

@consideRatio
Copy link
Member

Closing in favor of #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants