<def-group>
  <definition class="compliance" id="auditd_data_retention_space_left_action" version="3">
    {{{ oval_metadata("space_left_action setting in /etc/audit/auditd.conf is set to a certain action", rule_title=rule_title) }}}

    <criteria>
        <criterion comment="space_left_action setting in auditd.conf" test_ref="test_auditd_data_retention_space_left_action" />
    </criteria>

  </definition>

  <ind:textfilecontent54_test check="all" comment="space left action" id="test_auditd_data_retention_space_left_action" version="2">
    <ind:object object_ref="object_auditd_data_retention_space_left_action" />
    <ind:state state_ref="state_auditd_data_retention_space_left_action" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="object_auditd_data_retention_space_left_action" version="2">
    <ind:filepath>/etc/audit/auditd.conf</ind:filepath>
    <!-- Allow only space (exactly) as delimiter: https://fedorahosted.org/audit/browser/trunk/src/auditd-config.c#L426 -->
    <!-- Require at least one space before and after the equal sign -->
    <ind:pattern operation="pattern match">^[ ]*space_left_action[ ]+=[ ]+(\S+)[ ]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_state id="state_auditd_data_retention_space_left_action" version="2">
    <ind:subexpression operation="pattern match" var_ref="var_auditd_space_left_action_regex" />
  </ind:textfilecontent54_state>

  <local_variable datatype="string" id="var_auditd_space_left_action_regex" version="1"
  comment="Build regex to be case insensitive">
    <concat>
      <literal_component>(?i)</literal_component>
      <variable_component var_ref="var_auditd_space_left_action"/>
    </concat>
  </local_variable>

  <external_variable comment="audit space_left_action setting" datatype="string" id="var_auditd_space_left_action" version="2" />

</def-group>
