Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13565

KerberosAuthenticationHandler#authenticate should not rebuild SPN based on client request



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5.0
    • 2.8.0, 3.0.0-alpha2
    • security
    • None
    • Reviewed


      In KerberosAuthenticationHandler#authenticate, we use canonicalized server name derived from HTTP request to build server SPN and authenticate client. This can be problematic if the HTTP client/server are running from a non-local Kerberos realm that the local realm has trust with (e.g., NN UI).

      For example,
      The server is running its HTTP endpoint using SPN from the client realm:

      When client sends request to namenode at http://NN1.example.com:50070 from client.test.com@TEST.COM.

      The client talks to KDC first and gets a service ticket HTTP/NN1.example.com/TEST.COM to authenticate with the server via SPNEGO negotiation.

      The authentication will end up with either no valid credential error or checksum failure depending on the HTTP client naming resolution or HTTP Host field from the request header provided by the browser.

      The root cause is KerberosUtil.getServicePrincipal("HTTP", serverName)}} will always return a SPN with local realm (HTTP/NN.example.com@EXAMPLE.COM) no matter the server login SPN is from that domain or not.

      The proposed fix is to change to use default server login principal (by passing null as the 1st parameter to gssManager.createCredential()) instead. This way we avoid dependency on HTTP client behavior (Host header or name resolution like CNAME) or assumption on the local realm.


        1. HADOOP-13565.00.patch
          2 kB
          Xiaoyu Yao
        2. HADOOP-13565.01.patch
          12 kB
          Xiaoyu Yao
        3. HADOOP-13565.02.patch
          17 kB
          Xiaoyu Yao
        4. HADOOP-13565.03.patch
          17 kB
          Xiaoyu Yao

        Issue Links



              xyao Xiaoyu Yao
              xyao Xiaoyu Yao
              0 Vote for this issue
              11 Start watching this issue