溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

為kafka開啟kerberos

發(fā)布時間:2020-06-01 20:21:43 來源:網(wǎng)絡 閱讀:1049 作者:猩球崛起 欄目:大數(shù)據(jù)

主節(jié)點安裝

yum -y install krb5-server krb5-libs krb5-auth-dialog krb5-workstation

cat /etc/krb5.conf

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]
 default_realm = HADOOP.COM
 dns_lookup_realm = false
 dns_lookup_kdc = false
 ticket_lifetime = 24h
 renew_lifetime = 7d
 forwardable = true
 rdns = false
# default_realm = EXAMPLE.COM
# default_ccache_name = KEYRING:persistent:%{uid}

[realms]
 HADOOP.COM = {
  kdc = bigdata-cdh01.kfk.com
  admin_server = bigdata-cdh01.kfk.com
 }

[domain_realm]
 .bigdata-cdh01.kfk.com = HADOOP.COM
 bigdata-cdh01.kfk.com = HADOOP.COM

cat /var/kerberos/krb5kdc/kadm5.acl

*/admin@HADOOP.COM  *

cat /var/kerberos/krb5kdc/kdc.conf

[kdcdefaults]
 kdc_ports = 88
 kdc_tcp_ports = 88

[realms]
 HADOOP.COM = {
  #master_key_type = aes256-cts
  max_renewable_life= 7d 0h 0m 0s
  acl_file = /var/kerberos/krb5kdc/kadm5.acl
  dict_file = /usr/share/dict/words
  admin_keytab = /var/kerberos/krb5kdc/kadm5.keytab
  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
 }

創(chuàng)建kerberos數(shù)據(jù)庫

kdb5_util create -r HADOOP.COM -s

創(chuàng)建kerberos管理賬號
為kafka開啟kerberos
將kerberos服務添加為開機啟動

systemctl enable krb5kdc
systemctl enable kadmin
systemctl start krb5kdc
systemctl start kadmin

測試管理員賬號
為kafka開啟kerberos
為節(jié)點安裝客戶端

yum -y install  krb5-libs krb5-auth-dialog krb5-workstation

在主節(jié)點上安裝額外的包

yum -y install openldap-clients

將krb5.conf文件拷貝到所有kerberos客戶端(批量拷貝)

#!/bin/bash
for i in `cat node.list`
do
 scp -r $2 $i:$3
done
sh scp.sh node.list /etc/krb5.conf /etc/

啟動kerberos
為kafka開啟kerberos
為kafka開啟kerberos
為kafka開啟kerberos
為kafka開啟kerberos
krb5的一些命令

列出賬號          kadmin.local -q "listprincs"
刪除賬號          kadmin.local -q 'delete_principal hdfs/bigdata-cdh01.kfk.com@HADOOP.COM'
創(chuàng)建賬號指定密碼  kadmin.local -q "addprinc  hdfs/bigdata-cdh01.kfk.com@bd00@HADOOP.COM" 
隨機生成密碼      kadmin.local -q "addprinc  -randkey  hdfs/bigdata-cdh01.kfk.com@HADOOP.COM"  
導出票據(jù)          kadmin.local -q "xst -k hdfs.keytab hdfs/bigdata-cdh01.kfk.com@HADOOP.COM"
登錄              kinit -k -t hdfs.keytab hdfs/bigdata-cdh01.kfk.com@HADOOP.COM
查看過期時間      kadmin.local -q 'getprinc  krbtgt/HADOOP.COM@HADOOP.COM'
修改時間          kadmin.local -q 'modprinc -maxrenewlife "7d" krbtgt/HADOOP.COM@HADOOP.COM'
查看keytab內容    klist -e -k -t  zookeeper.keytab
不修改密碼導出    kadmin.local -q 'xst -k hdfs.keytab -norandkey hdfs/bigdata-cdh01.kfk.com@HADOOP.COM'
退出登錄          kdestroy
向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI