Skip to content

Commit

Permalink
Only enforce valid profile
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmcanonical committed Jan 31, 2025
1 parent 737463d commit 02ca445
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

# Ensure all AppArmor Profiles are enforcing
apparmor_parser -q -r /etc/apparmor.d/
{{% if 'ubuntu' in product %}}
# Current version of apparmor-utils has issue https://gitlab.com/apparmor/apparmor/-/issues/411 and we're waiting for https://gitlab.com/apparmor/apparmor/-/merge_requests/1218 to be landed on noble
find /etc/apparmor.d -maxdepth 1 ! -type d -exec aa-enforce "{}" \;
{{% else %}}
aa-enforce /etc/apparmor.d/*
{{% endif %}}

{{% if 'ubuntu' in product %}}
UNCONFINED=$(aa-status | grep "processes are unconfined" | awk '{print $1;}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#Replace apparmor definitions
apparmor_parser -q -r /etc/apparmor.d/
#Set all profiles in enforce mode
{{% if 'ubuntu' in product %}}
find /etc/apparmor.d -maxdepth 1 ! -type d -exec aa-enforce "{}" \;
{{% else %}}
aa-enforce /etc/apparmor.d/*
{{% endif %}}

# rsyslogd apparmor profile is disabled in focal and jammy.
# Reloading the profile results in an unconfined process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
#Replace apparmor definitions and force profiles into compliant mode
apparmor_parser -q -r /etc/apparmor.d/
#Set all profiles in complain mode
{{% if 'ubuntu' in product %}}
find /etc/apparmor.d -maxdepth 1 ! -type d -exec aa-complain "{}" \;
{{% else %}}
aa-complain /etc/apparmor.d/*

{{% endif %}}
# rsyslogd apparmor profile is disabled in focal and jammy.
# Reloading the profile results in an unconfined process
# which fails the SCE, so we need to restart the process manually.
Expand Down

0 comments on commit 02ca445

Please sign in to comment.