-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Default AppArmor profile never loaded & apparmor.IsEnabled() always returns false when rootless #15874
Comments
I ran into this issue while trying to write a fix for AppArmor confinement without root (containers/common#960 was reverted due to some mistakes on my end, see containers/common#969). It would seem like the easiest way to fix this problem would be to either
(I suppose an option that could be combined with (2) would be to install a systemd service to dynamically generate and load the profile into the kernel after boot.) The more straightforward route (which would also conform to the "normal" method for AppArmor administration) would be to do (1), but I'm unsure of whether or not Podman strictly needs to be a able to dynamically generate and load the AppArmor profile at runtime. I'm happy to work on a fix for this issue but I'm not sure what the preferred way of loading a default profile would be from your perspective. |
I would go with 1, Podman can be told to load a different profile via But having a default one would help out rootless users. @vrothberg @saschagrunert WDYT? |
|
A friendly reminder that this issue had no activity for 30 days. |
I really like how this functionality is delivered with nerdctl, just from a pure user perspective.
Once My use case
|
We are also running Podman on Ubuntu with enabled AppArmor. I would also appreciate if rootless containers would get confined with some AppArmor profile by default or at least one would have the option to. When starting a container with |
Are you using crun or runc? If one fails could you try the other? |
I so far have only been using crun. I will test runc as soon as I find the time. |
When switching to runc, the error stays exactly the same. |
@XSpielinbox I assume that you're running |
I apologize for not revisiting this issue sooner (I'm just working on this when I'm free; it fell off my radar due to time constraints back in September). I should have some spare time starting next week to fix this, and then revisit containers/common#958 when that's done. |
Yes, as stated in my first comment, I am running
Yes, exactly, but as it states there, that the changes were merged quite long ago, I was confused. I only quite a while later noticed, that the changes got reverted, but could not find any exact reasoning or explanation. The only somewhat related issue I could find, was this one, but my errors are the ones specified in containers/common#960, but not like the ones in this issue here. It would be awesome to get some progress on this! Unfortunately, I have no experience at all in Go programming. |
Yeah; the reversion was done in containers/common#969 because it caused a CI job to fail, but there wasn't much discussion at the time into what actually caused the failure. The fundamental problem (which is what this issue is about, and is roughly what caused the CI issue) is that Podman is currently designed such that the default AppArmor profile only gets loaded at runtime. Once that problem is solved, I believe the original issue (containers/common#958), which is the problem you're encountering, can be revisited. |
- Set the default AppArmor profile to unconfined; see issue containers/podman#15874. Based on the discussion there, distros that use AppArmor should supply their own AppArmor profile and set it in a default containers.conf, since there is no way to load AppArmor profiles rootlessly. - Remove CheckProfileAndLoadDefault, since this functionality is now being offloaded to profile loading in /etc/apparmor.d.
Set the default AppArmor profile to unconfined; see the following issues: - containers#958 - containers/podman#15874 Based on the discussion there, distros that use AppArmor should supply their own AppArmor profile and set it in a default containers.conf, since there is no way to load AppArmor profiles rootlessly.
Set the default AppArmor profile to unconfined; see the following issues: - containers#958 - containers/podman#15874 Based on the discussion there, distros that use AppArmor should supply their own AppArmor profile and set it in a default containers.conf, since there is no way to load AppArmor profiles rootlessly. Signed-off-by: Will Shand <[email protected]>
Update: I've opened containers/common#1572 and #19303 for this issue. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
This is related to a bug I previously reported in containers/common#958. This is really a bug in that library but it's impossible to resolve (without breakage) without making changes to Podman.
There is nominally a default AppArmor profile that gets applied to containers running on AA-supported systems, however, the way that this is currently implemented results in the profile only getting applied to containers that are run as root.
Specifically,
apparmor.IsEnabled()
callsIsSupported
under the hood, and only returnstrue
if the user is running as root:podman/vendor/github.com/containers/common/pkg/apparmor/internal/supported/supported.go
Lines 43 to 53 in 30231d0
This in turn causes
setupApparmor
to skip setting the profile to the default, and so any containers that are run rootlessly are run without any kind of LSM confinement.The easy way to solve this problem would simply be to fix the
apparmor.IsEnabled()
function (which in fact I previously tried to do, incorrectly, in containers/common#960), however, there is no way to load a default AppArmor profile that doesn't require root privileges. As such, it seems that fixing this issue would require identifying a method for Podman to load the default profile prior to trying to run the container rootlessly.Steps to reproduce the issue:
This second command will load the default profile into the kernel, although Podman still won't use that profile for rootless containers.
Describe the results you received: the rootless container runs without AppArmor confinement while the rootful container is confined.
Describe the results you expected: both containers should run with confinement.
Additional information you deem important (e.g. issue happens only occasionally): N/A
Output of
podman version
:Output of
podman info
:Package info (e.g. output of
rpm -q podman
orapt list podman
):N/A (I have been testing this with a build of the latest version of Podman)
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
None
The text was updated successfully, but these errors were encountered: