<def-group>
  <definition class="compliance" id="file_group_ownership_var_log_audit" 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" />
        <criteria operator="XOR">
          <criterion comment="audit log files are root group owned"
          test_ref="test_group_ownership_audit_log_files"/>
          {{% if product != "ol8" %}}
          <extend_definition comment="log_group in auditd.conf is not root"
          definition_ref="auditd_conf_log_group_not_root"/>
          {{% endif %}}
        </criteria>
      </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" />
        <criteria operator="XOR">
          <criterion comment="default audit log files are root group owned"
          test_ref="test_group_ownership_default_audit_log_files"/>
          {{% if product != "ol8" %}}
          <extend_definition comment="log_group in auditd.conf is not root"
          definition_ref="auditd_conf_log_group_not_root" />
          {{% endif %}}
        </criteria>
      </criteria>
    </criteria>
  </definition>

  <unix:file_test check="all" check_existence="none_exist" comment="audit log files gid root"
  id="test_group_ownership_audit_log_files" version="1">
    <unix:object object_ref="object_group_ownership_audit_log_files" />
  </unix:file_test>

  <unix:file_test check="all" check_existence="none_exist" comment="audit log files gid root"
  id="test_group_ownership_default_audit_log_files" version="1">
    <unix:object object_ref="object_group_ownership_default_audit_log_files" />
  </unix:file_test>

  <unix:file_object comment="audit log files" id="object_group_ownership_audit_log_files"
  version="1">
    <unix:filepath operation="equals" var_ref="audit_log_file_path" />
    <filter action="include">state_group_owner_not_root_var_log_audit</filter>
  </unix:file_object>

  <unix:file_object comment="/var/log/audit files"
  id="object_group_ownership_default_audit_log_files" version="1">
    <unix:filepath operation="equals">/var/log/audit/audit.log</unix:filepath>
    <filter action="include">state_group_owner_not_root_var_log_audit</filter>
  </unix:file_object>

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

</def-group>
