Allow actors to opt in/out of Linux capabilities - #795
Conversation
Benjamin Elder (BenTheElder)
left a comment
There was a problem hiding this comment.
can we add an e2e test for this, for both uVM and gvisor? plumbing it is one thing, making sure it is effective is another, atelet doesn't actually spawn the containers
29e32cc to
16c7049
Compare
| @@ -110,6 +110,14 @@ jobs: | |||
| E2E_TEMPLATE_NAME: counter-microvm | |||
| E2E_TEMPLATE_READY_TIMEOUT: 600s | |||
| run: hack/run-e2e-kind.sh ./internal/e2e/suites/demo -v -args --no-color | |||
There was a problem hiding this comment.
maybe we should expand this to run the whole default suite instead?
16c7049 to
87dc8d3
Compare
Benjamin Elder (BenTheElder)
left a comment
There was a problem hiding this comment.
Feel free to drop me a ping in the slack for follow-up when these are fixed / PR is rebased and I'll try to come back to this faster, thanks!
| }, | ||
| Bounding: capabilities, | ||
| Effective: capabilities, | ||
| Inheritable: capabilities, |
There was a problem hiding this comment.
🤖 should-fix 🟡 – Leave Inheritable empty. It was harmless when this was three fixed, innocuous capabilities; now a template can put SYS_ADMIN, DAC_OVERRIDE, or SETUID there.
Inheritable grants the process itself nothing. It only takes effect on execve, ANDed with the file's own inheritable set — which is why containerd dropped it in the fix for CVE-2022-24769, and why CRI-O and Docker set it empty too. The exposure is a container that starts as root and then drops to an unprivileged uid (su, gosu, a setuid binary) before exec'ing something with file capabilities.
Removing it costs nothing here. The spec pins User{UID: 0, GID: 0}, and for a real-uid-0 process exec'ing a file with no file capabilities the kernel treats F(permitted) and F(inheritable) as all-ones, so P'(permitted) = P(bounding). Propagation to children rides on Bounding, not Inheritable.
The capabilities e2e already asserts only bounding, effective, permitted and an empty ambient, so it would not need to change — TestBuildActorOCISpecCapabilities in oci_test.go would.
|
|
||
| ### Container Capabilities (`securityContext.capabilities`) | ||
|
|
||
| Each container runs with a default set of Linux capabilities. `securityContext.capabilities` adjusts that set, mirroring `securityContext.capabilities` on a Kubernetes Pod container. |
There was a problem hiding this comment.
🤖 nit 🟢 – Worth naming the default set here. A reader writing add needs to know what they already have, and one writing drop needs it even more — right now the only way to find out is to read defaultCapabilities in cmd/atelet/oci.go. It is three entries: AUDIT_WRITE, KILL, NET_BIND_SERVICE.
|
And sorry for the delay, the incoming PR volume is high 😅 |
87dc8d3 to
4de34ee
Compare
|
Benjamin Elder (@BenTheElder) TestActorCapabilities passed on gVisor (24.75s, both subtests), but the overall run failed on two tests. I’m not sure how to interpret the failures. Could you take a look and share your feedback? I also ran |
|
You can search the logs for
|
Fixes #744