<def-group>
  <definition class="compliance" id="accounts_fail_delay" version="1">
    <metadata>
      <title>Set Failure Delay Parameters</title>
      <affected family="unix">
        <platform>CentOS 4</platform>
		<platform>CentOS 5</platform>
		<platform>Red Hat Enterprise Linux 4</platform>
		<platform>Red Hat Enterprise Linux 5</platform>
      </affected>
      <description>The delay between login prompts following a failed login attempt must be at least 4 seconds.</description>
    </metadata>
    <criteria comment="the value FAIL_DELAY should be set appropriately in /etc/login.defs">
      <criterion test_ref="test_accounts_fail_delay_logindefs" />
	  <criteria comment="the value pam_faildelay should be set appropriately in /etc/pam.d/system-auth" operator="OR">
	    <criterion comment="pam_faildelay.so is not included in /lib/security/*" test_ref="test_pam_faildelay_not_included" />
		<criterion test_ref="test_accounts_fail_delay_systemauth" />
	    <criteria comment="the value pam_faildelay should be set appropriately in /etc/pam.d/system-auth-ac" operator="AND">
		  <criterion test_ref="test_accounts_fail_delay_systemauthac" />
		  <extend_definition comment="global account settings configured" definition_ref="accounts_global_setting" />
        </criteria>
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" comment="Tests the value of FAIL_DELAY in /etc/login.defs" id="test_accounts_fail_delay_logindefs" version="1">
    <ind:object object_ref="object_accounts_fail_delay_logindefs" />
    <ind:state state_ref="state_accounts_fail_delay_logindefs" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_accounts_fail_delay_logindefs" version="1">
    <ind:filepath>/etc/login.defs</ind:filepath>
    <ind:pattern operation="pattern match">^[\s]*FAIL_DELAY[\s]+(\d+)\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_accounts_fail_delay_logindefs" version="1">
    <ind:subexpression operation="greater than or equal" datatype="int">4</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" comment="Tests the value of pam_faildelay in /etc/pam.d/system-auth" id="test_accounts_fail_delay_systemauth" version="1">
    <ind:object object_ref="object_accounts_fail_delay_systemauth" />
    <ind:state state_ref="state_accounts_fail_delay_systemauth" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_accounts_fail_delay_systemauth" version="1">
    <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
    <ind:pattern operation="pattern match">^auth[\s]+[a-z]+[\s]+(?:/lib/security/(?:\$ISA/)*)*pam_faildelay.so[\s]+delay=([0-9]+).*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_accounts_fail_delay_systemauth" version="1">
    <ind:subexpression operation="greater than or equal" datatype="int">4000000</ind:subexpression>
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_test check="all" comment="Tests the value of pam_faildelay in /etc/pam.d/system-auth-ac" id="test_accounts_fail_delay_systemauthac" version="1">
    <ind:object object_ref="object_accounts_fail_delay_systemauthac" />
    <ind:state state_ref="state_accounts_fail_delay_systemauthac" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_accounts_fail_delay_systemauthac" version="1">
    <ind:filepath>/etc/pam.d/system-auth-ac</ind:filepath>
    <ind:pattern operation="pattern match">^auth[\s]+[a-z]+[\s]+(?:/lib/security/(?:\$ISA/)*)*pam_faildelay.so[\s]+delay=([0-9]+).*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_accounts_fail_delay_systemauthac" version="1">
    <ind:subexpression operation="greater than or equal" datatype="int">4000000</ind:subexpression>
  </ind:textfilecontent54_state>

   <ind:textfilecontent54_test check="all" check_existence="none_exist" comment="pam_faildelay.so is not included in /lib/security/*" id="test_pam_faildelay_not_included" version="1">
    <ind:object object_ref="object_pam_faildelay_not_included" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="object_pam_faildelay_not_included" version="1">
    <ind:path>/lib/security</ind:path>
    <ind:filename operation="pattern match">.*</ind:filename>
    <ind:pattern operation="pattern match">.*(pam_faildelay.so)</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>
 
</def-group>
