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 aa-unconfinedAny 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 - Ansible
- name: Gather the package facts
package_facts:
manager: auto
tags:
- CCE-92371-4
- all_apparmor_profiles_enforced
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q apparmor-profiles; }; then
# make sure apparmor-utils is installed for aa-complain and aa-enforce
zypper install -y "apparmor-utils"