栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

100.如何用OpenLDAP的用户进行Sentry授权

100.如何用OpenLDAP的用户进行Sentry授权

100.1 演示环境介绍

OpenLDAP:2.4.44CM和CDH版本:5.13.1OS为Redhat:7.3已启用KerberosOpenLDAP服务和CDH各个服务已安装和集成 100.2 操作演示

1.OpenLDAP环境描述

主节点IP地址

186.31.24.169 主节点HOSTNAME

ip-186-31-24-169.ap-southeast-1.compute.internal 备节点IP地址

186.31.16.68 备节点HOSTNAME

ip-186-31-16-68.ap-southeast-1.compute.internal 主节点和备节点均OpenLDAP已安装

2.创建和验证OpenLDAP

编辑testsentry.ldif文件:

[root@ip-186-31-24-169 ldap]# vim testsentry.ldif
#添加用户默认组
dn: cn=testsentry,ou=Group,dc=fayson,dc=com
objectClass: posixGroup
objectClass: top
cn: testsentry
userPassword: {SSHA}KYgsfyI/uny0dKPNeMRNG54BdwV6KlWA
gidNumber: 2999
#添加用户
dn: uid=testsentry,ou=People,dc=fayson,dc=com
uid: testsentry
cn: testsentry
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {SSHA}KYgsfyI/uny0dKPNeMRNG54BdwV6KlWA
shadowLastChange: 17493
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 2999
gidNumber: 2999
homeDirectory: /home/testsentry

执行如下命令导入testsentry用户

ldapadd -D "cn=Manager,dc=fayson,dc=com" -W -x -f testsentry.ldif

验证OpenLDAP是否成功添加testsentry用户

ldapsearch -D "cn=Manager,dc=fayson,dc=com" -W  |grep testsentry

验证CDH集群所有节点已同步该testsentry用户

[root@ip-186-31-16-68 shell]# sh ssh_do_all.sh node.list "id testsentry"

3.Kerberos账号的创建

在kadmin所在服务器上执行如下命令创建Kerberos账号

[root@ip-186-31-16-68 ~]# kadmin.local 
Authenticating as principal hbase/admin@FAYSON.COM with password.
kadmin.local:  addprinc testsentry@FAYSON.COM
WARNING: no policy specified for testsentry@FAYSON.COM; defaulting to no policy
Enter password for principal "testsentry@FAYSON.COM": 输入账号密码
Re-enter password for principal "testsentry@FAYSON.COM": 输入账号密码
Principal "testsentry@FAYSON.COM" created.
kadmin.local:  

测试Kerberos账号是否可以使用

注意:用户名需与OpenLDAP一致

[root@ip-186-31-16-68 ~]# kinit testsentry@FAYSON.COM
Password for testsentry@FAYSON.COM: 
[root@ip-186-31-16-68 ~]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: testsentry@FAYSON.COM
Valid starting       Expires              Service principal
04/12/2018 22:17:45  04/13/2018 22:17:45  krbtgt/FAYSON.COM@FAYSON.COM
        renew until 04/19/2018 22:17:45
[root@ip-186-31-16-68 ~]# 

4.Hue授权OpenLDAP用户组

进入Security授权界面

注意:需使用hive的超级管用登录Hue 把tpcds_text_2库的所有权限授权给testsentry用户

添加tpcds_role角色
如下即为创建成功

5.授权验证

使用testsentry用户登录Hue,验证授权是否正确在命令行执行

[root@ip-186-31-16-68 ~]# beeline 
beeline> !connect jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: testsentry
Enter password for jdbc:hive2://localhost:10000: ******

使用hadoop命令浏览授权库的数据目录

[root@ip-186-31-16-68 ~]# kinit testsentry
Password for testsentry@FAYSON.COM: 
[root@ip-186-31-16-68 ~]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: testsentry@FAYSON.COM
Valid starting       Expires              Service principal
04/12/2018 23:12:26  04/13/2018 23:12:26  krbtgt/FAYSON.COM@FAYSON.COM
        renew until 04/19/2018 23:12:26
[root@ip-186-31-16-68 ~]# hadoop fs -ls /tmp/tpcds-generate/2/customer
Found 1 items
-rwxrwx--x+  3 hive hive   19084888 2018-03-17 04:01 /tmp/tpcds-generate/2/customer/data-m-00001
[root@ip-186-31-16-68 ~]# 

6.总结

OpenLDAP中的用户中与Linux中的用户是一致的Sentry授权是针对用户组的,所以在需要在Hue中授权的用户组名与OpenLDAP中的用户组名称一致如果集群启用了Kerberos则需要创建OpenLDAP相应用户的Kerberos账号,否则LDAP用户无法访问授权的表的HDFS数据目录

大数据视频推荐:
CSDN
大数据语音推荐:
企业级大数据技术应用
大数据机器学习案例之推荐系统
自然语言处理
大数据基础
人工智能:深度学习入门到精通

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/734935.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号