Package org.apache.hadoop.security
Class KDiag
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.security.KDiag
- All Implemented Interfaces:
Closeable,AutoCloseable,Configurable,Tool
Kerberos diagnostics
This operation expands some of the diagnostic output of the security code,
but not all. For completeness
Set the environment variable
HADOOP_JAAS_DEBUG=true
Set the log level for org.apache.hadoop.security=DEBUG-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDiagnostics failures return the exit code 41, "unauthorized". -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intThe exit code for a failure of the diagnostics: 41 == HTTP 401 == unauth.static final Stringstatic final StringLocation of the kerberos ticket cache as passed down via an environment variable.static final StringLocation of main kerberos configuration file as passed down via an environment variable.static final StringString seen ingetDefaultRealm()exceptions if the user has no realm: "Cannot locate default realm".static final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionKDiag()KDiag(Configuration conf, PrintWriter out, File keytab, String principal, long minKeyLength, boolean securityRequired) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidDump all tokens of a UGI.static intexec(Configuration conf, String... argv) Inner entry point, with no logging or system exits.booleanexecute()Execute diagnostics.protected booleanIs the authentication method of this configuration "simple"?static voidMain entry point.protected voidGet the default realm.intExecute the command with the given arguments.protected voidFail fast on a JVM without JCE installed.protected voidVerify whether auth_to_local rules transform a principal nameMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Field Details
-
KRB5_CCNAME
Location of the kerberos ticket cache as passed down via an environment variable. This is what kinit will use by default: "KRB5CCNAME"- See Also:
-
KRB5_CONFIG
Location of main kerberos configuration file as passed down via an environment variable.- See Also:
-
JAVA_SECURITY_KRB5_CONF
- See Also:
-
JAVA_SECURITY_KRB5_REALM
- See Also:
-
JAVA_SECURITY_KRB5_KDC_ADDRESS
- See Also:
-
SUN_SECURITY_KRB5_DEBUG
- See Also:
-
SUN_SECURITY_SPNEGO_DEBUG
- See Also:
-
SUN_SECURITY_JAAS_FILE
- See Also:
-
KERBEROS_KINIT_COMMAND
- See Also:
-
HADOOP_AUTHENTICATION_IS_DISABLED
- See Also:
-
UNSET
- See Also:
-
NO_DEFAULT_REALM
String seen ingetDefaultRealm()exceptions if the user has no realm: "Cannot locate default realm".- See Also:
-
KDIAG_FAILURE
public static final int KDIAG_FAILUREThe exit code for a failure of the diagnostics: 41 == HTTP 401 == unauth.- See Also:
-
DFS_DATA_TRANSFER_SASLPROPERTIES_RESOLVER_CLASS
- See Also:
-
DFS_DATA_TRANSFER_PROTECTION
- See Also:
-
ETC_KRB5_CONF
- See Also:
-
ETC_NTP
- See Also:
-
HADOOP_JAAS_DEBUG
- See Also:
-
CAT_CONFIG
- See Also:
-
CAT_JAAS
- See Also:
-
CAT_JVM
- See Also:
-
CAT_KERBEROS
- See Also:
-
CAT_LOGIN
- See Also:
-
CAT_OS
- See Also:
-
CAT_SASL
- See Also:
-
CAT_UGI
- See Also:
-
CAT_TOKEN
- See Also:
-
ARG_KEYLEN
- See Also:
-
ARG_KEYTAB
- See Also:
-
ARG_JAAS
- See Also:
-
ARG_NOFAIL
- See Also:
-
ARG_NOLOGIN
- See Also:
-
ARG_OUTPUT
- See Also:
-
ARG_PRINCIPAL
- See Also:
-
ARG_RESOURCE
- See Also:
-
ARG_SECURE
- See Also:
-
ARG_VERIFYSHORTNAME
- See Also:
-
-
Constructor Details
-
KDiag
public KDiag(Configuration conf, PrintWriter out, File keytab, String principal, long minKeyLength, boolean securityRequired) -
KDiag
public KDiag()
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
run
Description copied from interface:ToolExecute the command with the given arguments. -
execute
Execute diagnostics.Things it would be nice if UGI made accessible
- A way to enable JAAS debug programatically
- Access to the TGT
- Returns:
- true if security was enabled and all probes were successful
- Throws:
KDiag.KerberosDiagsFailure- explicitly raised failureException- other security problems
-
isSimpleAuthentication
Is the authentication method of this configuration "simple"?- Parameters:
conf- configuration to check- Returns:
- true if auth is simple (i.e. not kerberos)
-
validateKeyLength
Fail fast on a JVM without JCE installed. This is a recurrent problem (that is: it keeps creeping back with JVM updates); a fast failure is the best tactic.- Throws:
NoSuchAlgorithmException- when a particular cryptographic algorithm is requested but is not available in the environment.
-
validateShortName
protected void validateShortName()Verify whether auth_to_local rules transform a principal nameHaving a local user name "bar@foo.com" may be harmless, so it is noted at info. However if what was intended is a transformation to "bar" it can be difficult to debug, hence this check.
-
printDefaultRealm
protected void printDefaultRealm()Get the default realm.Not having a default realm may be harmless, so is noted at info. All other invocation failures are downgraded to warn, as follow-on actions may still work. Failure to invoke the method via introspection is considered a failure, as it's a sign of JVM compatibility issues that may have other consequences
-
dumpTokens
Dump all tokens of a UGI.- Parameters:
ugi- UGI to examine
-
exec
Inner entry point, with no logging or system exits.- Parameters:
conf- configurationargv- argument list- Returns:
- an exception
- Throws:
Exception- Exception.
-
main
Main entry point.- Parameters:
argv- args list
-