首页 文章

如何生成login.conf和krb5.ini以与Java Kerbernos Http Client一起使用以使用Active Directory kerberos进行身份验证?

提问于
浏览
0

我想使用Kerberos从Java应用程序对IIS kerberos保护的网站进行身份验证 . 目标是能够使用密钥表文件对服务帐户进行身份验证,而无需指定用户名和密码 .

This describes how to use http client to auth using kerberos . 但它需要一些特殊的配置文件 login.confkrb5.ini .

格式是登录conf在这里描述:https://docs.oracle.com/javase/8/docs/technotes/guides/security/jgss/tutorials/LoginConfigFile.html

krb5.ini文件的格式如下所述:https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html

我还发现了一些相关的sof文章(如下所列) .

但它们似乎都没有描述实际创建 login.conf 文件和 krb5.conf / krb5.ini 文件以用于Active Directory的过程 .

生成这些文件以用于Windows Active Directory kerberos情况的步骤是什么?

这是我到目前为止所拥有的,但我完全没有从朋友那里找到的例子以及网络上的随机链接 .

login.conf

KrbLogin {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  storeKey=true
  keyTab="file:///C:/kerb/kerberos500.keytab"
  useTicketCache=true
  principal="kerberos500@FUSIONIS.LIFE"
  debug=true;
};

com.sun.security.jgss.initiate {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  storeKey=true
  keyTab="/home/ndipiazza/lucidworks/httpclient-tester/kb.keytab"
  useTicketCache=true
  principal="kerberos500@FUSIONIS.LIFE"
  debug=true;
};

krb5.ini

[libdefaults]
    default_realm = FUSIONIS.LIFE
    default_tkt_enctypes = aes128-cts-hmac-sha1-96 rc4-hmac
    default_tgs_enctypes = aes128-cts-hmac-sha1-96  rc4-hmac
    permitted_enctypes = aes128-cts-hmac-sha1-96 rc4-hmac
    dns_lookup_realm = false
    dns_lookup_kdc = false
    ticket_lifetime = 24h
    renew_lifetime = 7d
    forwardable = true
    udp_preference_limit = 1

[realms]
FUSIONIS.LIFE = {
   kdc = 192.168.1.71
   admin_server = 192.168.1.71
}

[domain_realm]
.fusionis.life = FUSIONIS.LIFE
fusionis.life = FUSIONIS.LIFE

Create the keytab on Windows

ktpass /princ kerberos500@FUSIONIS.LIFE /pass password /ptype KRB5_NT_PRINCIPAL /out kerberos500.keytab

Creating the KeyTab on Ubuntu Linux

ktutil
addent -password -p kerberos500@FUSIONIS.LIFE -k 1 -e RC4-HMAC
- it will ask you for password of kerberos500 -
wkt kerberos500.keytab
q

相关软件:

HttpClient set credentials for Kerberos authentication

Simple Kerberos client in Java?

Where is the krb5.ini file in alter Windows file gone?

1 回答

  • 1

    我想在得到这个之后,答案是 - >使用我提供的文档链接来学习放在这些文件中的内容,然后自己设置 . 找到一个让你入门的例子是有用的(我已经完成了) . 没有命令来构建这些 . 这完全是手动的 .

相关问题