<def-group>
  <definition class="compliance" id="accounts_password_pam_retry" version="1">
    <metadata>
      <title>Set Password retry Requirements</title>
      <affected family="unix">
        <platform>multi_platform_all</platform>
      </affected>
      <description>The password retry should meet minimum requirements</description>
      <reference source="swells" ref_id="20140925" ref_url="test_attestation"/>
    </metadata>
    <criteria operator="OR" comment="Conditions for retry are satisfied">
      <criteria operator="AND" comment="system is RHEL6 with pam_cracklib configured">
        <extend_definition comment="RHEL6 OS installed" definition_ref="installed_OS_is_rhel6" />
        <criterion comment="rhel6 pam_cracklib" test_ref="test_password_pam_cracklib_retry" />
      </criteria>
      <criteria operator="AND" comment="system is RHEL7 with pam_pwquality configured">
        <extend_definition comment="RHEL7 OS installed" definition_ref="installed_OS_is_rhel7" />
        <criterion comment="rhel7 pam_pwquality" test_ref="test_password_pam_pwquality_retry" />
      </criteria>
      <criteria operator="AND" comment="system is Fedora with pam_pwquality configured">
        <extend_definition comment="Fedora OS installed" definition_ref="installed_OS_is_fedora" />
        <criterion comment="Fedora pam_pwquality" test_ref="test_password_pam_pwquality_retry" />
      </criteria>
    </criteria>
  </definition>

  <!-- BEGIN RHEL6 CHECKS -->
  <ind:textfilecontent54_test check="all" comment="check the configuration of /etc/pam.d/system-auth" id="test_password_pam_cracklib_retry" version="1">
    <ind:object object_ref="obj_password_pam_cracklib_retry" />
    <ind:state state_ref="state_password_pam_retry" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_password_pam_cracklib_retry" version="1">
    <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*password\s+(?:(?:required)|(?:requisite))\s+pam_cracklib\.so.*retry=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <!-- BEGIN RHEL7 & Fedora CHECKS -->
  <ind:textfilecontent54_test check="all" comment="check the configuration of /etc/pam.d/system-auth" id="test_password_pam_pwquality_retry" version="1">
    <ind:object object_ref="obj_password_pam_pwquality_retry" />
    <ind:state state_ref="state_password_pam_retry" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_password_pam_pwquality_retry" version="1">
    <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*password\s+(?:(?:required)|(?:requisite))\s+pam_pwquality\.so.*retry=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <!-- The following state & variables are reused between the RHEL6/RHEL7 checks -->
  <ind:textfilecontent54_state id="state_password_pam_retry" version="1">
    <ind:subexpression datatype="int" operation="less than or equal" var_ref="var_password_pam_retry" />
  </ind:textfilecontent54_state>

  <external_variable comment="External variable for pam_pwquality retry" datatype="int" id="var_password_pam_retry" version="1" />
</def-group>
