<def-group>
  <definition class="compliance" id="bootloader_password" version="1">
    <metadata>
      <title>Set Boot Loader Password</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 7</platform>
        <platform>multi_platform_fedora</platform>
      </affected>
      <description>The grub2 boot loader should have password protection enabled.</description>
      <reference source="galford" ref_id="20140909" ref_url="test_attestation" />
    </metadata>
    <criteria operator="AND">
      <criterion comment="make sure a password is defined in /etc/grub2.cfg" test_ref="test_bootloader_password" />
      <criterion comment="make sure a superuser is defined in /etc/grub2.cfg" test_ref="test_bootloader_superuser"/>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="superuser is defined in /etc/grub2.cfg files. Superuser is not root, admin, or administrator" id="test_bootloader_superuser" version="1">
    <ind:object object_ref="object_bootloader_superuser" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_bootloader_superuser" version="1">
    <ind:filepath>/etc/grub2.cfg</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*set[\s]+superusers=\"(?i)(?!root|admin|administrator)(?-i).*\"$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="make sure a password is defined in /etc/grub2.cfg" id="test_bootloader_password" version="1">
    <ind:object object_ref="object_bootloader_password" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_bootloader_password" version="1">
    <ind:filepath>/etc/grub2.cfg</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
</def-group>
