记录一下有关 Kerberos 错误消息的信息,包括每个错误出现的原因以及解决此错误的方法。
1、AccessControlException: Client cannot authenticate via:[TOKEN, KERBEROS]
修改 Kerboeros配置文件 /etc/krb5.conf
, 注释掉 : default_ccache_name 属性 .
别忘了分发到各个节点和替换掉程序里读取的
然后执行kdestroy,重新kinit .
2、ERROR org.apache.zookeeper.server.quorum.QuorumPeerMain: Unexpected exception, exiting abnormally
java.io.IOException: Could not configure server because SASL configuration did not allow the ZooKeeper server to authenticate itself properl
y: javax.security.auth.login.LoginException: Message stream modified (41)
jre-8u242及以上版本会根据krb5.conf中是否配置了renew_lifetime属性值,重新设置kdcOptions renewable属性值为true;
客户端配置文件krb5.conf中的renew_lifetime设置为0m,renewable配置的是false,服务端配置中的kdc_renewable设置的也是false;
jdk中重新设置kdcOptions renewable属性值为true后,因为renewable为false不一致,故报了此错误;
此问题不是jdk的bug,只是242版本之前不支持ticket续期,规范发生变化导致;
删除客户端使用的配置文件中的krb5.conf中的renew_lifetime = 0m配置项
注:如果使用的jdk是jre 8u242及以上版本才有此问题,如果是低版本无此问题。
3、 ERROR Couldn't renew kerberos ticket in order to work around Kerberos 1.8.1 issue. Please check that the ticket for 'hue/master1.cdp.prod@CDP.PROD' is still renewable:
在/var/kerberos/krb5kdc/kdc.conf 中添加一行
max_renewable_life= 365d 0h 0m 0s day
具体看你krb5里配置的超时时间 和renew_lifetime一致就行了
然后去cdh上再次生成hue的keytab 然后修改一下hue keytab的刷新机制
[root@master1 ~]# klist -f -c /var/run/hue/hue_krb5_ccache
Ticket cache: FILE:/var/run/hue/hue_krb5_ccache
Default principal: hue/master1.cdp.prod@CDP.PROD
Valid starting Expires Service principal
07/13/2022 19:47:15 07/14/2022 19:47:15 krbtgt/CDP.PROD@CDP.PROD
Flags: FI
[root@master1 ~]# kadmin.local
Authenticating as principal hive/admin@CDP.PROD with password.
kadmin.local:
kadmin.local:
kadmin.local: modprinc -maxrenewlife 90day krbtgt/CDP.PROD@CDP.PROD
Principal "krbtgt/CDP.PROD@CDP.PROD" modified.
kadmin.local: modprinc -maxrenewlife 90day +allow_renewable hue/master1.cdp.prod@CDP.PROD
Principal "hue/master1.cdp.prod@CDP.PROD" modified.
kadmin.local: modprinc -maxrenewlife 90day +allow_renewable hue/master2.cdp.prod@CDP.
4、kinit非常慢
因为我司购买的是腾讯云。我这边遇到的情况是kinit在解析kerberos地址时会向腾讯云公有dns解析kerberos内部地址
strace -ttt kinit -kt /var/lib/keytab/hdfs.keytab hdfs/xxxx select应该是阻塞到dns这里了
发现
百思不得其解 ,于是查看了正常的服务器。发现也会有这个流程 。正常的服务器使用的是阿里云的解析
nameserver 233.5.5.5
秒解析完成 ,但是这应该是完全没关系的两件事 。一个内部服务名肯定是无法通过公共dns的 。决定尝试一下,将腾讯云服务器自带的腾讯公共dns注释掉。加入阿里公共dns
nameserver 233.5.5.5
#nameserver 183.60.83.19
#nameserver 183.60.82.98
解决问题。 但是因为是腾讯云的公共dns, 排查到这就结束了 ,不知道为什么腾讯云会尝试解析而阿里云直接略过
5.kadmin.local -q "xst -k /data/hbase.keytab hbase@CDH.COM"
Authenticating as principal admin/admin@CDH.COM with password.
kadmin.local: Server error while initializing kadmin.local interface
百思不得其解为什么会这样。其实只是因为我在客户端节点上执行的命令 不要像我一样犯傻即可
6、Application submission is not finished, submitted application
我的原因是关闭了udp接口 打开就好了
udp_preference_limit = 0
7、 No valid credentials provided (Mechanism level: Fail to create credential. (63) - No service creds)
如果端口网络时间之类的排查下来没有结果的话 。可能是网络上关闭了udp协议。打开即可
8、kdb5_util: Cannot open DB2 database '/var/kerberos/krb5kdc/principal': File exists while creating database '/var/kerberos/krb5kdc/principal'
要么你没有初始化。。要么由于一些神奇的原因。。你的kerberer数据库被删了。遇到过重启了ipa 或者改了krb5文件自己把数据库文件删了的情况 总之这时候只能再次初始化了
kdb5_util create -r YINZHENGJIE.COM -s
记得弄个定时任务备份一下。。
9、 Clients credentials have been revoked while getting initial credentials
多半是账户被锁了,登陆kadmin后台管理控制台
命令行登入 kadmin.local
getprinc 用户名 ,查看用户数据密码错误次数是否超过5次,如果是,证明账户被锁
Failed password attempts 的值是否大于5
如果账户被锁,输入命令modprinc -unlock 用户名,进行解锁
10、PreAuthenticate failed while getting inital credentials
密码不对。原因很多 总之就是密码不对 如果是keytab文件 那就是文件不对 。重新生成吧
11、使用不了hdfs命令 报错No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
klist查看凭据缓存,是存在的
配置krb5.conf时候屏蔽关于 #default_ccache_name的配置,hadoop启动时是基于这个位置去寻找认证缓存的
[libdefaults]
dns_lookup_realm = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
rdns = false
default_realm = HADOOP.COM
#default_ccache_name = KEYRING:persistent:%{uid}