diff --git a/CHANGES.txt b/CHANGES.txt index a20b378ef8..de6f01c60a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -443,6 +443,9 @@ Release 0.22.0 - Unreleased HADOOP-7244. Documentation change for updated configuration keys. (tomwhite via eli) + HADOOP-7189. Add ability to enable 'debug' property in JAAS configuration. + (Ted Yu via todd) + OPTIMIZATIONS HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..). diff --git a/src/java/org/apache/hadoop/security/UserGroupInformation.java b/src/java/org/apache/hadoop/security/UserGroupInformation.java index fc1c87ded9..0b00af7ce4 100644 --- a/src/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/src/java/org/apache/hadoop/security/UserGroupInformation.java @@ -340,15 +340,24 @@ private static class HadoopConfiguration "hadoop-user-kerberos"; private static final String KEYTAB_KERBEROS_CONFIG_NAME = "hadoop-keytab-kerberos"; + + private static final Map BASIC_JAAS_OPTIONS = + new HashMap(); + static { + String jaasEnvVar = System.getenv("HADOOP_JAAS_DEBUG"); + if (jaasEnvVar != null && "true".equalsIgnoreCase(jaasEnvVar)) { + BASIC_JAAS_OPTIONS.put("debug", "true"); + } + } private static final AppConfigurationEntry OS_SPECIFIC_LOGIN = new AppConfigurationEntry(OS_LOGIN_MODULE_NAME, LoginModuleControlFlag.REQUIRED, - new HashMap()); + BASIC_JAAS_OPTIONS); private static final AppConfigurationEntry HADOOP_LOGIN = new AppConfigurationEntry(HadoopLoginModule.class.getName(), LoginModuleControlFlag.REQUIRED, - new HashMap()); + BASIC_JAAS_OPTIONS); private static final Map USER_KERBEROS_OPTIONS = new HashMap(); static { @@ -359,6 +368,7 @@ private static class HadoopConfiguration if (ticketCache != null) { USER_KERBEROS_OPTIONS.put("ticketCache", ticketCache); } + USER_KERBEROS_OPTIONS.putAll(BASIC_JAAS_OPTIONS); } private static final AppConfigurationEntry USER_KERBEROS_LOGIN = new AppConfigurationEntry(Krb5LoginModule.class.getName(), @@ -371,6 +381,7 @@ private static class HadoopConfiguration KEYTAB_KERBEROS_OPTIONS.put("useKeyTab", "true"); KEYTAB_KERBEROS_OPTIONS.put("storeKey", "true"); KEYTAB_KERBEROS_OPTIONS.put("refreshKrb5Config", "true"); + KEYTAB_KERBEROS_OPTIONS.putAll(BASIC_JAAS_OPTIONS); } private static final AppConfigurationEntry KEYTAB_KERBEROS_LOGIN = new AppConfigurationEntry(Krb5LoginModule.class.getName(),