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

How to generate login.conf and krb5.ini for use with Java Kerbernos Http Client to auth with Active Directory kerberos?

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

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

格式是这里描述的登录配置: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

我还找到了一些相关的软件文章(列在下面)。

但其中 none 似乎描述了实际创建 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

在 Windows

上创建密钥表
ktpass /princ kerberos500@FUSIONIS.LIFE /pass password /ptype KRB5_NT_PRINCIPAL /out kerberos500.keytab

在 Ubuntu Linux

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

相关沙发:

Simple Kerberos client in Java?

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

我想在问完这个问题之后,答案是 -> 使用我提供的文档链接来了解在这些文件中放入什么,然后自己设置它们。找到一个让您入门的示例很有用(我已经完成了)。没有构建这些的命令。这完全是手动的。