从根源解决RHEL 6.x主机执行kinit -kt命令报错'kinit: Bad encryption type while getting initial credentials'

原因:

目前已知是6.x和7.x主机上加密方式异常导致camellia128-cts-cmac,camellia256-cts-cmac这种加密方式不能再6.x主机上正确解密导致。

可能导致问题:

  • 6.x主机上kinit获取principal失败。
  • cloudera服务refresh异常(出现在6.x主机上),报错是kinit 认证失败。

解决方案:

  • 修改kdc主机上kdc.conf文件中supported_enctypes
    行,去掉'camellia256-cts:normal camellia128-cts:normal'这两种加密方式。
  • 重启kdc服务。
  • 修改从kdc主机上kdc.conf文件
  • 重启从kdc服务。
  • 执行数据同步(kprop)。
  • 同步客户端配置。

测试验证:

# 当前kdc.conf配置
[dengsc@nfjd-hadoop02-node179 ~]$ sudo grep supported_enctypes /var/kerberos/krb5kdc/kdc.conf 
  supported_enctypes = 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

# 获取当前principal信息,key值存在camellia*-cts-cmac
kadmin.local:  getprinc dengsc
Principal: [email protected]
Expiration date: [never]
Last password change: Thu Jun 08 14:27:11 CST 2017
Password expiration date: [none]
Maximum ticket life: 1 day 00:00:00
Maximum renewable life: 31 days 00:00:00
Last modified: Thu Jun 08 14:35:59 CST 2017 (root/[email protected])
Last successful authentication: [never]
Last failed authentication: [never]
Failed password attempts: 0
Number of keys: 7
Key: vno 5, aes128-cts-hmac-sha1-96
Key: vno 5, des3-cbc-sha1
Key: vno 5, arcfour-hmac
Key: vno 5, camellia256-cts-cmac
Key: vno 5, camellia128-cts-cmac
Key: vno 5, des-hmac-sha1
Key: vno 5, des-cbc-md5
MKey: vno 1
Attributes:
Policy: lockout_policy

# 导出keytab文件时,存在camellia*-cts-cmac加密方式
kadmin.local:  xst -kt dengsc.keytab dengsc
Entry for principal dengsc with kvno 6, encryption type aes128-cts-hmac-sha1-96 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type des3-cbc-sha1 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type arcfour-hmac added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type camellia256-cts-cmac added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type camellia128-cts-cmac added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type des-hmac-sha1 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 6, encryption type des-cbc-md5 added to keytab WRFILE:dengsc.keytab.

# klist 查看keytab文件结构,存在camellia*-cts-cmac加密方式
[dengsc@nfjd-hadoop02-node179 ~]$ klist -ket dengsc.keytab 
Keytab name: FILE:dengsc.keytab
KVNO Timestamp           Principal
---- ------------------- ------------------------------------------------------
   6 09/19/2017 13:44:46 [email protected] (aes128-cts-hmac-sha1-96) 
   6 09/19/2017 13:44:46 [email protected] (des3-cbc-sha1) 
   6 09/19/2017 13:44:46 [email protected] (arcfour-hmac) 
   6 09/19/2017 13:44:46 [email protected] (camellia256-cts-cmac) 
   6 09/19/2017 13:44:46 [email protected] (camellia128-cts-cmac) 
   6 09/19/2017 13:44:46 [email protected] (des-hmac-sha1) 
   6 09/19/2017 13:44:46 [email protected] (des-cbc-md5) 
   
# 修改kdc.conf
[dengsc@nfjd-hadoop02-node179 ~]$ sudo grep supported_enctypes /var/kerberos/krb5kdc/kdc.conf 
  supported_enctypes = aes128-cts:normal des3-hmac-sha1:normal arcfour-hmac:normal des-hmac-sha1:normal des-cbc-md5:normal des-cbc-crc:normal
  
# 重启krb5kdc服务
[dengsc@nfjd-hadoop02-node179 ~]$ sudo service krb5kdc restart
Redirecting to /bin/systemctl restart  krb5kdc.service

# 读取principal信息,camellia*-cts-cmac加密方式已删除
Principal: [email protected]
Expiration date: [never]
Last password change: Tue Sep 19 13:32:33 CST 2017
Password expiration date: [none]
Maximum ticket life: 1 day 00:00:00
Maximum renewable life: 31 days 00:00:00
Last modified: Tue Sep 19 13:32:33 CST 2017 (root/[email protected])
Last successful authentication: [never]
Last failed authentication: [never]
Failed password attempts: 0
Number of keys: 5
Key: vno 21, aes128-cts-hmac-sha1-96
Key: vno 21, des3-cbc-sha1
Key: vno 21, arcfour-hmac
Key: vno 21, des-hmac-sha1
Key: vno 21, des-cbc-md5
MKey: vno 1
Attributes:
Policy: lockout_policy

# 重新导出princpal
kadmin.local:  xst -k dengsc.keytab dengsc
Entry for principal dengsc with kvno 22, encryption type aes128-cts-hmac-sha1-96 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 22, encryption type des3-cbc-sha1 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 22, encryption type arcfour-hmac added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 22, encryption type des-hmac-sha1 added to keytab WRFILE:dengsc.keytab.
Entry for principal dengsc with kvno 22, encryption type des-cbc-md5 added to keytab WRFILE:dengsc.keytab.

# klist查看principal查看票据信息
[dengsc@nfjd-hadoop02-node179 ~]$ klist -ket dengsc.keytab 
Keytab name: FILE:dengsc.keytab
KVNO Timestamp           Principal
---- ------------------- ------------------------------------------------------
  21 09/19/2017 13:32:33 [email protected] (aes128-cts-hmac-sha1-96) 
  21 09/19/2017 13:32:33 [email protected] (des3-cbc-sha1) 
  21 09/19/2017 13:32:33 [email protected] (arcfour-hmac) 
  21 09/19/2017 13:32:33 [email protected] (des-hmac-sha1) 
  21 09/19/2017 13:32:33 [email protected] (des-cbc-md5)
  
# kinit 认证
[dengsc@nfjd-hadoop02-node179 ~]$ kinit -kt dengsc.keytab dengsc
[dengsc@nfjd-hadoop02-node179 ~]$ klist
Ticket cache: FILE:/tmp/krb5cc_2190
Default principal: [email protected]

Valid starting       Expires              Service principal
09/19/2017 13:58:46  09/20/2017 13:58:46  krbtgt/[email protected]
    renew until 09/26/2017 13:58:46

# 注意,此方法将导致原先的keytab文件失效
[xujun@nfjd-hadoop02-node179 keytab]$ kinit -kt xujun.keytab xunjun
kinit: Keytab contains no suitable keys for [email protected] while getting initial credentials

你可能感兴趣的:(从根源解决RHEL 6.x主机执行kinit -kt命令报错'kinit: Bad encryption type while getting initial credentials')