我目前正在着手进行一项设置,以使 Docker 在高性能集群 (HPC) 上可用。这个想法是我们组中的每个用户都应该能够保留一台机器一段时间,并且能够以“正常方式”使用 Docker。意思是通过 Docker CLI 访问 Docker Daemon。
为此,用户将被添加到 Docker 组。但这给我们带来了很大的安全问题,因为这基本上意味着用户在该机器上拥有 root 权限。
新想法是利用用户命名空间映射选项(如 https://docs.docker.com/engine/reference/commandline/dockerd/#/daemon-user-namespace-options 中所述)。在我看来,这将解决我们最大的安全问题,即容器中的根与主机上的根相同。
但只要用户能够通过 --userns=host 绕过这个,这不会以任何方式提高安全性。
有没有办法禁用此选项和其他 Docker 运行选项?
最佳答案
如 issue 22223 中所述
There are a whole lot of ways in which users can elevate privileges through docker run, eg by using
--privileged
.
You can stop this by:
- either not directly providing access to the daemon in production, and using scripts,
(这不是你想要的)
- or by using an auth plugin to disallow some options.
即:
dockerd --authorization-plugin=plugin1
这会导致:
关于security - 禁用某些 Docker 运行选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40468739/