HADOOP-15123. KDiag tries to load krb5.conf from KRB5CCNAME instead of KRB5_CONFIG.
Contributed by Vipin Rathor.
This commit is contained in:
parent
93fdc3d935
commit
1ef906e29e
|
@ -80,6 +80,11 @@ public class KDiag extends Configured implements Tool, Closeable {
|
||||||
* variable. This is what kinit will use by default: {@value}
|
* variable. This is what kinit will use by default: {@value}
|
||||||
*/
|
*/
|
||||||
public static final String KRB5_CCNAME = "KRB5CCNAME";
|
public static final String KRB5_CCNAME = "KRB5CCNAME";
|
||||||
|
/**
|
||||||
|
* Location of main kerberos configuration file as passed down via an
|
||||||
|
* environment variable.
|
||||||
|
*/
|
||||||
|
public static final String KRB5_CONFIG = "KRB5_CONFIG";
|
||||||
public static final String JAVA_SECURITY_KRB5_CONF
|
public static final String JAVA_SECURITY_KRB5_CONF
|
||||||
= "java.security.krb5.conf";
|
= "java.security.krb5.conf";
|
||||||
public static final String JAVA_SECURITY_KRB5_REALM
|
public static final String JAVA_SECURITY_KRB5_REALM
|
||||||
|
@ -320,14 +325,15 @@ public class KDiag extends Configured implements Tool, Closeable {
|
||||||
|
|
||||||
title("Environment Variables");
|
title("Environment Variables");
|
||||||
for (String env : new String[]{
|
for (String env : new String[]{
|
||||||
HADOOP_JAAS_DEBUG,
|
HADOOP_JAAS_DEBUG,
|
||||||
KRB5_CCNAME,
|
KRB5_CCNAME,
|
||||||
HADOOP_USER_NAME,
|
KRB5_CONFIG,
|
||||||
HADOOP_PROXY_USER,
|
HADOOP_USER_NAME,
|
||||||
HADOOP_TOKEN_FILE_LOCATION,
|
HADOOP_PROXY_USER,
|
||||||
"HADOOP_SECURE_LOG",
|
HADOOP_TOKEN_FILE_LOCATION,
|
||||||
"HADOOP_OPTS",
|
"HADOOP_SECURE_LOG",
|
||||||
"HADOOP_CLIENT_OPTS",
|
"HADOOP_OPTS",
|
||||||
|
"HADOOP_CLIENT_OPTS",
|
||||||
}) {
|
}) {
|
||||||
printEnv(env);
|
printEnv(env);
|
||||||
}
|
}
|
||||||
|
@ -561,14 +567,14 @@ public class KDiag extends Configured implements Tool, Closeable {
|
||||||
krbPath = jvmKrbPath;
|
krbPath = jvmKrbPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
String krb5name = System.getenv(KRB5_CCNAME);
|
String krb5name = System.getenv(KRB5_CONFIG);
|
||||||
if (krb5name != null) {
|
if (krb5name != null) {
|
||||||
println("Setting kerberos path from environment variable %s: \"%s\"",
|
println("Setting kerberos path from environment variable %s: \"%s\"",
|
||||||
KRB5_CCNAME, krb5name);
|
KRB5_CONFIG, krb5name);
|
||||||
krbPath = krb5name;
|
krbPath = krb5name;
|
||||||
if (jvmKrbPath != null) {
|
if (jvmKrbPath != null) {
|
||||||
println("Warning - both %s and %s were set - %s takes priority",
|
println("Warning - both %s and %s were set - %s takes priority",
|
||||||
JAVA_SECURITY_KRB5_CONF, KRB5_CCNAME, KRB5_CCNAME);
|
JAVA_SECURITY_KRB5_CONF, KRB5_CONFIG, KRB5_CONFIG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,7 +915,7 @@ public class KDiag extends Configured implements Tool, Closeable {
|
||||||
private void dump(File file) throws IOException {
|
private void dump(File file) throws IOException {
|
||||||
try (FileInputStream in = new FileInputStream(file)) {
|
try (FileInputStream in = new FileInputStream(file)) {
|
||||||
for (String line : IOUtils.readLines(in)) {
|
for (String line : IOUtils.readLines(in)) {
|
||||||
println(line);
|
println("%s", line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue