温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

JupyterHub中如何与OpenLDAP服务集成。

发布时间:2021-12-04 17:59:59 来源:亿速云 阅读:153 作者:柒染 栏目:大数据

这篇文章给大家介绍JupyterHub中如何与OpenLDAP服务集成。,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

1.文档编写目的


JupyterHub的用户默认是基于OS系统用户,对于用户的管理和维护都需要在服务器上进行操作不便于管理。小编主要介绍在JupyterHub中如何与OpenLDAP服务集成。

  • 测试环境

1.CM5.15.0和CDH版本5.14.2

2.JupyterHub版本为0.9.2

3.Python版本为3.6.5

  • 前置条件

1.JupyterHub已部署成功

2.JupyterHub与OpenLDAP集成


在JupyterHub中默认只支持操作系统PAM默认的认证方式,如果需要JupyterHub支持OpenLDAP认证,则需要安装OpenLDAP认证的插件,插件地址:https://github.com/jupyterhub/ldapauthenticator

1.在Python3环境中安装jupyterhub-ldapauthenticator包,命令如下:

[root@cdh03 ~]# /opt/cloudera/anaconda3/bin/pip install jupyterhub-ldapauthenticator

(可左右滑动)

JupyterHub中如何与OpenLDAP服务集成。

安装完成后验证是否安装成功

[root@cdh03 ~]# /opt/cloudera/anaconda3/bin/pip show jupyterhub-ldapauthenticator

(可左右滑动)

JupyterHub中如何与OpenLDAP服务集成。

2.修改/etc/jupyterhub/jupyterhub_config.py文件,增加OpenLDAP配置,在文件默认增加内容如下:

#指定JupyterHub认证类型
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
#OpenLDAP服务地址
c.LDAPAuthenticator.server_address = 'ldap://cdh01.fayson.com'
#访问用户和组的DN
c.LDAPAuthenticator.bind_dn_template = [
    "uid={username},ou=People,dc=fayson,dc=com",
    "uid={username},ou=Group,dc=fayson,dc=com"
]

(可左右滑动)

JupyterHub中如何与OpenLDAP服务集成。

3.启动Jupyterhub服务

[root@cdh03 jupyterhub]# /opt/cloudera/anaconda3/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py --debug

(可左右滑动)

JupyterHub中如何与OpenLDAP服务集成。

如上显示启动成功,在启动命令后添加--debug参数可以显示DEBUG日志,-f指定JupyterHub启动加载的配置文件。

3.集成验证


1.在OpenLDAP上创建一个testldap测试用户

JupyterHub中如何与OpenLDAP服务集成。

2.在浏览器输入http://cdh03.fayson.com:8000访问JupyterHub,使用testldap用户登录

JupyterHub中如何与OpenLDAP服务集成。

登录成功

JupyterHub中如何与OpenLDAP服务集成。

打开一个Notebook,并运行一段测试的pyspark代码

JupyterHub中如何与OpenLDAP服务集成。

查看Yarn上的作业

JupyterHub中如何与OpenLDAP服务集成。

JupyterHub中如何与OpenLDAP服务集成。

4.总结

1.JupyterHub与OpenLDAP集成需要安装jupyterhub-ldapauthenticator插件。

2.可以通过配置Group限制访问JupyterHub的用户组。

关于JupyterHub中如何与OpenLDAP服务集成。就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI