Member since
11-05-2015
3
Posts
0
Kudos Received
0
Solutions
11-09-2015
05:51 AM
Yes i would like to run an AM under user that could impersonate other users. When on AM i got a request i want to run a command on a container as a user that sent a request (assuming it could be impersonated). E.g. AM is running as a user1 user. He could impersonate user2. AM got a request: {"user": "user2",
"command" : "whoami"} And it should be run as user2.
... View more
11-05-2015
07:38 AM
I have a long running application master that accepts requests (monitors queue). In request i have a field "username" - the user, i want to launch a job on a container from. As from yarn documentation: The default value set for Apache Hadoop in non-secure clusters is org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor. This class runs all containers as the Yarn user to avoid accidental operations being executed in the NodeManagers by arbitrary users. The alternative value for this property is org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor. This class executes containers with the container-executor binary, which performs a privilege escalation to run containers as the users that submitted the application request. I've changed yarn.nodemanager.container-executor.class to LinuxContainerExecutor. How can i set a user which will be run command on a container? The only method that seems like does authentification is ContainerLaunchContext.setTokens. I have a next code: private def setupTokens(user: String): ByteBuffer = {
val ugi = UserGroupInformation.createProxyUser(user, UserGroupInformation.getCurrentUser)
LOG.info(s"Creating proxyuser ${ugi.getUserName} impersonated by ${UserGroupInformation.getCurrentUser}")
val credentials = ugi.getCredentials
val dob = new DataOutputBuffer();
credentials.writeTokenStorageToStream(dob);
ByteBuffer.wrap(dob.getData(), 0, dob.getLength()).duplicate();
}
val cCLC = Records.newRecord(classOf[ContainerLaunchContext])
cCLC.setCommands(List("whoami"))
cCLC.setTokens(setupTokens(user)) But it doesn't work.
... View more
Labels:
- Labels:
-
Apache Hadoop
-
Apache YARN