web-dev-qa-db-ja.com

Java LinuxクライアントのキャッシュからTGTを取得できませんでした

RHEL5.5でKerberosサーバーとOpenLDAPをセットアップしました。クライアントとしてRHEL6マシンも使用しています。 LinuxクライアントからOpenLDAPサーバーを照会するためにjaasを使用してJavaプログラムを実行しました。

クライアントのキータブをクライアントマシンにコピーし、次の構成オプションを使用すると、OpenLDAPサーバーにクエリを実行できます。

principal=wpingli
useKeyTab=true
keyTab="/home/wpingli/ker/Java/wpingli_new.keytab";

ユーザー/パスワードの入力を求められた場合は、OpenLDAPサーバーにクエリを実行することもできます。これにより、自分の環境は良いと思います。

ただし、kinitの後にJavaプログラムを実行すると、サーバーにクエリを実行できません。

klist
[wpingli@pli Java]$ klist
Ticket cache: FILE:/tmp/krb5cc_500
Default principal: [email protected]
Valid starting Expires Service principal
10/20/11 16:18:06 10/21/11 16:18:02 krbtgt/[email protected]

jaas configuration
GssExampleSUN{
com.Sun.security.auth.module.Krb5LoginModule required
client=true
debug=true
doNotPrompt=true
useTicketCache=true
ticketCache="/tmp/krb5cc_500";
};

Exception:
Debug is true storeKey false useTicketCache true useKeyTab false doNotPrompt true ticketCache is /tmp/krb5cc_500 isInitiator true KeyTab is null refreshKrb5Config is false principal is null tryFirstPass is false useFirstPass is false storePass is false clearPass is false
Acquire TGT from Cache
Principal is null
**null credentials from Ticket Cache
[Krb5LoginModule] authentication failed
Unable to obtain Princpal Name for authentication
Authentication attempt failedjavax.security.auth.login.LoginException: Unable to obtain Princpal Name for authentication**

どうすれば修正できますか?

5
ricky_ru

Javaは必ずしも(おそらくMIT)kinitlibkrb5)でサポートされているすべての暗号化タイプをサポートしているわけではありません。

libkrb5ファイルのkrb5.confが使用する暗号化タイプを構成できます(通常は/etc内)。たとえば(必ずしも最も安全なものではありません):

# default_tgs_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc des-cbc-md5

# default_tkt_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc des-cbc-md5

# permitted_enctypes = aes256-cts arcfour-hmac-md5 des3-hmac-sha1 des-cbc-crc des-cbc-md5
permitted_enctypes = des3-hmac-sha1 des-cbc-crc des-cbc-md5

サポートされている暗号化タイプは、JREベンダー/バージョンとそのセキュリティプロバイダーによって異なります。

Java 6(Oracle JRE))のドキュメントへのリンクは次のとおりです。

5
Bruno