11

spring-security kerberos 拡張機能を使用し、jboss で実行され、Java 6 を実行しているアプリケーションがあります。

jvm を Java 6 から Java 7 にアップグレード中です。これを行うと、Java 6 で動作していたのと同じコードベースと同じキータブを使用すると、Java 7 の使用時にエラーが発生するようになりました。

私は一貫して受け取ります:

他のフォーラムで説明されているさまざまな /crypto オプションを使用してキータブを再生成しようとしましたが、役に立ちませんでした。

Java 7 コードをデバッグしましたが、起動時にキータブの読み取りを処理するクラスが 6 から 7 に変更されました。キータブがアプリに正しく読み取られなくなったのでしょうか? Java6 を使用した起動時に表示されるデバッグ メッセージの一部は、7 では表示されなくなりましたが、それが設計によるものなのか、それとも他の何かが動作していることを示しているのかわかりません。6 から 7 へのアップグレードで問題が発生し、kerberos 統合が壊れた人はいますか? 何かアドバイス?

起動時に spnego と kerberos のデバッグ ログをオンにすると、ログに次のように表示されます。

2012-12-10 10:29:30,886  Debug is  true storeKey true useTicketCache false useKeyTab true doNotPrompt true ticketCache is null isInitiator false KeyTab is jndi:/localhost/docfinity/WEB-INF/classes/config/common/security/http-docfinity.keytab refreshKrb5Config is false principal is HTTP/VMMSSDEV.TESTING.LOCAL@TESTING.LOCAL tryFirstPass is false useFirstPass is false storePass is false clearPass is false
2012-12-10 10:30:26,322  principal is HTTP/VMMSSDEV.TESTING.LOCAL@TESTING.LOCAL
2012-12-10 10:30:29,794  Will use keytab
2012-12-10 10:30:29,807  Ordering keys wrt default_tkt_enctypes list
2012-12-10 10:30:29,821  Config name: C:\Windows\krb5.ini
2012-12-10 10:30:29,827  Using builtin default etypes for default_tkt_enctypes
2012-12-10 10:30:29,832  default etypes for default_tkt_enctypes:
2012-12-10 10:30:29,837   17    aes128-cts-hmac-sha1-96
2012-12-10 10:30:29,839   16    des3-cbc-sha1-kd
2012-12-10 10:30:29,842   23    rc4-hmac
2012-12-10 10:30:29,846   1     des-cbc-crc
2012-12-10 10:30:29,849   3     des-cbc-md5
2012-12-10 10:30:29,851  .
2012-12-10 10:30:29,855  Commit Succeeded 

もう 1 つの質問 - C:\Windows\krb5.ini を読み取ろうとしていることがわかります。サーバーにそのようなファイルはありません。必要ですか?私もJava 6のものを持っていませんでしたが、それはうまくいきました。

アーロン

4

3 に答える 3

2

はい!SunJaasKerberosTicketValidator に次のようにパッチを適用したところ、次のように機能しました。

String keyTabPath = this.keyTabLocation.getURL().toExternalForm();
String runtimeVersion = System.getProperty("java.version");
if (runtimeVersion.startsWith("1.7")) 
{
      LOG.info("Detected jdk 7. Modifying keytabpath");
      if (keyTabPath != null)
      {
        if (keyTabPath.startsWith("file:")) 
        {
            keyTabPath = keyTabPath.substring(5);
        }
      }
}
LOG.info("KeyTabPath: " + keyTabPath);
LoginConfig loginConfig = new LoginConfig(keyTabPath, this.servicePrincipal,
                this.debug);
于 2013-02-04T21:10:12.097 に答える
1

keyTabLocation オブジェクトを文字列に変更します。

So private String keyTabLocaiton.

      @Override
        public void afterPropertiesSet() throws Exception {
            Assert.notNull(this.servicePrincipal, "servicePrincipal must be specified");
            Assert.notNull(this.keyTabLocation, "keyTab must be specified");
            // if (keyTabLocation instanceof ClassPathResource) {
            // LOG.warn("Your keytab is in the classpath. This file needs special protection and shouldn't be in the classpath. JAAS may also not be able to load this file from classpath.");
            // }
            LoginConfig loginConfig = new LoginConfig(this.keyTabLocation, this.servicePrincipal,
                    this.debug);
            Set<Principal> princ = new HashSet<Principal>(1);
            princ.add(new KerberosPrincipal(this.servicePrincipal));
            Subject sub = new Subject(false, princ, new HashSet<Object>(), new HashSet<Object>());
            LoginContext lc = new LoginContext("", sub, null, loginConfig);
            lc.login();
            this.serviceSubject = lc.getSubject();
        }

また、LoginConfig 担当者は、isInitiator フラグを true に設定します。

 public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
            HashMap<String, String> options = new HashMap<String, String>();
            options.put("useKeyTab", "true");
            options.put("keyTab", this.keyTabLocation);
            options.put("principal", this.servicePrincipalName);
            options.put("storeKey", "true");
            options.put("doNotPrompt", "true");
            if (this.debug) {
                options.put("debug", "true");
            }
            options.put("isInitiator", "true");
            //options.put("isInitiator", "false");

            return new AppConfigurationEntry[] { new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule",
                    AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options), };
        }

これが問題の解決に役立つことを願っています。

于 2013-02-01T19:50:08.390 に答える
1

影響を受ける可能性のある 2 つの潜在的な問題を次に示します。

  1. Java 7 は、デフォルトの暗号化タイプの順序を切り替えるようです。詳細:

  2. 使用している JDK 7 の特定のバージョンはわかりませんでしたが、以前のバージョンの JDK 7 にはバグがあり、「file:」URL 経由でキータブ ファイルをロードできませんでした。

SO の別のユーザーは、Spring ソースを変更することで最後の問題を回避しました。

于 2013-01-24T01:44:46.640 に答える