Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-17207

Hiveserver2 fails to start when hive.server2.authentication is set to KERBEROS

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: Authentication
    • Labels:
      None

      Description

      The logic in getAuthTransFactory() is flawed, as it will always return "Unsupported authentication type" error when authTypeStr is set to KERBEROS.

      inside HiveAuthFactory class.
      public TTransportFactory getAuthTransFactory()
      throws LoginException
      {
      TTransportFactory transportFactory;
      if (isSASLWithKerberizedHadoop())
      {
      try

      { serverTransportFactory = this.saslServer.createSaslServerTransportFactory( getSaslProperties()); }

      catch (TTransportException e)

      { TSaslServerTransport.Factory serverTransportFactory; throw new LoginException(e.getMessage()); }

      TSaslServerTransport.Factory serverTransportFactory;
      if (!this.authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
      if ((this.authTypeStr.equalsIgnoreCase(AuthTypes.NONE.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.LDAP.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.PAM.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.CUSTOM.getAuthName()))) {
      try

      { serverTransportFactory.addServerDefinition("PLAIN", this.authTypeStr, null, new HashMap(), new PlainSaslHelper.PlainServerCallbackHandler(this.authTypeStr)); }

      catch (AuthenticationException e)

      { throw new LoginException("Error setting callback handler" + e); }

      } else

      { throw new LoginException("Unsupported authentication type " + this.authTypeStr); }
      }
      transportFactory = this.saslServer.wrapTransportFactory(serverTransportFactory);
      }
      else
      {
      TTransportFactory transportFactory;
      if ((this.authTypeStr.equalsIgnoreCase(AuthTypes.NONE.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.LDAP.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.PAM.getAuthName())) ||
      (this.authTypeStr.equalsIgnoreCase(AuthTypes.CUSTOM.getAuthName())))
      { transportFactory = PlainSaslHelper.getPlainTransportFactory(this.authTypeStr); }
      else
      {
      TTransportFactory transportFactory;
      if (this.authTypeStr.equalsIgnoreCase(AuthTypes.NOSASL.getAuthName())) { transportFactory = new TTransportFactory(); } else { throw new LoginException("Unsupported authentication type " + this.authTypeStr); }

      }
      }
      TTransportFactory transportFactory;
      return transportFactory;
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              navandrey Rey Rey Chang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Due:
                Created:
                Updated: