Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10296

FileContext.getDelegationTokens() fails to obtain KMS delegation token

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.6.0
    • None
    • encryption
    • None
    • CDH 5.6 with a Java KMS

    Description

      This little program demonstrates the problem: With FileSystem, we can get both the HDFS and the kms-dt token, whereas with FileContext, we can only obtain the HDFS delegation token.

      public class SimpleTest {
      
        public static void main(String[] args) throws IOException {
          YarnConfiguration hConf = new YarnConfiguration();
          String renewer = "renewer";
      
          FileContext fc = FileContext.getFileContext(hConf);
          List<Token<?>> tokens = fc.getDelegationTokens(new Path("/"), renewer);
          for (Token<?> token : tokens) {
            System.out.println("Token from FC: " + token);
          }
      
          FileSystem fs = FileSystem.get(hConf);
          for (Token<?> token : fs.addDelegationTokens(renewer, new Credentials())) {
            System.out.println("Token from FS: " + token);
          }
        }
      }
      

      Sample output (host/user name x'ed out):

      Token from FC: Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:xxx, Ident: (HDFS_DELEGATION_TOKEN token 49 for xxx)
      Token from FS: Kind: HDFS_DELEGATION_TOKEN, Service: ha-hdfs:xxx, Ident: (HDFS_DELEGATION_TOKEN token 50 for xxx)
      Token from FS: Kind: kms-dt, Service: xx.xx.xx.xx:16000, Ident: 00 04 63 64 61 70 07 72 65 6e 65 77 65 72 00 8a 01 54 16 96 c2 95 8a 01 54 3a a3 46 95 0e 02
      

      Apparently FileContext does not return the KMS token.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              anew Andreas Neumann
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: