代码之家  ›  专栏  ›  技术社区  ›  payloc91

Windows事件查看器-Kerberos登录后立即注销

  •  0
  • payloc91  · 技术社区  · 8 年前

    从我的机器上请求一张包含 kinit http/app.company.local@company.local的票据后,我打开网页上的 chrome 并获取stacktrace:。

    在Sun。 在Sun.Security .jgSS.gsCurrimthP.Access Secur语境(GSSValuiTPL .java:285) 在Org.Eclipse中。JETTY。Security。身份验证。Login Authigecoto.Login(Login Authigecoto.java:61) 在Org.Eclipse中,JETTy. Security . Security Healthor.句柄(Security Healthor.java:483) 在Org.Eclipse中,jyty.Serv.Server句柄(Server .java:524) 在Org.Eclipse .jyty.Serv.HtpCorn.NoFrimable(HoppCorn.java:253) 在Org.Eclipse中。JETTY。IO。FIALLITE。 在Org.Eclipse .jyty.Io.ActudioCopyRead回调。成功(Actudio.Corn.java:273) 在Org.Eclipse .jyty.Io.CaseChhannEndoPoT 2美元.Run(StuttChhanelEndoPosi.java:93) 在Org.Eclig.jETy.UTI.Too.Sturial.ExcExtEngEngEuSuM.TuffEngSuMe(ExeExtudioEngutoSuM.java:148) 在Org.Eclipse .jyt.UTI.Tror.QuealthTracePoal.RunJo作业(QuealthTHealthPo.java:671) 在Java.Lang.Trime.Run(线程.java:748)

    我可以找到一些关于这个问题的线索(尽管到目前为止还没有一个能为我工作)。我想服务器会返回一个Web应用程序无法解析的 ntlm token。


  • 另外两个+the logoff event have the id: 0xcde9781a
  • 我正在通过VPN连接到Kerberos服务器
    • 出于某种原因,我得到了错误的代码。

      com.sun.security.jgss.initiate{
      principal=“http/app.company.local”
      useKeytab=真
      调试=真
      }(二)
      
      principal=“http/app.company.local”
      storekey=真
      IsInitiator=假;
      
      
      
      [libdefaults]
      默认_tgs_enctypes=aes128 cts aes256 cts arcfour-hmac-md5 aes256-cts-hmac-sha1-96
      默认的_keytab_name=d:/00_company/workspace/branch_develop/modules/common config/auth/krb5.keytab
      
      [领域]
      管理服务器=192.168.0.5
      }
      
      company.local=公司.local
      
      自动登录=真
      
      
      
      
      
      
      private securityhandler wrapenablessoauthhandlers(final handler collection){
      
      
      //ini文件
      “Java.Security,KRB5.CONF”,
      )(二)
      _ config.getstring(“authentication.win_sso.spnego.login”)。
      系统.setproperty(
      “错误”
      
      spnegoConstraint.setname(constraint.spnego-auth);
      
      //解析为“company.domain”
      
      spnegoConstraint.setAuthenticate(真);
      
      mapping.setpathspec(“/*”);
      
      
      final string spnegoroperties=_config.getstring(“authentication.win_sso.spnego.properties”);
      
      loginservice.setname(域领域);
      
      securityhandler.setloginservice(登录服务);
      securityhandler.setrealmname(域域域);
      
      
      返还担保人;
      
      

      注册:

      最终布尔值enableWinSoAuthentication=_config.getBoolean(“authentication.win_sso.enable”); wrappedsecurityhandler=wrapenablessoauthhandlers(wrappedsecurityhandler); _ server.sethandler(wrappedSecurityhandler);码头

      kinit HTTP/app.company.local@COMPANY.LOCAL我在上打开网页Chrome

      GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)
      at sun.security.jgss.GSSHeader.<init>(GSSHeader.java:97)
      at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:306)
      at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
      at org.eclipse.jetty.security.SpnegoLoginService.login(SpnegoLoginService.java:138)
      at org.eclipse.jetty.security.authentication.LoginAuthenticator.login(LoginAuthenticator.java:61)
      at org.eclipse.jetty.security.authentication.SpnegoAuthenticator.validateRequest(SpnegoAuthenticator.java:99)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
      at org.eclipse.jetty.server.Server.handle(Server.java:524)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
      at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:201)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
      at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
      at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
      at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
      at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
      at java.lang.Thread.run(Thread.java:748)
      

      我可以找到一些关于这个问题的线索(尽管到目前为止还没有一个能为我工作)。我想服务器返回NTLM

      我可以评估

      Kerberos event log

      我想知道为什么GSSException在Web服务器上。


      • Log clear),请LogonSpecial Logon0xCDE977CB.
      • Logoff0xCDE9781A.
      • *.company.local*.company.com
      • 我正在通过VPN连接到Kerberos服务器

      问题产生于GSSHeader.class

      GSSHeader Constructor

      出于某种原因,我得到了错误的代码。

      spnego.conf

      com.sun.security.jgss.initiate {
          com.sun.security.auth.module.Krb5LoginModule required
          principal = "HTTP/app.company.local"
          keyTab = "D:/00_company/workspace/branch_develop/modules/config/auth/krb5.keytab"
          useKeyTab = true
          storeKey = true
          debug = true
          isInitiator = false;
      };
      
      com.sun.security.jgss.accept {
          com.sun.security.auth.module.Krb5LoginModule required
          principal = "HTTP/app.company.local"
          useKeyTab = true
          keyTab = "D:/00_company/workspace/branch_develop/modules/config/auth/krb5.keytab"
          storeKey=true
          debug=true
          isInitiator=false;
      };
      

      krb5.ini

      [libdefaults]
      default_realm = COMPANY.LOCAL
      permitted_enctypes = aes256-cts arcfour-hmac-md5 aes256-cts-hmac-sha1-96
      default_tgs_enctypes = aes128-cts aes256-cts arcfour-hmac-md5 aes256-cts-hmac-sha1-96
      default_tkt_enctypes = aes128-cts aes256-cts arcfour-hmac-md5 aes256-cts-hmac-sha1-96
      default_keytab_name = D:/00_company/workspace/branch_develop/modules/common-config/auth/krb5.keytab
      default_cache_name = C:/Users/mp91/krb5cc_mp91
      
      [realms]
      COMPANY.LOCAL = {
          kdc = PC-i7.COMPANY.local:88
          admin_server = 192.168.0.5
          default_domain = company.local
      }
      
      [domain_realm]
      company.local = COMPANY.LOCAL
      .company.local = COMPANY.LOCAL
      
      [appdefaults]
      autologin = true
      forwardable = true
      

      spnego.properties

      targetName = HTTP/app.company.local
      

      Java以编程方式注册<security-constraint>

      private SecurityHandler wrapEnableSSOAuthHandlers(final Handler collection) {
      
        // programmaticaly set JVM properties
      
        // ini file
        System.setProperty(
              "java.security.krb5.conf",
              _config.getString("authentication.win_sso.spnego.krb5")
        );
        System.setProperty(
              "java.security.auth.login.config",
              _config.getString("authentication.win_sso.spnego.login")
        );
        System.setProperty(
              "javax.security.auth.useSubjectCredsOnly",
              "false"
        );
      
        final Constraint spnegoConstraint = new Constraint();
        spnegoConstraint.setName(Constraint.__SPNEGO_AUTH);
      
        final String domainRealm = _config.getString("authentication.win_sso.domain.realm");
        // resolves to "COMPANY.DOMAIN"
      
        spnegoConstraint.setRoles(new String[]{domainRealm});
        spnegoConstraint.setAuthenticate(true);
      
        final ConstraintMapping mapping = new ConstraintMapping();
        mapping.setConstraint(spnegoConstraint);
        mapping.setPathSpec("/*");
      
        final SpnegoLoginService loginService = new SpnegoLoginService();
      
        final String spnegoProperties = _config.getString("authentication.win_sso.spnego.properties");
      
        loginService.setConfig(spnegoProperties);
        loginService.setName(domainRealm);
      
        final ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
        securityHandler.setLoginService(loginService);
        securityHandler.setConstraintMappings(new ConstraintMapping[]{mapping});
        securityHandler.setRealmName(domainRealm);
        securityHandler.setAuthenticator(new SpnegoAuthenticator());
        securityHandler.setHandler(collection);
      
      
        return securityHandler;
      }
      

      // ...
      Handler wrappedSecurityHandler = wrapDisableTraceHandlers(handlers);
      final boolean enableWinSSOauthentication = _config.getBoolean("authentication.win_sso.enable");
      
      if (enableWinSSOauthentication) {
        wrappedSecurityHandler = wrapEnableSSOAuthHandlers(wrappedSecurityHandler);
      }
      
      _server.setHandler(wrappedSecurityHandler);
      // ...
      
    1 回复  |  直到 8 年前
        1
  •  0
  •   payloc91    8 年前

    解决这个问题的方法(在我的例子中)与 other question

    基本上(引用我的答案):

    NTLM 令牌。