Commit Graph

10 Commits

Author SHA1 Message Date
Valentin Rothberg 97f5e708f6 Revert "Change default profile to unconfined; remove CheckProfileAndLoadDefault"
This reverts commit 6d109b95a0 because it
was merged prematurely.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-17 10:17:15 +02:00
Valentin Rothberg ed3ac2cb8e Revert "Revert "Revert "Allow rootless containers to use AppArmor profiles"""
This reverts commit d2e1497ce1 because it
was merged prematurely.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-17 10:16:55 +02:00
Will Shand 6d109b95a0 Change default profile to unconfined; remove CheckProfileAndLoadDefault
Set the default AppArmor profile to unconfined; see the following
issues:

- https://github.com/containers/common/issues/958
- https://github.com/containers/podman/issues/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 <wss2ec@g.ucla.edu>
2023-07-20 22:12:40 +00:00
Will Shand d2e1497ce1 Revert "Revert "Allow rootless containers to use AppArmor profiles""
This reverts commit ae50de4ddf.

Signed-off-by: Will Shand <wss2ec@g.ucla.edu>
2023-07-20 22:12:26 +00:00
Valentin Rothberg ae50de4ddf Revert "Allow rootless containers to use AppArmor profiles"
This reverts commit 6994271ca4 since
it does not pass Podman CI (i.e., the rootless Ubuntu job fails).

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-18 13:31:11 +01:00
kernelmethod 6994271ca4 Allow rootless containers to use AppArmor profiles
Previously, Podman would print an error if you tried to run a container
with an AppArmor profile as a non-root user, e.g.

    $ podman run --security-opt apparmor=my-profile ...
    Error: Apparmor profile "my-profile" specified, but Apparmor is not
    enabled on this system

In fact, the only thing that Podman needs root privileges for is reading
/sys/kernel/security/apparmor/profiles to see if the profile is already
loaded, which isn't strictly necessary.

This commit removes the 'IsLoaded()' check that occurs when you try to
specify an AppArmor profile as a non-root user, as well as the other
checks in pkg/apparmor/ for whether the program is running as UID 0. The
check for whether the AppArmor profile is loaded should now be deferred
to the container runtime at the point where it writes to either
/proc/self/attr/exec or /proc/self/attr/apparmor/exec, since the write
should fail if the profile is not loaded.

Closes #958.

Signed-off-by: kernelmethod <17100608+kernelmethod@users.noreply.github.com>
2022-03-11 13:57:50 -07:00
Sascha Grunert 73aa297b0c Wrap AppArmor errors to provide more debug information
Mostly all AppArmor errors are now wrapped to provide additional context
to the user what actually went wrong. We now only use the spelling
`AppArmor` rather than `apparmor` to give the errors a uniform look.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-08-17 12:20:25 +02:00
Valentin Rothberg d5639f5e55 pkg/version -> version
Move pkg/version to version to be consistent with other libraries in
c/image.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-24 10:47:18 +02:00
Sascha Grunert 4a58c879e2 Change AppArmor profile prefix and fix name-check
The default AppArmor profile is now prefixed with
`container-default-$VERSION`, whereas the version is now part of a new
`version` package.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-06-23 18:11:28 +02:00
Daniel J Walsh ed25ff4eb6 Add more utils for returning defaults
Move pkg/sysinfo and pkg/apparmor out of libpod into containers/common.

This will allow other packages to use these libraries without requiring all of libpod.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-01 08:39:44 -04:00