security - 禁用某些 Docker 运行选项

标签 security docker command-line-interface

我目前正在着手进行一项设置,以使 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,

(这不是你想要的)

即:

dockerd --authorization-plugin=plugin1

这会导致:

https://docs.docker.com/engine/extend/images/authz_deny.png

关于security - 禁用某些 Docker 运行选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40468739/

相关文章:

json - 这是一个有效的 JSON 响应吗?

PHP 文件通过 CLI 执行时返回空白

git - 'git add .' ('git add' 单点) 命令有什么作用?

php - 转义变量

php - 如何在使用 php 的登录系统中使用 nonce 来避免重放攻击?

GSSAPI 中的 javax.naming.AuthenticationException

perl - 构建时如何查看容器中的文件?

ruby-on-rails - 使用 webpacker (webpack-dev-server) 在 docker 容器内编译而不重建

django - Nginx、Gunicorn、Django、Celery(Redis) : upstream prematurely closed connection 502 gateway

javascript - 如果使用 Cypress 的 CLI 命令中未声明参数之一,会引发异常吗?