未加星标

YARN Secure Container

字体大小 | |
[数据库(综合) 所属分类 数据库(综合) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

In a restricted setup YARN executes task of computation frameworks like Spark in a secured linux or Window Container. The task are being executed in the local user context of the user submitting the application YARN. They are not being executed as the YARN or some other system user, which brings certain constraints for the system setup. But how is YARN actually able to impersonate the calling user on the local OS level? This posts aims to give some explanations to help answer such questions about YARN secure containers. Only Linux systems are considered here, no windows.

Container Executor

YARN uses the LinuxContainerExecutor.java class for secure container execution on Linux systems. The class uses a native executable, container-executor.sh to launch a container as the submitting user of the program.

During container launch the executor broadly does the following:

Create the container work dir ( yarn . nodemanager . local - dirs ) and log dir ( yarn . nodemanager . log - dirs ) accessible by the child process (calling user) Copy the script files from the NM to the work directory Setup the environment Executes with execlp to switch from the current image of the NM election to the image of the environment

The execlp () function replaces the current process image with a new process image specified by file. The new image is constructed from a regular, executable file called the new process image file. No return is made because the calling process image is replaced by the new process image.

http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/e/execlp.html

For the user container-execute.sh ensures that:

It is NOT a root user The UID is above the minimum (typically above 1000) Not a user on the banned user list

So root and other “privileged” users are not able to create container resources through YARN. Privileged users in this context means users with an UID above 1000, which excludes users like http and the like. Further banned users are also not allowed to execute containers. Typical default banned users are hdfs,yarn,mapped,bin

Setuid

For YARN to be able to create and execute the image context with privileges of the submitting user, it leverages the SETUID capabilities of Linux. In order to work the executable container-executor needs to be owned by root and the group Hadoop. The permissions of the file need to be set to -- - Sr - s ― , which is the numerical value of 6050 .

Through the setuid the unprivileged yarn user is able to run the executable with root privileges.

Important to note is, that if the file is stored on a mount point that has setuid disabled, the NM will not be able to obtain root privileges with that script. A typical error you would obtain is:

Error setting supplementary groups for user ambari-qa: Operation not permitted

If the filesystem is mounted or set in / etc / fstab to nosuid the operation suid is being blocked.

Local Users

Another constraint for secure YARN containers that comes from this behavior is that the submitting user needs to be local to the machine running the NodeManager. There is no need for local home directories for this users, they just simply need a uid . Executable and logs of the container are stored in yarn . nodemanager . local - dirs and yarn . nodemanager . log - dirs directories.

Further Reading YARN Secure Container What is a Container in YARN? Setuid Explanation of nodev and nosuid in fstab YARN ONLY: Container-executor Error Codes Directories and the Set-User-ID and Set-Group-ID Bits initgroups(3) Linux man page

本文数据库(综合)相关术语:系统安全软件

主题: LinuxHadoopWindowsSparkTUI
分页:12
转载请注明
本文标题:YARN Secure Container
本站链接:http://www.codesec.net/view/531893.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(综合) | 评论(0) | 阅读(36)