Class JavaSandboxLinuxContainerRuntime

java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.runtime.DefaultLinuxContainerRuntime
org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.runtime.JavaSandboxLinuxContainerRuntime
All Implemented Interfaces:
LinuxContainerRuntime, ContainerRuntime

@Private @Unstable public class JavaSandboxLinuxContainerRuntime extends DefaultLinuxContainerRuntime

This class extends the DefaultLinuxContainerRuntime specifically for containers which run Java commands. It generates a new java security policy file per container and modifies the java command to enable the Java Security Manager with the generated policy.

The behavior of the JavaSandboxLinuxContainerRuntime can be modified using the following settings:
  • "yarn.nodemanager.runtime.linux.sandbox-mode" : This yarn-site.xml setting has three options:
    • disabled - Default behavior. LinuxContainerRuntime is disabled
    • permissive - JVM containers will run with Java Security Manager enabled. Non-JVM containers will run normally
    • enforcing - JVM containers will run with Java Security Manager enabled. Non-JVM containers will be prevented from executing and an ContainerExecutionException will be thrown.
  • "yarn.nodemanager.runtime.linux.sandbox-mode.local-dirs.permissions" : Determines the file permissions for the application directories. The permissions come in the form of comma separated values (e.g. read,write,execute,delete). Defaults to read for read-only.
  • "yarn.nodemanager.runtime.linux.sandbox-mode.policy" : Accepts canonical path to a java policy file on the local filesystem. This file will be loaded as the base policy, any additional container grants will be appended to this base file. If not specified, the default java.policy file provided with hadoop resources will be used.
  • "yarn.nodemanager.runtime.linux.sandbox-mode.whitelist-group" : Optional setting to specify a YARN queue which will be exempt from the sand-boxing process.
  • "yarn.nodemanager.runtime.linux.sandbox-mode.policy.group."$groupName : Optional setting to map groups to java policy files. The value is a path to the java policy file for $groupName. A user which is a member of multiple groups with different policies will receive the superset of all the permissions across their groups.