diff --git a/.gitignore b/.gitignore index fddfe7cd..f312d079 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,13 @@ +*.iml +*.sublime-* +*.swp +.classpath +.idea/ +.project +.settings +/bin azkaban-hadoopsecuritymanager-*.jar azkaban-jobtype-*.jar azkaban-pigvisualizer-*.jar -/bin -.classpath dist/ -.project -.settings -*.sublime-* -*.swp +out/ diff --git a/plugins/hadoopsecuritymanager-common/src/azkaban/security/commons/HadoopSecurityManager.java b/plugins/hadoopsecuritymanager-common/src/azkaban/security/commons/HadoopSecurityManager.java index df2de029..03ae6fa3 100644 --- a/plugins/hadoopsecuritymanager-common/src/azkaban/security/commons/HadoopSecurityManager.java +++ b/plugins/hadoopsecuritymanager-common/src/azkaban/security/commons/HadoopSecurityManager.java @@ -17,6 +17,7 @@ package azkaban.security.commons; import java.io.File; +import java.io.IOException; import java.util.Properties; import org.apache.hadoop.fs.FileSystem; @@ -46,6 +47,13 @@ public boolean isHadoopSecurityEnabled() return false; } + public void reloginFromKeytab() throws IOException { + UserGroupInformation ugi = UserGroupInformation.getLoginUser(); + if (ugi.isFromKeytab()){ + ugi.checkTGTAndReloginFromKeytab(); + } + } + /** * Create a proxied user based on the explicit user name, taking other * parameters necessary from properties file. diff --git a/plugins/hadoopsecuritymanager-yarn/src/azkaban/security/HadoopSecurityManager_H_2_0.java b/plugins/hadoopsecuritymanager-yarn/src/azkaban/security/HadoopSecurityManager_H_2_0.java index ee69a50d..9c7757ad 100644 --- a/plugins/hadoopsecuritymanager-yarn/src/azkaban/security/HadoopSecurityManager_H_2_0.java +++ b/plugins/hadoopsecuritymanager-yarn/src/azkaban/security/HadoopSecurityManager_H_2_0.java @@ -229,6 +229,10 @@ public static HadoopSecurityManager getInstance(Props props) } } } + + logger.debug("Relogging in from keytab if necessary."); + hsmInstance.reloginFromKeytab(); + return hsmInstance; }