<def-group>
    <definition class="compliance" id="{{{ rule_id }}}" version="1">
    {{{ oval_metadata("Checks that all audit log files are group owned by the root user.") }}}
    <criteria operator="OR">
      <criteria operator="AND" comment="log_file set">
        <extend_definition comment="log file set in auditd.conf"
          definition_ref="auditd_conf_log_file_not_set" negate="true" />
        <extend_definition comment="log_group in auditd.conf is root"
          definition_ref="auditd_conf_log_group_not_root" negate="true"/>
        <criterion comment="audit log files are root group owned"
          test_ref="{{{ rule_id }}}_test_group_ownership"/>
      </criteria>
      <criteria operator="AND" comment="log_file not set">
        <extend_definition comment="log file not set in auditd.conf"
          definition_ref="auditd_conf_log_file_not_set" />
        <extend_definition comment="log_group in auditd.conf is root"
          definition_ref="auditd_conf_log_group_not_root" negate="true" />
        <criterion comment="default audit log files are root group owned"
          test_ref="{{{ rule_id }}}_test_group_ownership_default"/>
      </criteria>
    </criteria>
  </definition>

  <unix:file_test check="all" check_existence="none_exist" comment="audit log files gid root"
  id="{{{ rule_id }}}_test_group_ownership" version="1">
    <unix:object object_ref="{{{ rule_id }}}_object_group_ownership" />
  </unix:file_test>

  <unix:file_test check="all" check_existence="none_exist" comment="audit log files gid root"
  id="{{{ rule_id }}}_test_group_ownership_default" version="1">
    <unix:object object_ref="{{{ rule_id }}}_object_group_ownership_default" />
  </unix:file_test>

  <unix:file_object comment="audit log files" id="{{{ rule_id }}}_object_group_ownership"
  version="1">
    <unix:filepath operation="equals" var_ref="audit_log_file_path" />
    <filter action="include">{{{ rule_id }}}_state_group_owner_not_root</filter>
  </unix:file_object>

  <unix:file_object comment="/var/log/audit files"
  id="{{{ rule_id }}}_object_group_ownership_default" version="1">
    <unix:filepath operation="equals">/var/log/audit/audit.log</unix:filepath>
    <filter action="include">{{{ rule_id }}}_state_group_owner_not_root</filter>
  </unix:file_object>

  <unix:file_state id="{{{ rule_id }}}_state_group_owner_not_root" version="1" operator="OR">
    <unix:group_id datatype="int" operation="not equal">0</unix:group_id>
  </unix:file_state>

</def-group>
