<def-group>
  <definition class="compliance" id="audit_rules_media_export" version="1">
    <metadata>
      <title>Audit Information Export To Media</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 7</platform>
        <platform>multi_platform_fedora</platform>
      </affected>
      <description>Audit rules that detect the mounting of filesystems should be enabled.</description>
      <reference source="JL" ref_id="RHEL7_20150327" ref_url="test_attestation" />
      <reference source="JL" ref_id="FEDORA20_20150327" ref_url="test_attestation" />
    </metadata>
    <criteria operator="OR">
      <criteria operator="AND">
        <criterion comment="audit augenrules" test_ref="test_audit_rules_media_export_augenrules" />
        <criterion comment="audit augenrules mount" test_ref="test_audit_rules_media_export_mount_augenrules" />
      </criteria>
      <criteria operator="AND">
        <criterion comment="audit auditctl" test_ref="test_audit_rules_media_export_auditctl" />
        <criterion comment="audit auditctl mount" test_ref="test_audit_rules_media_export_mount_auditctl" />
      </criteria>
    </criteria>
  </definition>

  <!-- Test the augenrules case -->
  <ind:textfilecontent54_test check="all" comment="audit augenrules" id="test_audit_rules_media_export_augenrules" version="1">
    <ind:object object_ref="object_audit_rules_media_export_augenrules" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_media_export_augenrules" version="1">
    <ind:filepath>/usr/lib/systemd/system/auditd.service</ind:filepath>
    <ind:pattern operation="pattern match">^ExecStartPost=\-\/sbin\/augenrules.*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_test check="all" comment="audit augenrules mount" id="test_audit_rules_media_export_mount_augenrules" version="1">
    <ind:object object_ref="object_audit_rules_media_export_mount_augenrules" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_media_export_mount_augenrules" version="1">
    <ind:filepath operation="pattern match">/etc/audit/rules\.d/.*\.rules</ind:filepath>
    <ind:pattern operation="pattern match">^\-a\s+always,exit\s+(\-F\s+arch=(b64|b32)\s+)?\-S\s+mount\s+\-F\s+auid>=1000\s+\-F\s+auid!=4294967295\s+\-k\s+[-\w]+\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <!-- Test the auditctl case -->
  <ind:textfilecontent54_test check="all" comment="audit auditctl" id="test_audit_rules_media_export_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_media_export_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_media_export_auditctl" version="1">
    <ind:filepath>/usr/lib/systemd/system/auditd.service</ind:filepath>
    <ind:pattern operation="pattern match">^ExecStartPost=\-\/sbin\/auditctl.*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_test check="all" comment="audit auditctl mount" id="test_audit_rules_media_export_mount_auditctl" version="1">
    <ind:object object_ref="object_audit_rules_media_export_mount_auditctl" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_audit_rules_media_export_mount_auditctl" 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+mount\s+\-F\s+auid>=1000\s+\-F\s+auid!=4294967295\s+\-k\s+[-\w]+\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
