Hadoop

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

2022-02-11  本文已影响0人  大勇任卷舒

100.1 演示环境介绍

100.2 操作演示

1.OpenLDAP环境描述

2.创建和验证OpenLDAP

[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
ldapadd -D "cn=Manager,dc=fayson,dc=com" -W -x -f testsentry.ldif
ldapsearch -D "cn=Manager,dc=fayson,dc=com" -W  |grep testsentry
[root@ip-186-31-16-68 shell]# sh ssh_do_all.sh node.list "id testsentry"

3.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:  
[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用户组

5.授权验证

[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.总结

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

上一篇下一篇

猜你喜欢

热点阅读