Enforce all AppArmor Profiles
An XCCDF Rule
Description
AppArmor profiles define what resources applications are able to access. To set all profiles to enforce mode run the following command:
$ sudo aa-enforce /etc/apparmor.d/*To list unconfined processes run the following command:
$ sudo apparmor_status | grep processesAny unconfined processes may need to have a profile created or activated for them and then be restarted.
Rationale
Security configuration requirements vary from site to site. Some sites may mandate a policy that is stricter than the default policy, which is perfectly acceptable. This recommendation is intended to ensure that any policies that exist on the system are activated.
- ID
- xccdf_org.ssgproject.content_rule_all_apparmor_profiles_enforced
- Severity
- Medium
- References
- Updated
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
# make sure apparmor-utils is installed for aa-complain and aa-enforce
DEBIAN_FRONTEND=noninteractive apt-get install -y "apparmor-utils"