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

SentryTransportFactory may use incorrect kerberos principal

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Sentry
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: