如何续订用于 Amazon EMR 身份验证的过期 Kerberos 票证?

2 分钟阅读
0

我在 Amazon EMR 集群上使用 Kerberos 进行身份验证。但我的 Kerberos 票证已过期。当尝试在集群上运行命令时,我收到类似于如下的错误消息: 19/11/04 22:12:16 WARN ipc.Client: Exception encountered while connecting to the server : javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)] ls: Failed on local exception: java.io.IOException: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]; Host Details : local host is: "ip-xxx-x-x-x.ec2.internal/192.x.x.x";destination host is: "ip-xxx-x-x-x.ec2.internal":8020;

简短描述

请执行以下操作以续订已过期的 Kerberos 票证:

1.    运行 klist 命令,以显示由密钥分发中心 (KDC) 颁发的凭证。

2.    要获取新票证,运行 kinit 命令并指定包含凭证的密钥表文件,或输入您的委托人的密码。

解决方法

1.    使用 SSH 连接到主节点

2.    要确认票证已过期,运行 klist 命令。此命令将检查凭证缓存。如果无凭证被缓存,则票证已过期。

[hadoop@ip-xxx-x-x-xxx ~]$ klist
klist: No credentials cache found (filename: /tmp/krb5cc_498)

3.    要确认 Kerberos 委托人名称,列出密钥表文件的内容:

[hadoop@ip-xxx-x-x-xxx ~]$ klist -kt /etc/hadoop.keytab
Keytab name: FILE:/etc/hadoop.keytab
KVNO Timestamp           Principal
---- ------------------- ------------------------------------------------------
   2 07/04/2019 21:48:46 hadoop/ip-xxx-x-x-xxx.ec2.internal@EC2.INTERNAL
   2 07/04/2019 21:48:46 hadoop/ip-xxx-x-x-xxx.ec2.internal@EC2.INTERNAL
   2 07/04/2019 21:48:46 hadoop/ip-xxx-x-x-xxx.ec2.internal@EC2.INTERNAL

4.    要续订 Kerberos 票证,运行 kinit 并指定密钥表文件和委托人:

[hadoop@ip-xxx-x-x-xxx ~]$ kinit -kt /etc/hadoop.keytab hadoop/ip-xxx-x-x-xxx.ec2.internal@EC2.INTERNAL

5.    确认凭证已缓存:

[hadoop@ip-xxx-x-x-xxx ~]$ klist
Ticket cache: FILE:/tmp/krb5cc_498
Default principal: hadoop/ip-xxx-x-x-xxx.ec2.internal@EC2.INTERNAL
Valid starting       Expires              Service principal
11/04/2019 22:13:47  11/05/2019 08:13:47  krbtgt/EC2.INTERNAL@EC2.INTERNAL
renew until 11/06/2019 22:13:47

6.    运行 HDFS 命令以确认 Kerberos 票证正常工作:

[hadoop@ip-XXX-XX-XX-XXX ~]$ hdfs dfs -ls /
Found 4 items
drwxr-xr-x   - hdfs hadoop          0 2019-11-05 22:45 /apps
drwxrwxrwt   - hdfs hadoop          0 2019-11-05 22:46 /tmp
drwxr-xr-x   - hdfs hadoop          0 2019-11-05 22:45 /user
drwxr-xr-x   - hdfs hadoop          0 2019-11-05 22:45 /var

相关信息

使用 Kerberos 身份验证

AWS 官方
AWS 官方已更新 3 年前