<def-group>
  <definition class="compliance" id="file_permissions_var_log_audit" version="1">
    <metadata>
      <title>Verify /var/log/audit Permissions</title>
      <affected family="unix">
        <platform>multi_platform_rhel</platform>
      </affected>
      <description>Checks for correct permissions for all log files in /var/log/audit.</description>
    </metadata>
    <criteria>
      <criterion test_ref="test_file_permissions_var_log_audit" negate="true" />
    </criteria>
  </definition>
  <unix:file_test check="all" check_existence="at_least_one_exists" comment="/var/log/audit files mode 0640" id="test_file_permissions_var_log_audit" version="1">
    <unix:object object_ref="object_var_log_audit_files" />
    <unix:state state_ref="state_not_mode_0640" />
  </unix:file_test>
  <unix:file_object comment="/var/log/audit files" id="object_var_log_audit_files" version="1">
    <unix:behaviors recurse="directories" recurse_direction="down" max_depth="-1" recurse_file_system="local" />
    <unix:path operation="equals">/var/log/audit</unix:path>
    <unix:filename operation="pattern match">^.*$</unix:filename>
    <filter action="include">state_not_mode_0640</filter>
  </unix:file_object>
  <unix:file_state id="state_not_mode_0640" version="1" operator="OR">
    <!-- if any one of these is true then mode is NOT 0640 (hence the OR operator) -->
    <unix:suid datatype="boolean">true</unix:suid>
    <unix:sgid datatype="boolean">true</unix:sgid>
    <unix:sticky datatype="boolean">true</unix:sticky>
    <unix:uexec datatype="boolean">true</unix:uexec>
    <unix:gwrite datatype="boolean">true</unix:gwrite>
    <unix:gexec datatype="boolean">true</unix:gexec>
    <unix:oread datatype="boolean">true</unix:oread>
    <unix:owrite datatype="boolean">true</unix:owrite>
    <unix:oexec datatype="boolean">true</unix:oexec>
  </unix:file_state>
</def-group>
