[ 
https://issues.apache.org/jira/browse/HADOOP-13805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15653489#comment-15653489
 ] 

Alejandro Abdelnur commented on HADOOP-13805:
---------------------------------------------

A quick way to verify the proposed solution work is using running the following 
snippet and wait until the TGT expires:

{code}
    UserGroupInformation.setShouldRenewImmediatelyForTests(true);

    UserGroupInformation.loginUserFromSubject(subject);
    UserGroupInformation ugi = UserGroupInformation.getLoginUser();
    for (int i = 0; i < 100; i++) {
      System.out.printf("*******Into %dsecs\n", i * 30*1000);
      ugi.doAs(new PrivilegedExceptionAction<Object>() {
        @Override
        public Object run() throws Exception {
          URI uri = new URI("kms://http@localhost:16000/kms");
          KMSClientProvider provider = (KMSClientProvider) new 
KMSClientProvider.Factory().createProvider(uri, hConf);
          System.out.println(provider.getKeys());
          return null;
        }
      });
      for (int j = 0; j < 30; j++) {
        System.out.println("! " + j);
        System.out.flush();
        Thread.sleep(1000);
      }
      System.out.println();
    }
{code}

> UGI.getCurrentUser() fails if user does not have a keytab associated
> --------------------------------------------------------------------
>
>                 Key: HADOOP-13805
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13805
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: security
>    Affects Versions: 2.8.0, 2.9.0, 3.0.0-alpha2
>            Reporter: Alejandro Abdelnur
>            Priority: Blocker
>
> HADOOP-13558 intention was to avoid UGI from trying to renew the TGT when the 
> UGI is created from an existing Subject as in that case the keytab is not 
> 'own' by UGI but by the creator of the Subject.
> In HADOOP-13558 we introduced a new private UGI constructor 
> {{UserGroupInformation(Subject subject, final boolean externalKeyTab)}} and 
> we use with TRUE only when doing a {{UGI.loginUserFromSubject()}}.
> The problem is, when we call {{UGI.getCurrentUser()}}, and UGI was created 
> via a Subject (via the {{UGI.loginUserFromSubject()}} method), we call {{new 
> UserGroupInformation(subject)}} which will delegate to 
> {{UserGroupInformation(Subject subject, final boolean externalKeyTab)}}  and 
> that will use externalKeyTab == *FALSE*. 
> Then the UGI returned by {{UGI.getCurrentUser()}} will attempt to login using 
> a non-existing keytab if the TGT expired.
> This problem is experienced in {{KMSClientProvider}} when used by the HDFS 
> filesystem client accessing an an encryption zone.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to