Skip to content

Commit

Permalink
Merge pull request ComplianceAsCode#11672 from dodys/apparmor
Browse files Browse the repository at this point in the history
all_apparmor_profiles_in_enforce_complain_mode: Fix OVAL logic
  • Loading branch information
teacup-on-rockingchair authored Mar 15, 2024
2 parents 5eb5b60 + bbff647 commit 353e6e0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@
</definition>
<ind:textfilecontent54_object id="{{{ rule_id }}}_obj_apparmor_profiles" version="1">
<ind:filepath datatype="string">/sys/kernel/security/apparmor/profiles</ind:filepath>
<ind:pattern operation="pattern match">^.*$</ind:pattern>
<ind:pattern operation="pattern match">^(.*)$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_object id="{{{ rule_id }}}_obj_apparmor_enforced_profiles" version="1">
<ind:filepath datatype="string">/sys/kernel/security/apparmor/profiles</ind:filepath>
<ind:pattern operation="pattern match" datatype="string">^.*\(enforce\)$</ind:pattern>
<ind:pattern operation="pattern match" datatype="string">^.*(\(enforce\))$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_object id="{{{ rule_id }}}_obj_apparmor_complaining_profiles" version="1">
<ind:filepath datatype="string">/sys/kernel/security/apparmor/profiles</ind:filepath>
<ind:pattern operation="pattern match" datatype="string">^.*\(complain\)$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_object id="{{{ rule_id }}}_obj_apparmor_unconfined_profiles" version="1">
<ind:filepath datatype="string">/sys/kernel/security/apparmor/profiles</ind:filepath>
<ind:pattern operation="pattern match"
datatype="string">^\.*processes are unconfined.*$</ind:pattern>
<ind:pattern operation="pattern match" datatype="string">^.*(\(complain\))$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<local_variable datatype="int" id="{{{ rule_id }}}_var_num_apparmor_profiles" version="1"
Expand All @@ -47,11 +41,6 @@
</count>
</arithmetic>
</local_variable>
<local_variable datatype="int" id="{{{ rule_id }}}_var_num_apparmor_unconfined_profiles"
version="1" comment="apparmor profiles with unconfined processes">
<object_component item_field="subexpression"
object_ref="{{{ rule_id }}}_obj_apparmor_unconfined_profiles" />
</local_variable>

<ind:variable_object id="{{{ rule_id }}}_obj_all_apparmor_profiles" version="1">
<ind:var_ref>{{{ rule_id }}}_var_num_apparmor_profiles</ind:var_ref>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# packages = apparmor
# packages = apparmor-utils

#Replace apparmor definitions
apparmor_parser -q -r /etc/apparmor.d/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# packages = apparmor
# packages = apparmor-utils

#Replace apparmor definitions
apparmor_parser -q -r /etc/apparmor.d/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# packages = apparmor
# packages = apparmor-utils

#Configure the OS to unload all AppArmor profiles
aa-teardown

0 comments on commit 353e6e0

Please sign in to comment.