
<def-group>
  <definition class="compliance" id="auditd_write_logs" version="1">
    <metadata>
        <title>Write Audit Logs to the Disk</title>
        
    <affected family="unix">
    <platform>Ubuntu 22.04</platform>
    </affected>
        <description>Ensure 'write_logs' is configured with value 'yes' in /etc/audit/auditd.conf</description>
    </metadata>
    <criteria comment="auditd is configured correctly"
    operator="OR"><criterion comment="Check the write_logs in /etc/audit/auditd.conf"
  test_ref="test_auditd_write_logs" /><criterion comment="Check the absence of write_logs in /etc/audit/auditd.conf"
  test_ref="test_auditd_write_logs_default_not_overriden" />
    </criteria>
  </definition>

  

  
<ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="tests the value of write_logs setting in the /etc/audit/auditd.conf file"
  id="test_auditd_write_logs" version="1">
  <ind:object object_ref="obj_auditd_write_logs" />
  <ind:state state_ref="state_auditd_write_logs" />
</ind:textfilecontent54_test>
  
<ind:textfilecontent54_object id="obj_auditd_write_logs" version="1">
  <ind:filepath>/etc/audit/auditd.conf</ind:filepath>
  <ind:pattern operation="pattern match">^[ \t]*(?i)write_logs(?-i)[ \t]*=[ \t]*(.+?)[ \t]*(?:$|#)</ind:pattern>
  <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_state id="state_auditd_write_logs" version="1">
  <ind:subexpression datatype="string" operation="pattern match">^(?i)yes(?-i)$</ind:subexpression>
</ind:textfilecontent54_state>
  
<ind:textfilecontent54_test check="all" check_existence="none_exist"
  comment="tests the absence of write_logs setting in the /etc/audit/auditd.conf file"
  id="test_auditd_write_logs_default_not_overriden" version="1">
  <ind:object object_ref="obj_auditd_write_logs_default_not_overriden" />
</ind:textfilecontent54_test>
  
<ind:textfilecontent54_object id="obj_auditd_write_logs_default_not_overriden" version="1">
  <ind:filepath>/etc/audit/auditd.conf</ind:filepath>
  <ind:pattern operation="pattern match">^[ \t]*(?i)write_logs(?-i)[ \t]*=[ \t]*</ind:pattern>
  <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

</def-group>