ldap-官文翻译

4 篇文章 0 订阅

https://gethue.com/making-hadoop-accessible-to-your-employees-with-ldap/#t6

一、src

Hue很容易与您公司现有的身份管理系统集成,并为SSO提供商提供认证机制。通过更改一些配置参数,您的员工可以利用现有的安全策略在浏览器中进行大数据分析

这篇博文详细介绍了在LDAP中使用的各种特性和功能:

  1. 认证
    1. 搜索绑定
    2. 目录绑定
  2. 导入用户
  3. 导入组
  4. 同步用户和组
  5. LDAP SEARCH
  6. Case sensitivity

二、Authentication

1.架构

所谓认证,就是证明谁就是谁,其实就是验证账号密码。

非LDAP下,用户信息存在HUE的数据库中
使用Hue LDAP集成,用户可以使用他们的LDAP凭证透明地验证和继承他们现有的组。不需要保存或复制任何密码

还有其他几种使用Hue进行身份验证的方法:PAM、SPNEGO、OpenID、OAuth、SAML2等。本节详细介绍了Hue如何根据LDAP目录服务器进行身份验证。

当通过LDAP进行身份验证时,如果配置了backend=desktop.auth.backend.LdapBackend,Hue会根据目录服务验证登录凭证。

LDAP认证后端会自动创建在hue默认情况下不存在的用户。为了正确执行认证,hue需要导入用户,在导入用户时从不导入密码。以下配置可用于禁用自动导入:create_users_on_login=false。禁用自动导入的目的是只允许手动导入的预定义用户列表登录。

如果用户在启用LDAP身份验证之前以A登录,然后在启用LDAP身份验证之后以B登录,那么所有工作流、查询等都将与用户a关联,并且不可用。旧的工作流需要将它们的所有者字段更改为B:这可以在Hue shell中完成。

2.hue整合目录服务进行认证有2种方式:

{1}搜索绑定

这种绑定机制机制将在目录服务执行ldapsearch,并使用找到的区别名称(DN)和提供的密码进行绑定。使用ldap是默认使用这种方式。影响这种机制的配置在“LDAP搜索”中有概述。

{2}直接绑定

这种绑定机制机制使用登录时提供的用户名和密码绑定到ldap服务器。

有两个选项可以用来配置直接绑定:

  1. nt_domain
    UPN的域组件。UPN是dn的缩写、登录名。UPN这个概念允许hue进行认证时不需要遵循ldap对其他分区的引用(This active directory specific idiom allows Hue to authenticate with active directory without having to follow LDAP references to other partitions),通常映射到用户的email地址或者用户的id+域名,也就是一个唯一标识。
  2. ldap_username_pattern
    认证时最终发给ldap服务器的DN模板,会将登陆时的用户名自动补全。

如果设置了nt_domain属性,Hue 会使用UPN绑定ldap服务
nt_domain=example.com

如果没设置nt_domain属性,会使用ldap_username_pattern,
ldap_username_pattern="uid=,ou=People,DC=hue-search,DC=ent,DC=cloudera,DC=com"

如果要启动直接绑定认证,search_bind_authentication必须设为false

三、导入用户

如果LDAP用户需要属于某个组并具有特定的权限集,那么可以通过Useradmin窗口导入该用户
在这里插入图片描述
If ‘Create home directory’ is checked, when the user is imported their home directory in HDFS will automatically be created, if it doesn’t already exist.

如果Distinguished name选中, Username输入框必须输入a full distinguished name (eg: uid=hue,ou=People,dc=gethue,dc=com)。否则, Username应该输入 a fragment of a Relative Distinguished Name (rDN) (e.g., the username “hue” maps to the rDN “uid=hue”)。Hue会执行ldap search 根据LDAP search超链接中的配置。本质上,Hue会补全输入的Username然后根据user_filteruser_name_attr创建一个搜索过滤器来匹配用户。

还可以设置忽略大小写

四、导入组

Groups are importable via the Useradmin interface. Then, users can be added to this group, which would provide a set of permissions (e.g. accessing the Impala application). This function works almost the exact same way as user importing, but has a couple of extra features.
导入组也是通过Useradmin功能,导入组后,可以把用户添加到组中,如果想要设置权限,类似于sentry,只能通过组。这里的权限包括hue的权限和sentry的。
在这里插入图片描述
如上图所示,不仅可以通过DN和rDN搜索发现组,还可以导入属于该组的用户和该组所属组的成员。如果发现的组具有对象类“posixGroup”,则会自动导入Posix组和成员。

五、同步组和用户

用户和组可以通过Useradmin接口或者命令行工具与目录服务同步。上一步的图片中"添加/同步"中的同步来表示当一个已经存在的用户或组被添加到Hue中时,它实际上会执行跟ldap同步的操作。在为特定组导入用户的情况下,将导入新用户,并同步现有用户。注意:已从目录服务中删除的用户不会从Hue中删除,需要手动在Hue中删除。

用户的组可以在他登录时同步(以保持其权限同步)

# Synchronize a users groups when they login
sync_groups_on_login=false

1. 属性同步的feature

目前,只有名(first name)、姓(last name)和电子邮件(email address)是同步的。当同步时,Hue会查找LDAP属性“givenName”、“sn”、“mail”。此外,‘user_name_attr’ 配置被用来适当地选择用户名。例如,如果’ user_name_attr’设置为" uid ",那么目录服务返回的"uid "将作为用户的用户名在Hue中使用。

2. 使用Useradmin同步

The “” button in the Useradmin interface will automatically synchronize all users and groups.
Sync LDAP users/groups按钮会自动同步所有的用户和组
在这里插入图片描述

3. 使用 Command line同步

<hue root>/build/env/bin/hue sync_ldap_users_and_groups

六、LDAP search

There are two configurations for restricting (节制) the search process

1. user_filter - General LDAP filter to restrict the search.

2. user_name_attr - Which attribute will be considered the username to search against.

example

user_filter=”objectClass=*”
user_name_attr=uid
# Whether or not to follow referrals:是否遵循推荐
follow_referrals=false

With the above configuration, the LDAP search filter will take on the form
这是一种语法
在这里插入图片描述

(&(objectClass=*)(uid=<user entered usename>))

七、Case sensitivity

通过ignore_username_caseforce_username_lowercase配置,Hue可以被配置为忽略用户名的大小写以及强制用户名小写。建议将这两种配置结合使用。这在与包含大写用户名和小写unix用户名(这是Hadoop的要求)的目录服务集成时非常有用。下面是一个配置它们的示例

ignore_username_case=true
force_username_lowercase=true

八、LDAPS/StartTLS support

Hue通过SSL/TLS和StartTLS协议与LDAP的安全通信。它允许Hue验证它要与之对话的目录服务。实际上,如果提供了一个Certificate Authority Certificate file,Hue将通过LDAPS进行通信。

ldap_cert=/etc/hue/ca.crt
use_start_tls=true

九、Debugging

debug=true

\# Sets the debug level within the underlying LDAP C lib.
      
\## debug_level=255

\# Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments,
      
\# 2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls.
      
trace_level=0

Make sure to add to the Hue server environment:

DESKTOP_DEBUG=true 
DEBUG=true

十、

search_bind_authentication=true表示Hue在执行LDAP search时使用指定的credentials (bind_dn, bind_password),然后使用base_dn指定的基本dn搜索条目在user_name_attr定义的属性,并带有登陆页面提供的UPN。在“user_filter”中定义的搜索过滤器也将用于限制搜索。Hue将从基本DN开始搜索整个子树。

search_bind_authentication=false表示Hue使用提供的凭证(不是hue.ini中指定的bind_dn和bind_password)执行到LDAP的直接绑定。这里有两种有效的模式:
nt_domain,用于连接到LDAP server,在这种情况下,UPN(用户主体名)用于执行直接绑定。UPN(用户主体名)用于执行直接绑定。Hue通过连接登录时提供的简短名称和nt_domain形成UPN,如下所示:@nt_domain。“ldap_username_pattern”配置完全被忽略。
没有指定nt_domain。它用于连接到所有其他目录服务(甚至可以处理Active directory,但nt_domain是AD的首选方式)。在本例中,使用了ldap_username_pattern,它应该采用“cn=,dc=example,dc=com”的形式,其中将替换为登录页面上提供的内容。
ini:它用于连接到所有其他目录服务(甚至可以处理Active directory,但nt_domain是AD的首选方式)。在本例中,使用了’ ldap_username_pattern ',所以它会采用“cn=,dc=example,dc=com”的形式,会将登陆页面上提供的替换掉。

当管理LDAP条目时,UserAdmin将始终执行LDAP搜索,然后始终使用定义的“bind_dn”、“bind_password”、“base_dn” etc。

At this point in time, there is no other bind semantics supported other than SIMPLE_AUTH. For instance, we do not yet support MD5-DIGEST, NEGOTIATE, etc. Though, we definitely want to hear from folks what they use so we can prioritize these things accordingly!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值