Skip to content

Commit

Permalink
snapcraft/commands/lxc: always escape Apparmor if enabled
Browse files Browse the repository at this point in the history
Conditionally calling `aa-exec -p unconfined` was useful only when re-exec'ing
the whole wrapper script. It's not needed now that only the `${LXC}` binary is
executed unconfined.

Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed Oct 24, 2024
1 parent ff81d50 commit 9bde3c0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions snapcraft/commands/lxc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ fi

# Run lxc itself outside of apparmor confinement
if [ -d /sys/kernel/security/apparmor ]; then
label="$(while read -r l; do echo "$l"; done < /proc/self/attr/current)"
if [ "$label" != "unconfined" ] && [ -n "${label##*(unconfined)}" ]; then
exec /usr/bin/aa-exec -p unconfined -- "${LXC}" "$@"
fi
exec /usr/bin/aa-exec -p unconfined -- "${LXC}" "$@"
fi

# Run lxc itself
Expand Down

0 comments on commit 9bde3c0

Please sign in to comment.