【问题标题】:Setting up LDAP for Jupyter Server为 Jupyter 服务器设置 LDAP
【发布时间】:2018-02-05 16:23:31
【问题描述】:

我已经使用 Anaconda 设置了一个 Jupyter 服务器,目前我正在使用令牌身份验证运行它。我尝试按照此链接中提到的步骤为服务器设置 LDAP 授权,但它没有向我显示登录页面本身。 https://github.com/jupyterhub/ldapauthenticator

Jupyter 版本 - 4.2.1

谁能帮我为 Jupyter 设置 LDAP 身份验证。

谢谢

【问题讨论】:

  • 嗨 Midhun,您能否在您的环境中成功设置 LDAP?

标签: python active-directory ldap authorization jupyter


【解决方案1】:

以下步骤对我有用。

首先,我安装了 jupyterhub LDAP 身份验证器。

pip3 install jupyterhub-ldapauthenticator

安装后,我编辑了配置文件。

nano /etc/jupyterhub/jupyterhub_config.py

配置如下所示:

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_hosts =  ['ldap://ldap.example.com:389']
c.LDAPAuthenticator.bind_user_dn = 'uid=ldapbind,cn=users,dc=ldap,dc=example,dc=com‘
c.LDAPAuthenticator.bind_user_password = ‘Password’
c.LDAPAuthenticator.user_search_base = 'cn=users,dc=ldap,dc=example,dc=com‘
c.LDAPAuthenticator.user_search_filter = '(&(objectClass=posixAccount)(uid={username}))'
c.LDAPAuthenticator.username_pattern = '[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?'
c.LDAPAuthenticator.create_user_home_dir = True
c.LDAPAuthenticator.create_user_home_dir_cmd = ['mkhomedir_helper']

在下一步中,我安装了以下 LDAP 包。

sudo apt-get install libnss-ldap libpam-ldap nscd

在安装过程中,您可以对配置进行必要的更改。安装完成后需要重新配置包,因为需要修改密码加密。

sudo dpkg-reconfigure ldap-auth-config

接下来,我更改了配置文件 ldap.conf。

nano /etc/ldap/ldap.conf

发件人:

#BASE    dc=unixmen,dc=local
#URI     ldap://192.168.1.100

收件人:

BASE    dc=ldap,dc=example,dc=com
URI     ldap://ldap.example.com

我编辑的第二个配置文件是 nsswitch.conf。 ldap需要加四次。

passwd:         compat ldap
group:          compat ldap
shadow:         compat ldap
netgroup:       ldap

修改后需要重启服务。

systemctl restart nscd

【讨论】:

  • 我正在使用 AD 集成设置 ldap 身份验证。是否必须在 ldap.conf 文件中进行更改?我在 jupyterhub github 页面中没有看到任何与此相关的内容。如果您有其他参考资料,可以分享一下吗?
  • 您好,您可以尝试上面的示例吗?有效吗?
猜你喜欢
  • 1970-01-01
  • 2016-09-14
  • 2020-02-14
  • 2019-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多