大資料實戰(八十六):電商數倉(七十)安全之Kerberos安全認證(六)Kerberos常見問題
1 Kerberos啟動後臺日誌提示異常:No such file or directory - while initializing database for realm HADOOP.COM
在/var/log/krb5kdc.log中發現No such file or directory - while initializing database for realm HADOOP.COM。
解決方法:
1)檢查kdc.conf和krb5.conf檔案是否配置正確,修改配置,注意:配置檔案的[kdcdefaults],[logging]、[libdefaults]等的裡面不能有空格
2)停止服務
service krb5kdc stop
service kadmin stop
3)刪除Kerberos資料庫重新建立資料庫
rm -rf /var/kerberos/krb5kdc/*principal*
kdb5_util create -s -r HADOOP.COM
4)建立管理員
kadmin.local -q "addprinc admin/admin"
5)啟動服務
service krb5kdc start
service kadmin start
2 kinit通過keytab認證出現異常
通過Linux的atguigu主體執行kinit -kt /root/atguigu.keytab atguigu出現下面情況
kinit: ???? while getting initial credentials
或者
kinit: Permission denied while getting initial credentials
解決方式:
1)使用root使用者修改atguigu.keytab的所屬使用者:
chown atguigu /root/atguigu.keytab
2) 修改atguigu.keytab的許可權為660
chmod660 /root/atguigu.keytab
3 kinit認證時密碼輸入正確卻提示密碼錯誤
[root@hadoop102 ~]# kinit atguigu
Password for [email protected]:
kinit: Password incorrect while getting initial credentials
這是因為atguigu已經生成了keytab,所以此時通過這種方式不能認證,需要通過keytab檔案來認證,或者修改密碼後再認證(修改密碼後之前的keytab檔案會失效)。
[root@hadoop102 ~]# kinit -kt /root/atguigu.keytab atguigu
[root@hadoop102 ~]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: [email protected]
Valid starting Expires Service principal
08/27/19 16:00:39 08/28/19 16:00:39 krbtgt/[email protected]
renew until 08/27/19 16:00:39
4 建立資料庫異常
Bad krb5 admin server hostname while initializing kadmin interface
原因:在 krb5.conf檔案中為 admin_server配置了無效的主機名。
解決辦法:修改krb5檔案,檢查admin_server配置是否正確的主機名,修改後,重啟執行建立資料庫的命令。
5Zookeeper叢集啟動異常
異常資訊:Could not configure server because SASL configuration did not allow the ZooKeeper server to authenticate itself properly: javax.security.auth.login.LoginException: No password provided
問題:屬於認證憑證更新問題
解決辦法:ZooKeeper 啟動安全機制,重新生成Krb5憑證。
每個主機重新更新憑證方法:全部服務停止和Cloudera Manager服務停止,修改Kerberos配置中的 Kerberos 加密型別隨便新增一個,就可以主機更新Krb5憑證,然後在改回去在重新生成一次
6Hue啟動,Kerberos Ticket Renewer起不來
[root@hadoop102 ~]# kinit hue Password for [email protected]: [root@hadoop102 ~]# kadmin.local Authenticating as principal hue/[email protected] with password. kadmin.local: modprinc -maxrenewlife 90day krbtgt/[email protected] Principal "krbtgt/[email protected]" modified. kadmin.local: modprinc -maxrenewlife 90day +allow_renewable krbtgt/[email protected] Principal "krbtgt/[email protected]" modified.