Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-4741

ReportLineageToAtlas stops working after expiration of DelegationToken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.5.0
    • Extensions
    • None

    Description

      While I was testing if NiFi Atlas integration implementation regarding to Kerberos authentication has to be updated based on the findings with NIFI-4323, I encountered different type of issue with Atlas REST API and Kerberos authentication.

      If my understanding is correct, Atlas REST API Kerberos authentication works as follows:

      1. Atlas Client application logs in locally by using specified user principal and its keytab, (or this can be done with ticket cache)
      2. Atlas Client sends a HTTP request with a DelegationToken. At the 1st request, this token is null.
      3. Atlas Server receives a HTTP request, if token is not set, it will respond with 401, and ask the client to negotiate.
      4. Atlas Client serializes current UserGroupInformation credential in base64 encoding then send it to Atlas Server.
      5. Atlas Server verifies the base64 representation of the user credential, if it's valid, publish a DelegationToken. Returns it as set cookie.
      6. Atlas Client uses the returned DelegationToken with subsequent requests.

      At point 5 above, the newly created DelegationToken has 10h expiration by default. DelegationToken expiration is different from Kerberos login lifetime. So a use-case using Atlas client with Kerberos has to handle two expiration cases.

      Currently, it seems Atlas client does not handle DelegationToken expiration automatically. After passing the DeligationToken validity period, Atlas server returns 401 Unauthorized response, and Atlas client used by NiFi reporting task keeps showing following error:

      Metadata service API org.apache.atlas.AtlasBaseClient$APIInfo@6604f000 failed with status 401 (Unauthorized) Response Body (<html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
      <title>Error 401 AuthenticationToken expired</title>
      </head>
      <body><h2>HTTP ERROR 401</h2>
      <p>Problem accessing /api/atlas/v2/entity/uniqueAttribute/type/nifi_flow. Reason:
      <pre>    AuthenticationToken expired</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
      <br/>
      

      NiFi ReportLineageToAtlas reporting task should handle the DelegationToken expiration situation correctly. And also it needs to renew Kerberos ticket.

      A simple solution to address both expirations is initializing AtlasClientV2 instance at every onTrigger execution. Current implementation keeps using the same AtlasClientV2 instance.

      Attachments

        Issue Links

          Activity

            People

              ijokarumawak Koji Kawamura
              ijokarumawak Koji Kawamura
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: