您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
如果 HDP 版本是 2.6.5、Ambari 版本是 2.6.2.2 ,切记与 Kerberos 集成时,注意一下 Kerberos 的版本。
Kerberos 版本一定不能是 1.15.1-18,会受伤的。
Kerberos 版本大于 18 这个小版本应该都没有问题,亲测版本 1.15.1-19、1.15.1-34 。
这是本篇文章使用的列表:
krb5-libs-1.15.1-34.el7.x86_64
krb5-server-1.15.1-34.el7.x86_64
krb5-workstation-1.15.1-34.el7.x86_64
krb5-devel-1.15.1-34.el7.x86_64
Kerberos: Network Authentication protocol(网络认证协议)
KDC: Key Distribution center(密钥分配中心)
Kadmin: Kerberos Administrator(Kerberos管理)
安装Kerberos之前,需要有配置好的Ambari环境。
Ambari安装参见上一篇文章:https://blog.51cto.com/784687488/2329891
[root@ambari-agent01 ~]$ cat /etc/hosts
10.0.2.20 ambari-server server.ambari.com
10.0.2.21 ambari-agent01 agent01.ambari.com kerberos-auth
10.0.2.22 ambari-agent02 agent02.ambari.com
# 下载 aes256-cts 编码支持组件 JCE(jce_policy-8.zip)
yum install krb5-server krb5-libs krb5-workstation -y
[root@ambari-agent01 ~]$ cat >/etc/krb5.conf<<EOF
# Configuration snippets may be placed in this directory as well
includedir /etc/krb5.conf.d/
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h # 认证凭证生命周期
renew_lifetime = 7d # 认证凭证最长延期时限
forwardable = true
renewable = true
rdns = false
pkinit_anchors = /etc/pki/tls/certs/ca-bundle.crt
default_realm = TEST.COM
default_ccache_name = KEYRING:persistent:%{uid}
[realms]
TEST.COM = {
kdc = kerberos-auth # TEST.COM 域中的 KDC 接口
admin_server = kerberos-auth # TEEEST.COM 域中的 Admin Server 接口
}
[domain_realm]
.TEST.com = TEST.COM
TEST.com = TEST.COM
EOF
# 解压 JCE 支持组件至${JRE_HOME}/lib/security/
[root@ambari-agent01 ~]$ unzip UnlimitedJCEPolicyJDK7.zip
[root@ambari-agent01 ~]$ for n in 20 21 22;do scp local_policy.jar US_export_policy.jar 10.0.2.$n:/opt/jdk/jre/lib/security/;done
[root@ambari-agent01 ~]$ cat >/var/kerberos/krb5kdc/kdc.conf<<EOF
[kdcdefaults]
kdc_ports = 88
kdc_tcp_ports = 88
[realms]
TEST.COM = {
acl_file = /var/kerberos/krb5kdc/kadm5.acl
dict_file = /usr/share/dict/words
admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
# aes256-cts这个校验方式需要单独下载 JCE-*.jar,并把 jar 包放到 ${JRE_HOME}/lib/security 路径下
master_key_type = aes256-cts
supported_enctypes = aes256-cts:normal aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal camellia256-cts:normal camellia128-cts:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
}
EOF
[root@ambari-agent01 ~]$ cat >/var/kerberos/krb5kdc/kadm5.acl<<EOF
*/admin@TEST.COM *
EOF
[root@ambari-agent01 ~]$ kdb5_util create -r TEST.COM -s
Loading random data
Initializing database '/var/kerberos/krb5kdc/principal' for realm 'TEST.COM',
master key name 'K/M@TEST.COM'
You will be prompted for the database Master Password.
It is important that you NOT FORGET this password.
Enter KDC database master key: # 设置密码
Re-enter KDC database master key to verify: # 确认密码
[root@ambari-agent01 krb5kdc]$ kadmin.local -q "addprinc admin/admin"
Authenticating as principal root/admin@TEST.COM with password.
WARNING: no policy specified for admin/admin@TEST.COM; defaulting to no policy
Enter password for principal "admin/admin@TEST.COM": # 设置管理帐号密码
Re-enter password for principal "admin/admin@TEST.COM": # 确认密码
Principal "admin/admin@TEST.COM" created.
# 个人感觉与 Mysql 查询用户SQL“select user, host from mysql.user;” 差不多
[root@ambari-agent01 krb5kdc]$ kadmin.local listprincs
K/M@TEST.COM
admin/admin@TEST.COM
kadmin/admin@TEST.COM
kadmin/ambari-agent01@TEST.COM
kadmin/changepw@TEST.COM
kiprop/ambari-agent01@TEST.COM
krbtgt/TEST.COM@TEST.COM
systemctl start krb5kdc.service
systemctl start kadmin.service
# 警告:yarn的日志和日志目录将被删除,并将resourcemanager的状态重新格式化为开启或关闭kerberos应用的状态
# 在 Admin Principal 和 Admin Password 中填入手动创建的管理帐号与帐号密码
# 创建的帐号为 admin/admin@TEST.COM,密码为123456
# 测试过程可能会提示session过期,重新输入用户、密码进行认证
# 客户端连接命令: kadmin -r TEST.COM -s kerberos-auth:88 -padmin/admin@TEST.COM
# 后面几项配置使用默认就可以了。
# 如果有兴趣的话,在 Confirm Configuration (确认配置)这步时可以下载CSV文件看一下,里面有详细的 Ambari 自动创建的各个应用组件连接 Kerberos 认证的 principal 和 keytabs
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。