<def-group>
  <definition class="compliance" id="audit_rules_kernel_module_loading" version="2">
    <metadata>
      <title>Audit Kernel Module Loading and Unloading</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 6</platform>
      </affected>
      <description>The audit rules should be configured to log information about kernel module loading and unloading.</description>
      <reference source="JL" ref_id="RHEL6_20141210" ref_url="test_attestation" />
    </metadata>
    <criteria operator="AND">
      <criterion comment="audit insmod" test_ref="test_audit_rule_kernel_module_loading_insmod" />
      <criterion comment="audit rmmod" test_ref="test_audit_rule_kernel_module_loading_rmmod" />
      <criterion comment="audit rmmod" test_ref="test_audit_rule_kernel_module_loading_modprobe" />
      <criterion comment="audit module syscalls" test_ref="test_audit_rule_kernel_module_loading_syscall" />
    </criteria>
  </definition>
  <ind:textfilecontent54_test check="all" comment="audit insmod" id="test_audit_rule_kernel_module_loading_insmod" version="1">
    <ind:object object_ref="object_audit_rule_kernel_module_loading_insmod" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rule_kernel_module_loading_insmod" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/sbin/insmod[\s]+\-p[\s]+\b([raw]*x[raw]*)\b[\s]+\-k[\s]+[-\w]+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_test check="all" comment="audit rmmod" id="test_audit_rule_kernel_module_loading_rmmod" version="1">
    <ind:object object_ref="object_audit_rule_kernel_module_loading_rmmod" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rule_kernel_module_loading_rmmod" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w[\s]+/sbin/rmmod[\s]+\-p[\s]+\b([raw]*x[raw]*)\b[\s]+\-k[\s]+[-\w]+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_test check="all" comment="audit modprobe" id="test_audit_rule_kernel_module_loading_modprobe" version="1">
    <ind:object object_ref="object_audit_rule_kernel_module_loading_modprobe" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rule_kernel_module_loading_modprobe" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-w\s+/sbin/modprobe[\s]+\-p[\s]+\b([raw]*x[raw]*)\b[\s]+\-k[\s]+[-\w]+[\s]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_test check="all" comment="audit module syscalls" id="test_audit_rule_kernel_module_loading_syscall" version="1">
    <ind:object object_ref="object_audit_rule_kernel_module_loading_syscall" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rule_kernel_module_loading_syscall" version="1">
    <ind:filepath>/etc/audit/audit.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-a\s+always,exit\s+(\-F\s+arch=(b64|b32)\s+)?\-S\s+init_module\s+\-S\s+delete_module\s+\-k\s+[-\w]+\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
</def-group>
