YARN-6890. Not display killApp button on UI if UI is unsecured but cluster is secured. Contributed by Junping Du
This commit is contained in:
parent
22ef7c6bf2
commit
bc87a293d9
|
@ -565,6 +565,9 @@ public class CommonConfigurationKeysPublic {
|
|||
public static final String HADOOP_SECURITY_DNS_NAMESERVER_KEY =
|
||||
"hadoop.security.dns.nameserver";
|
||||
|
||||
public static final String HADOOP_HTTP_AUTHENTICATION_TYPE =
|
||||
"hadoop.http.authentication.type";
|
||||
|
||||
@Deprecated
|
||||
/** Only used by HttpServer. */
|
||||
public static final String HADOOP_SSL_ENABLED_KEY = "hadoop.ssl.enabled";
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.commons.lang.StringEscapeUtils;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.yarn.api.ApplicationBaseProtocol;
|
||||
|
@ -66,6 +67,8 @@ public class AppBlock extends HtmlBlock {
|
|||
protected ApplicationBaseProtocol appBaseProt;
|
||||
protected Configuration conf;
|
||||
protected ApplicationId appID = null;
|
||||
private boolean unsecuredUI = true;
|
||||
|
||||
|
||||
@Inject
|
||||
protected AppBlock(ApplicationBaseProtocol appBaseProt, ViewContext ctx,
|
||||
|
@ -73,6 +76,9 @@ public class AppBlock extends HtmlBlock {
|
|||
super(ctx);
|
||||
this.appBaseProt = appBaseProt;
|
||||
this.conf = conf;
|
||||
// check if UI is unsecured.
|
||||
String httpAuth = conf.get(CommonConfigurationKeys.HADOOP_HTTP_AUTHENTICATION_TYPE);
|
||||
this.unsecuredUI = (httpAuth != null) && httpAuth.equals("simple");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,10 +131,16 @@ public class AppBlock extends HtmlBlock {
|
|||
|
||||
setTitle(join("Application ", aid));
|
||||
|
||||
// YARN-6890. for secured cluster allow anonymous UI access, application kill
|
||||
// shouldn't be there.
|
||||
boolean unsecuredUIForSecuredCluster = UserGroupInformation.isSecurityEnabled()
|
||||
&& this.unsecuredUI;
|
||||
|
||||
if (webUiType != null
|
||||
&& webUiType.equals(YarnWebParams.RM_WEB_UI)
|
||||
&& conf.getBoolean(YarnConfiguration.RM_WEBAPP_UI_ACTIONS_ENABLED,
|
||||
YarnConfiguration.DEFAULT_RM_WEBAPP_UI_ACTIONS_ENABLED)) {
|
||||
YarnConfiguration.DEFAULT_RM_WEBAPP_UI_ACTIONS_ENABLED)
|
||||
&& !unsecuredUIForSecuredCluster) {
|
||||
// Application Kill
|
||||
html.div()
|
||||
.button()
|
||||
|
|
Loading…
Reference in New Issue