gpt4 book ai didi

Docker seccomp 适用于 alpine/busybox 但不适用于 ubuntu

转载 作者:行者123 更新时间:2023-12-02 18:17:52 26 4
gpt4 key购买 nike

我有这个 seccomp 个人资料:

{
"defaultAction": "SCMP_ACT_ALLOW",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
"syscalls": [
{
"name": "chmod",
"action": "SCMP_ACT_ERRNO",
"args": []
},
{
"name": "chown",
"action": "SCMP_ACT_ERRNO",
"args": []
},
{
"name": "chown32",
"action": "SCMP_ACT_ERRNO",
"args": []
} }

当使用它来过滤 alpine 或 busybox 容器上的系统调用时,它可以工作
docker run -it --security-opt seccomp=profile.json busybox /bin/sh
// chmod 777 /etc/hosts
// Error: operation not permitted

但是对 ubuntu:18.04 没有影响
docker run -it --security-opt seccomp=profile.json ubuntu:18.04 /bin/sh
// chmod 777 /etc/hosts
// Success

Docker 版本是 19.03.8

有没有人遇到过这个问题?

最佳答案

来自 docker-lab ,看来您还缺少两个属性以使其正常与 Linux 一起工作

The default-no-chmod.json profile is a modification of the default.json profile> with the chmod(), fchmod(), and chmodat() syscalls removed from its whitelist.



enter image description here
security-seccomp
{
"defaultAction": "SCMP_ACT_ALLOW",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
"syscalls": [
{
"name": "chmod",
"action": "SCMP_ACT_ERRNO",
"args": []
},
{
"name": "fchmod",
"action": "SCMP_ACT_ERRNO",
"args": [

]
},
{
"name": "fchmodat",
"action": "SCMP_ACT_ERRNO",
"args": [

]
},
{
"name": "chown",
"action": "SCMP_ACT_ERRNO",
"args": []
},
{
"name": "chown32",
"action": "SCMP_ACT_ERRNO",
"args": []
}]
}



现在,如果您从 ubuntu 尝试过,您将得到预期的结果
docker run -it --security-opt seccomp=profile.json ubuntu:18.04 /bin/sh -c " chmod +x /etc/hosts"

chmod: changing permissions of '/etc/hosts': Operation not permitted

此外,busybox 的结果相同
docker run -it --security-opt seccomp=profile.json busybox /bin/sh -c " chmod +x /etc/host"
chmod: /etc/host: No such file or directory

关于Docker seccomp 适用于 alpine/busybox 但不适用于 ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62316720/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com