Conversation
apparmor/template.go
Outdated
|
|
||
| // baseTemplate defines the default apparmor profile for containers. | ||
| // | ||
| // It explicitly sets the AppArmor ABI to 3.0. In AppArmor 4.0 ABI, "network" |
There was a problem hiding this comment.
nit: ABI 4.0 is actually fine. It's anything newer than 4.0 (which is a function of apparmor+kernel) which is the problem.
There was a problem hiding this comment.
Ah, thanks! Let me try rephrasing 🤗
There was a problem hiding this comment.
Slightly updated to outline that it's "higher than", but that we picked 3.0 to account for some LTS distros not yet supporting 4.0; thanks!
2d74668 to
6e97fb8
Compare
This explicitly sets the AppArmor ABI to 3.0. In AppArmor ABI higher than 4.0, `network` no longer includes `network unix`, resulting in access to unix sockets being denied (also see https://gitlab.com/apparmor/apparmor/-/issues/561): apparmor="DENIED" operation="create" class="net" info="failed protocol match" error=-13 profile="cri-containerd.apparmor.d" pid=138752 comm=2E4E455420545020576F726B6572 family="unix" sock_type="dgram" protocol=0 requested="create" denied="create" addr=none The recommendation is to either pin to abi `<abi/4.0>`, in the policy or to update it to use the newer syntax. Given that we need to account for some LTS distros that do not yet support ABI 4.0, we pin to ABI 3.0. This is a similar patch as was included in containerd ([containerd@a6f03a7]). From that patch: > This change sets the AppArmor policy used by containerd to indicate it > is `abi/3.0`. This was chosen based on some code archeology which > indicated that containerd 1.7 came out in March 2023, before the > AppArmor 4.0 ABI. The AppArmor policies themselves date to much older; > the last apparmor version-checks were removed in [containerd@4baa187] > and [containerd@c990e3f], and both were looking for AppArmor 2.8.96 or > older, pointing to abi/3.0 being the "correct" one to pick. > > Nothing is preventing containerd from migrating to a newer AppArmor > ABI; note, however, that anything newer than `abi/4.0` will need > modifications to preserve UNIX domain sockets. [containerd@4baa187]: containerd/containerd@4baa187 [containerd@c990e3f]: containerd/containerd@c990e3f [containerd@a6f03a7]: containerd/containerd@a6f03a7 Co-authored-by: Alex Chernyakhovsky <alex@achernya.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
6e97fb8 to
0447c3e
Compare
|
Looks like this causes some issues on some distros due to abi/3.0 not shipping by default; |
|
Apologies, I wasn't tagged on that backport. I left a comment there with my thoughts on the approach and alternatives. Let me know if you'd like my input anywhere. |
|
Ah, thx! Yeah, I mostly left the comment as a "note to self"; we didn't tag a new version yet of this module, but always good to link things together and leave some breadcrumbs. 😅 |
relates to:
apparmor: explicitly set abi/3.0
This explicitly sets the AppArmor ABI to 3.0. In AppArmor ABI higher than 4.0,
networkno longer includesnetwork unix, resulting in access to unix sockets being denied (also see https://gitlab.com/apparmor/apparmor/-/issues/561):The recommendation is to either pin to abi
<abi/4.0>, in the policy or to update it to use the newer syntax. Given that we need to account for some LTS distros that do not yet support ABI 4.0, we pin to ABI 3.0.This is a similar patch as was included in containerd (containerd@a6f03a7). From that patch: