<def-group>
  <definition class="compliance" id="file_audit_tools_ownership" version="1">
  
    <metadata>
        <title>Audit Tools Must Be Owned by Root</title>
        
    <affected family="unix">
    <platform>Ubuntu 22.04</platform>
    </affected>
        <description>This test makes sure that /sbin/auditctl, /sbin/aureport, /sbin/ausearch, /sbin/autrace, /sbin/auditd, /sbin/rsyslogd, /sbin/augenrules is owned by 0.</description>
    </metadata>
     <criteria>
   
     <criterion comment="Check file ownership of /sbin/auditctl" test_ref="test_file_ownerfile_audit_tools_ownership_0" />
   
     <criterion comment="Check file ownership of /sbin/aureport" test_ref="test_file_ownerfile_audit_tools_ownership_1" />
   
     <criterion comment="Check file ownership of /sbin/ausearch" test_ref="test_file_ownerfile_audit_tools_ownership_2" />
   
     <criterion comment="Check file ownership of /sbin/autrace" test_ref="test_file_ownerfile_audit_tools_ownership_3" />
   
     <criterion comment="Check file ownership of /sbin/auditd" test_ref="test_file_ownerfile_audit_tools_ownership_4" />
   
     <criterion comment="Check file ownership of /sbin/rsyslogd" test_ref="test_file_ownerfile_audit_tools_ownership_5" />
   
     <criterion comment="Check file ownership of /sbin/augenrules" test_ref="test_file_ownerfile_audit_tools_ownership_6" />
   
  
    </criteria>
  </definition>
  <local_variable id="var_file_ownerfile_audit_tools_ownership_0_uid" comment="Set the uid to 0" datatype="int" version="1">
    <literal_component datatype="int">0</literal_component>
  </local_variable>

  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/auditctl" id="test_file_ownerfile_audit_tools_ownership_0" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_0" />
  </unix:file_test>

  <unix:file_object comment="/sbin/auditctl" id="object_file_ownerfile_audit_tools_ownership_0" version="1">
      <unix:filepath>/sbin/auditctl</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/aureport" id="test_file_ownerfile_audit_tools_ownership_1" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_1" />
  </unix:file_test>

  <unix:file_object comment="/sbin/aureport" id="object_file_ownerfile_audit_tools_ownership_1" version="1">
      <unix:filepath>/sbin/aureport</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/ausearch" id="test_file_ownerfile_audit_tools_ownership_2" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_2" />
  </unix:file_test>

  <unix:file_object comment="/sbin/ausearch" id="object_file_ownerfile_audit_tools_ownership_2" version="1">
      <unix:filepath>/sbin/ausearch</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/autrace" id="test_file_ownerfile_audit_tools_ownership_3" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_3" />
  </unix:file_test>

  <unix:file_object comment="/sbin/autrace" id="object_file_ownerfile_audit_tools_ownership_3" version="1">
      <unix:filepath>/sbin/autrace</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/auditd" id="test_file_ownerfile_audit_tools_ownership_4" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_4" />
  </unix:file_test>

  <unix:file_object comment="/sbin/auditd" id="object_file_ownerfile_audit_tools_ownership_4" version="1">
      <unix:filepath>/sbin/auditd</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/rsyslogd" id="test_file_ownerfile_audit_tools_ownership_5" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_5" />
  </unix:file_test>

  <unix:file_object comment="/sbin/rsyslogd" id="object_file_ownerfile_audit_tools_ownership_5" version="1">
      <unix:filepath>/sbin/rsyslogd</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_test check="all" check_existence="none_exist" comment="Testing user ownership of /sbin/augenrules" id="test_file_ownerfile_audit_tools_ownership_6" version="1">
    <unix:object object_ref="object_file_ownerfile_audit_tools_ownership_6" />
  </unix:file_test>

  <unix:file_object comment="/sbin/augenrules" id="object_file_ownerfile_audit_tools_ownership_6" version="1">
      <unix:filepath>/sbin/augenrules</unix:filepath>
    <filter action="exclude">symlink_file_owner</filter>
    
      <filter action="exclude">state_file_ownerfile_audit_tools_ownership_0_0</filter>
    
  </unix:file_object>
  
    <unix:file_state id="state_file_ownerfile_audit_tools_ownership_0_0" version="1">
      <unix:user_id datatype="int" operation="equals" var_ref="var_file_ownerfile_audit_tools_ownership_0_uid"></unix:user_id>
    </unix:file_state>
  
  
  <unix:file_state id="symlink_file_owner" version="1">
    <unix:type operation="equals">symbolic link</unix:type>
  </unix:file_state>
</def-group>