|
@@ -28,6 +28,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
|
|
import org.apache.hadoop.yarn.api.records.ShellContainerCommand;
|
|
|
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.Context;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
|
|
|
import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
|
|
@@ -115,6 +116,10 @@ public class ContainerShellWebSocket {
|
|
|
session.close(1008, "Forbidden");
|
|
|
return;
|
|
|
}
|
|
|
+ if (checkInsecureSetup()) {
|
|
|
+ session.close(1003, "Nonsecure mode is unsupported.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
LOG.info(session.getRemoteAddress().getHostString() + " connected!");
|
|
|
LOG.info(
|
|
|
"Making interactive connection to running docker container with ID: "
|
|
@@ -180,4 +185,14 @@ public class ContainerShellWebSocket {
|
|
|
}
|
|
|
return authorized;
|
|
|
}
|
|
|
+
|
|
|
+ private boolean checkInsecureSetup() {
|
|
|
+ boolean kerberos = UserGroupInformation.isSecurityEnabled();
|
|
|
+ boolean limitUsers = nmContext.getConf()
|
|
|
+ .getBoolean(YarnConfiguration.NM_NONSECURE_MODE_LIMIT_USERS, true);
|
|
|
+ if (kerberos) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return limitUsers;
|
|
|
+ }
|
|
|
}
|