Docker seccomp 无法在 Kali 上运行

Docker seccomp not working on Kali

我正在使用 Docker 调查内核安全性。我正在测试 seccomp,它在 Debian 和 Ubuntu 上运行良好,但在 Kali Linux.

上运行不佳

示例:

我创建了一个名为 sec.json 的简单 json 文件,内容如下:

{
    "defaultAction": "SCMP_ACT_ALLOW",
        "syscalls": [
                {
                    "name": "mkdir",
                    "action": "SCMP_ACT_ERRNO"
                }
            ]
}

假定 运行 使用 seccomp 和此文件连接容器将导致您无法在容器内使用 mkdir 命令。这是 docker 运行 命令:

docker run --rm -ti --security-opt seccomp=/path/to/sec.json ubuntu:xenial sh

正如我所说,它在 Debian 和 Ubuntu 上运行良好,但在 Kali Linux 上我遇到了这个错误:

docker: Error response from daemon: linux seccomp: seccomp profiles are not supported on this daemon, you cannot specify a custom seccomp profile.

我的 docker 引擎版本是 17.05.0-ce,我的内核是 4.9.0-kali3-amd64 #1 SMP Debian 4.9.18-1kali1 (2017-04-04) x86_64 GNU/Linux。我用谷歌搜索了这个并且很奇怪。可以看到这个应该是支持seccomp的:

cat /boot/config-`uname -r` | grep CONFIG_SECCOMP=

我得到的结果是:

CONFIG_SECCOMP=y

所以应该是支持的。我错过了什么或者关于这对 Kali 不起作用的解释是什么?谢谢。

好的,我找到了这个 post。我会尝试自己回答:

https://github.com/moby/moby/issues/26497

很像。我检查了我的 docker info 输出和 Ubuntu 和 Debian 我有 Security Options: seccomp 而我在 Kali 上什么都没有。

可能的解释是 libseccomp2 包含所需库的包太旧了。也许如果 Kali 工作人员更新库,它可能会得到支持。

使用

echo 'apt::sandbox::seccomp "false";' > /etc/apt/apt.conf.d/999seccomp

应该可以。