aljoscha commented on a change in pull request #10891: 
[FLINK-15561][Security][hotfix] Add Delegation Token checker in 
YarnClusterDescriptor
URL: https://github.com/apache/flink/pull/10891#discussion_r376280166
 
 

 ##########
 File path: 
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/util/HadoopUtils.java
 ##########
 @@ -112,6 +112,27 @@ public static Configuration 
getHadoopConfiguration(org.apache.flink.configuratio
                return result;
        }
 
+       public static boolean isCredentialsConfigured(boolean useTicketCache) 
throws Exception {
+               UserGroupInformation loginUser = 
UserGroupInformation.getCurrentUser();
+               if (UserGroupInformation.isSecurityEnabled()) {
+                       // note: UGI::hasKerberosCredentials inaccurately 
reports false
+                       // for logins based on a keytab (fixed in Hadoop 2.6.1, 
see HADOOP-10786),
+                       // so we check only in ticket cache scenario.
+                       if (useTicketCache && 
!loginUser.hasKerberosCredentials()) {
+                               // a delegation token is an adequate substitute 
in most cases
+                               if (!HadoopUtils.hasHDFSDelegationToken()) {
+                                       LOG.warn("Hadoop security is enabled 
but current login user does not have Kerberos credentials, " +
 
 Review comment:
   Are the two branches in the wrong order here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to