Skip to content

Commit

Permalink
snapcraft/commands/daemon.start: check apparmor_unprivileged_restrict…
Browse files Browse the repository at this point in the history
…ions_disable config before disabling related sysctl

Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Feb 13, 2024
1 parent 61ff0c7 commit e84c668
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,22 @@ if [ "$(stat -c '%u' /proc)" = 0 ]; then
echo 1 > /proc/sys/kernel/unprivileged_userns_clone || true
fi
fi

if [ "${apparmor_unprivileged_restrictions_disable:-"true"}" = "true" ]; then
if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns)" = "1" ]; then
echo "==> Disabling Apparmor unprivileged userns mediation"
echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns || true
fi
fi

if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_unconfined ]; then
if [ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_unconfined)" = "1" ]; then
echo "==> Disabling Apparmor unprivileged unconfined mediation"
echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_unconfined || true
fi
fi
fi
fi

# Setup CRIU
Expand Down

0 comments on commit e84c668

Please sign in to comment.