前言

之前的博文中涉及到了Kerberos的内容,这里对Kerberos ticket lifetime相关的内容做一个补充。

ticket lifetime

Kerberos ticket具有lifetime,超过此时间则ticket就会过期,需要重新申请或renew。ticket lifetime取决于以下5项设置中的最小值:

  • Kerberos server上/var/kerberos/krb5kdc/kdc.conf中max_life
  • 内置principal krbtgt的maximum ticket life,可在kadmin命令行下用getprinc命令查看
  • 你的principal的maximum ticket life,可在kadmin命令行下用getprinc命令查看
  • Kerberos client上/etc/krb5.conf的ticket_lifetime
  • kinit -l 参数后面指定的时间

ticket renew lifetime

ticket过期后,如果想延长,一种方法是重新申请(需要输入密码),另一种是renew(不需要输入密码),每renew一次,就延长一个lifetime。不过renew操作本身也有lifetime,即在ticket renew lifetime,在此lifetime之内,才能进行renew操作。与上面的很相似,ticket renew lifetime取决于以下5项设置中的最小值:

  • Kerberos server上/var/kerberos/krb5kdc/kdc.conf中max_renewable_life
  • 内置principal krbtgt的maximum renewable life,可在kadmin命令行下用getprinc命令查看
  • 你的principal的maximum renewable life,可在kadmin命令行下用getprinc命令查看
  • Kerberos client上/etc/krb5.conf的renew_lifetime
  • kinit -r 参数后面指定的时间

HBase与ticket lifetime

HBase需要长时间运行,它对ticket过期问题的处理见org.apache.hadoop.hbase.ipc.RpcClient,方法handleSaslConnectionFailure(),方法注释中提到HBase是尝试自动relogin,从代码上看应该是直接获取一个新的ticket,而不是进行renew。

The other problem is to do with ticket expiry. To handle that, a relogin is attempted.
The retry logic is governed by the shouldAuthenticateOverKrb method. In case when the user doesn't have valid credentials, we don't need to retry (from cache or ticket). In such cases, it is prudent to throw a runtime exception when we receive a SaslException from the underlying authentication implementation, so there is no retry from other high level (for eg, HCM or HBaseAdmin).

另外:

[org.apache.hadoop.security.UserGroupInformation] Not attempting to re-login since the last re-login was attempted less than 600 seconds before.

这个错误实际是由于UserGroupInformation中的一个hard code值引起的,MIN_TIME_BEFORE_RELOGIN=10*60*1000L,是hadoop自己做出的限制,即不允许过于频繁地relogin,需要将ticket_lifetime设置为大于10分钟即可。

keytab与ticket lifetime

keytab文件实际只是一个密码文件,显然,修改lifetime相关设置跟密码是没有关系的,不需要去重新生成现有的keytab文件。

一些命令

  • kadmin: modprinc -maxrenewlife 11days +allow_renewable {principal}
  • kadmin: modprinc -maxlife 6minutes {principal}
  • kadmin: getprinc {principal} //retrieve the detail info of principal
  • kinit -R //renew current ticket
  • kinit {principal} -kt {keytab file} //init a principal via keytab file

Kerberos ticket lifetime及其它的更多相关文章

  1. CLIENT_0004:Unable to find valid Kerberos ticket cache (kinit)

    背景 今天在使用JavaAPI来连接sqoop1.99.7的时候,遇到了个错误. 错误信息如下: 0 [main] WARN org.apache.hadoop.util.NativeCodeLoad ...

  2. Kerberos Ticket管理

    Kerberos Ticket管理 本章介绍如何管理您的Kerberos Ticket,这里的Ticket是指Ticket-Granting-Ticket(TGT),是您访问集群中服务的凭证.我们假设 ...

  3. [Kerberos] User Ticket Management

    Kerberos客户端常用命令包括 kinit, klist, kdestroy, and kpasswd,用户使用这些命令管理自己的 ticket. 此外,每台运行Kerberos的机器应该都配置/ ...

  4. HBase + Kerberos 配置示例(二)

    接上篇<HBase + Kerberos配置示例(一)>,我们继续剩下的配置工作. 环境准备 Hadoop配置 Zookeeper配置 HBase配置 Java测试程序 环境准备 安装ha ...

  5. mimikazhi Kerberos Modules

    Kerberos Modules 1.   .#####.   mimikatz 2.0 alpha (x64) release "Kiwi en C" (Oct  9201500 ...

  6. Kerberos简介及常见问题

    基本描述 Kerberos使用Needha-Schroeder协议作为它的基础.它使用了一个由两个独立的逻辑部分:认证服务器和票据授权服务器组成的"可信赖的第三方",术语称为密钥分 ...

  7. 为CDH 5.7集群添加Kerberos身份验证及Sentry权限控制

    转载请注明出处:http://www.cnblogs.com/xiaodf/ 4. 为CDH 5集群添加Kerberos身份验证 4.1 安装sentry1.点击“操作”,“添加服务”:2.选择sen ...

  8. FIM 2010: Kerberos Authentication Setup

    The goal of this article is to provide some background information regarding the Kerberos related co ...

  9. 【管理工具】Kerberos简单应用

    Kerberos这一名词来源于希腊神话“三个头的狗——地狱之门守护者”系统设计上采用客户端/服务器结构与DES加密技术,并且能够进行相互认证,即客户端和服务器端均可对对方进行身份认证.可以用于防止窃听 ...

随机推荐

  1. android studio小技巧

    1. 为了防止乱码,请将 android studio 右下角编码设置成 UTF-8 2. Ctri + Q 查看api 3 Ctri + Shift +U 大小写互换 4 Ctrl + Alt + ...

  2. JS调用BHO

    // BHO 中添加下面的函数,设置UIHandler// BHO 包含如下成员变量: // CDocDispatch m_docDispatch;// CComPtr<IDocHostUIHa ...

  3. js-特效部分学习-拖拽效果

    一.客户区大小ClientWidth和ClientHeight <style> #box { width: 200px; height: 200px; background-color: ...

  4. DHCP工作过程

    第一步是客户机发出的DHCPDSCOVER广播消息在网络上查找DHCP服务器. 任何收到这个消息的DHCP服务器产生一个DHCPOFFER的广播信息,其中包含配置信息,诸如IP地址.租期和域名.如果在 ...

  5. dialog 中装listview并让每一个item分隔悬空,并具有radiobutton的效果

    先上图 两个关键地方,一是让dialog全透明,二是让listitem分开. 首先定义一个自定义的dialog 布局文件,这个只是包含一个listview而已 <?xml version=&qu ...

  6. java实验一 20135104刘帅

    实验报告 一.实验目的与要求: 实验目的: 1. 使用JDK编译.运行简单的Java程序 2.使用Eclipse 编辑.编译.运行.调试Java程序 实验要求: 1.没有Linux基础的同学建议先学习 ...

  7. 河南省第六届ACM程序设计大赛

    C:  最舒适的路线 (并查集) #include<cstdio> #include<cstring> #include<iostream> #include< ...

  8. pgsql 常用的命令

    pgsql 常用的命令:1. 创建数据库create database name with owner username; 2. 创建用户create role with createdb ;crea ...

  9. curl 命令

    看了篇文章: http://www.thegeekstuff.com/2012/04/curl-examples/ 如下: curl支持的协议有:DICT, FILE, FTP, FTPS, Goph ...

  10. 手机端使用rem适配

    最近一直在做手机端的东西,各种型号的手机适配很是无解.经过同事及百度找到了这么一个方法 html font-size默认100px 将rem进行换算1px==0.01rem; 页面在各个手机适配个别会 ...