<def-group>
  <definition class="compliance" id="disable_prelink" version="3">
    <metadata>
      <title>Disable Prelinking</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <description>The prelinking feature can interfere with the operation of
      checksum integrity tools (e.g. AIDE), mitigates the protection provided
      by ASLR, and requires additional CPU cycles by software upgrades.
      </description>
      <reference source="JL" ref_id="RHEL6_20150624" ref_url="test_attestation" />
      <reference source="JL" ref_id="RHEL7_20150624" ref_url="test_attestation" />
      <reference source="JL" ref_id="FEDORA21_20150624" ref_url="test_attestation" />
    </metadata>
    <criteria operator="OR" comment="Conditions for prelinking disabled are satisfied">

      <!-- Part for testing RHEL-6 system -->
      <!-- On RHEL6 system the prelink RPM package is installed by default -->
      <criteria operator="AND" comment="System is RHEL6 with prelinking disabled">
        <extend_definition comment="Installed OS is RHEL6" definition_ref="installed_OS_is_rhel6" />
        <criterion comment="Prelinking is disabled" test_ref="test_prelinking_disabled" />
      </criteria>

      <!-- Part for testing RHEL-7 or Fedora system -->
      <!-- On RHEL7 and Fedora systems the prelink RPM package is *not* installed by default -->
      <criteria operator="AND" comment="System is RHEL7 or Fedora and prelink RPM is not installed or prelinking is disabled">
        <criteria operator="OR" comment="System is RHEL7 or Fedora">
          <extend_definition comment="Installed OS is RHEL7" definition_ref="installed_OS_is_rhel7" />
          <extend_definition comment="Installed OS is Fedora" definition_ref="installed_OS_is_fedora" />
        </criteria>
        <criteria operator="OR" comment="prelink RPM package not installed or prelinking disabled">
          <extend_definition comment="prelink RPM package not installed" definition_ref="package_prelink_removed" />
          <criterion comment="Prelinking is disabled" test_ref="test_prelinking_disabled" />
        </criteria>
      </criteria>

    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="Tests whether prelinking is disabled" id="test_prelinking_disabled" version="1">
    <ind:object object_ref="object_prelinking_disabled" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_prelinking_disabled" version="2">
    <ind:filepath>/etc/sysconfig/prelink</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*PRELINKING=no[\s]*</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
