Uploaded image for project: 'Sentry (Retired)'
  1. Sentry (Retired)
  2. SENTRY-872 Uber jira for HMS HA + Sentry HA redesign
  3. SENTRY-1737

SentryTransportFactory may use incorrect kerberos principal

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • Sentry
    • None

    Description

      The new SentryTransportFactory introduced in SENTRY-1593 has the following code in createTransport():

            String serverPrincipal = transportConfig.getSentryPrincipal(conf);
            serverPrincipal = SecurityUtil.getServerPrincipal(serverPrincipal, serverAddress.getAddress());
            LOGGER.debug("Using server kerberos principal: " + serverPrincipal);
            if (serverPrincipalParts == null) {
              serverPrincipalParts = SaslRpcServer.splitKerberosName(serverPrincipal);
              Preconditions.checkArgument(serverPrincipalParts.length == 3,
                "Kerberos principal should have 3 parts: " + serverPrincipal);
            }
      

      So it caches serverPrincipalParts at the instance level. But the same instance can be used to create transports for mutiple destinations which will have different server principal, so the following code:

            return new UgiSaslClientTransport(SaslRpcServer.AuthMethod.KERBEROS.getMechanismName(),
              serverPrincipalParts[0], serverPrincipalParts[1],
              socket, wrapUgi, conf);
      

      may return a transport with the wrong principal.

      Attachments

        Issue Links

          Activity

            People

              akolb Alex Kolbasov
              akolb Alex Kolbasov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: