Skip to content

feat: stack AppArmor profiles when NoNewPrivs is set - #405

Draft
olivercalder wants to merge 1 commit into
canonical:mainfrom
olivercalder:no-new-privs-stack-apparmor-profiles
Draft

olivercalder wants to merge 1 commit into
canonical:mainfrom
olivercalder:no-new-privs-stack-apparmor-profiles

Conversation

@olivercalder

@olivercalder olivercalder commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

This requires the following change to land in snapd first: canonical/snapd#17730

When NoNewPrivs is set, AppArmor prevents programs from transitioning from one profile to another. This is something that the docker snap relies upon, as it transitions from the snap.docker.dockerd profile to the docker-default profile when it starts up a container. Thus, the docker snap has been broken when NoNewPrivs is set.

This commit aims to remedy this. Instead of transitioning directly to the new profile, stack the new profile on top of the existing profile by prepending a & character to the profile name when NoNewPrivileges is set. This requires a new patch to moby.

The existing profile transition behavior is preserved when NoNewPrivileges is not set.

The docker-support interface requires changes to support profile stacking which will only be included in snapd 2.79 and later. Thus, bump the assumes version for snapd to 2.79.

Regenerate the full patch series, as a new patch was added.

This is tracked internally by https://warthogs.atlassian.net/browse/SNAPDENG-37815

When `NoNewPrivs` is set, AppArmor prevents programs from transitioning
from one profile to another. This is something that the `docker` snap
relies upon, as it transitions from the `snap.docker.dockerd` profile to
the `docker-default` profile when it starts up a container. Thus, the
`docker` snap has been broken when `NoNewPrivs` is set.

This commit aims to remedy this. Instead of transitioning directly to
the new profile, stack the new profile on top of the existing profile by
prepending a `&` character to the profile name when `NoNewPrivileges` is
set. This requires a new patch to `moby`.

The existing profile transition behavior is preserved when
`NoNewPrivileges` is not set.

The `docker-support` interface requires changes to support profile
stacking which will only be included in snapd 2.79 and later. Thus, bump
the `assumes` version for snapd to 2.79.

Regenerate the full patch series, as a new patch was added.

Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
@olivercalder

Copy link
Copy Markdown
Member Author

CC @zyga

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant