-
Notifications
You must be signed in to change notification settings - Fork 387
fix: capet Ambient log level #3150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: capet Ambient log level #3150
Conversation
Signed-off-by: Kaita Nakamura <[email protected]>
|
Hey @z63d , thanks for the PR. So two things -
Also, I think we need to check this error in a bit more detail. The comment in runc mentions they are not erroring because backward compatibility, and ignoring einval for older kernels, but here we are getting Basically my intention behind fixing the issue was to check why we are getting the error in first place (is user's caps incorrect, is the config itself is incorrect and so on) and then depending on that change the log level. It is possible that config itself might be incorrect (and runc is ignoring it because of the comment you mentioned) in which case we should keep the level as error, but change the message to mention we are ignoring the error etc. |
|
The reason runc is youki supports linux kernel ≥ 5.3, so error is appropriate instead of warn for this. config.json{
"ociVersion": "1.0.2-dev",
"root": {
"path": "rootfs",
"readonly": true
},
"mounts": [
{
"destination": "/proc",
"type": "proc",
"source": "proc"
},
{
"destination": "/dev",
"type": "tmpfs",
"source": "tmpfs",
"options": ["nosuid", "strictatime", "mode=755", "size=65536k"]
},
{
"destination": "/dev/pts",
"type": "devpts",
"source": "devpts",
"options": [
"nosuid",
"noexec",
"newinstance",
"ptmxmode=0666",
"mode=0620",
"gid=5"
]
},
{
"destination": "/dev/shm",
"type": "tmpfs",
"source": "shm",
"options": ["nosuid", "noexec", "nodev", "mode=1777", "size=65536k"]
},
{
"destination": "/dev/mqueue",
"type": "mqueue",
"source": "mqueue",
"options": ["nosuid", "noexec", "nodev"]
},
{
"destination": "/sys",
"type": "sysfs",
"source": "sysfs",
"options": ["nosuid", "noexec", "nodev", "ro"]
},
{
"destination": "/sys/fs/cgroup",
"type": "cgroup",
"source": "cgroup",
"options": ["nosuid", "noexec", "nodev", "relatime", "ro"]
}
],
"process": {
"terminal": false,
"user": {
"uid": 0,
"gid": 0
},
"args": ["sh"],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"TERM=xterm"
],
"cwd": "/",
"capabilities": {
"bounding": [
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_AUDIT_WRITE",
"CAP_CHOWN"
],
"effective": ["CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE"],
"inheritable": [
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_AUDIT_WRITE",
"CAP_CHOWN"
],
"permitted": [
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_AUDIT_WRITE",
"CAP_CHOWN"
],
"ambient": [
"CAP_KILL",
"CAP_NET_BIND_SERVICE",
"CAP_AUDIT_WRITE",
"CAP_CHOWN"
]
},
"rlimits": [
{
"type": "RLIMIT_NOFILE",
"hard": 1024,
"soft": 1024
}
],
"noNewPrivileges": true
},
"hostname": "youki",
"annotations": {},
"linux": {
"resources": {
"devices": []
},
"namespaces": [
{
"type": "pid"
},
{
"type": "network"
},
{
"type": "ipc"
},
{
"type": "uts"
},
{
"type": "mount"
},
{
"type": "cgroup"
}
],
"maskedPaths": [
"/proc/acpi",
"/proc/asound",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/sys/firmware",
"/proc/scsi"
],
"readonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
}
}If @YJDoc2 |
|
Hey @z63d thanks for the explanation. Let me think a bit on the implications of this. Currently it would be a breaking change for youki because configs which work fine with this error log would start failing, so this will have to be a breaking change. Additionally, if configs generated by docker/buildx automatically set ambient caps, they might all start to fail too. I'll get back on this. |
|
Ideally, it would be better to raise an error, but I think it's okay to temporarily change it to warn to avoid breaking changes and confusing users with logs. |
|
@YJDoc2 |
|
Hey, so we have two options here -
Can you check if option 2 would be possible, otherwise we can go with option 1. |
As mentioned here, the kernels supported by youki support ambient caps. |
|
ok, after thinking a bit, my conclusion is this - we should change the log level to warn and also add something like Ideally checking if kernel support caps and then doing this is preferable, but given that our official support is for newer kernel only, and adding the check might require more work, I feel better option is just to lower log level here. wdyt? If you also agree with my reasoning, I'll approve and merge, as the change is already there. |
|
@YJDoc2
If there is any work required I will contribute again :) |
Description
I think it is warn in runc.
https://github.com/opencontainers/runc/blob/159c67f8e2233b6cb84a203dc47ed182381b666c/libcontainer/capabilities/capabilities.go#L153
config.json
{ "ociVersion": "1.0.2-dev", "root": { "path": "rootfs", "readonly": true }, "mounts": [ { "destination": "/proc", "type": "proc", "source": "proc" }, { "destination": "/dev", "type": "tmpfs", "source": "tmpfs", "options": ["nosuid", "strictatime", "mode=755", "size=65536k"] }, { "destination": "/dev/pts", "type": "devpts", "source": "devpts", "options": [ "nosuid", "noexec", "newinstance", "ptmxmode=0666", "mode=0620", "gid=5" ] }, { "destination": "/dev/shm", "type": "tmpfs", "source": "shm", "options": ["nosuid", "noexec", "nodev", "mode=1777", "size=65536k"] }, { "destination": "/dev/mqueue", "type": "mqueue", "source": "mqueue", "options": ["nosuid", "noexec", "nodev"] }, { "destination": "/sys", "type": "sysfs", "source": "sysfs", "options": ["nosuid", "noexec", "nodev", "ro"] }, { "destination": "/sys/fs/cgroup", "type": "cgroup", "source": "cgroup", "options": ["nosuid", "noexec", "nodev", "relatime", "ro"] } ], "process": { "terminal": false, "user": { "uid": 0, "gid": 0 }, "args": ["sh"], "env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm" ], "cwd": "/", "capabilities": { "bounding": ["CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE"], "effective": ["CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE"], "inheritable": ["CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE"], "permitted": ["CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE"], "ambient": [ "CAP_KILL", "CAP_NET_BIND_SERVICE", "CAP_AUDIT_WRITE", "CAP_CHOWN" ] }, "rlimits": [ { "type": "RLIMIT_NOFILE", "hard": 1024, "soft": 1024 } ], "noNewPrivileges": true }, "hostname": "youki", "annotations": {}, "linux": { "resources": { "devices": [] }, "namespaces": [ { "type": "pid" }, { "type": "network" }, { "type": "ipc" }, { "type": "uts" }, { "type": "mount" }, { "type": "cgroup" } ], "maskedPaths": [ "/proc/acpi", "/proc/asound", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/sys/firmware", "/proc/scsi" ], "readonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] } }Before
After
Type of Change
Testing
Related Issues
#3132
Additional Context