<def-group>
  <definition class="compliance" id="accounts_passwords_pam_faillock_unlock_time" version="2">
    <metadata>
      <title>Lock out account after failed login attempts</title>
      <affected family="unix">
        <platform>multi_platform_rhel</platform>
        <platform>multi_platform_fedora</platform>
      </affected>
      <description>The number of allowed failed logins should be set correctly.</description>
      <reference source="JL" ref_id="RHEL6_20150515" ref_url="test_attestation" />
      <reference source="JL" ref_id="RHEL7_20150515" ref_url="test_attestation" />
      <reference source="JL" ref_id="FEDORA20_20150515" ref_url="test_attestation" />
    </metadata>
    <criteria>
      <criterion comment="preauth default is set to 604800" test_ref="test_accounts_passwords_pam_faillock_unlock_time_system-auth" />
      <criterion comment="authfail default is set to 604800" test_ref="test_accounts_passwords_pam_faillock_authfail_unlock_time_system-auth" />
      <criterion comment="authfail default is set to 604800" test_ref="test_accounts_passwords_pam_faillock_unlock_time_password-auth" />
      <criterion comment="preauth default is set to 604800" test_ref="test_accounts_passwords_pam_faillock_preauth_unlock_time_password-auth" />
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check preauth maximum failed login attempts allowed in /etc/pam.d/system-auth" id="test_accounts_passwords_pam_faillock_unlock_time_system-auth" version="2">
    <ind:object object_ref="object_accounts_passwords_pam_faillock_unlock_time_system-auth" />
    <ind:state state_ref="state_accounts_passwords_pam_faillock_unlock_time_system-auth" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check authfail maximum failed login attempts allowed in /etc/pam.d/system-auth" id="test_accounts_passwords_pam_faillock_authfail_unlock_time_system-auth" version="2">
    <ind:object object_ref="object_accounts_passwords_pam_faillock_authfail_unlock_time_system-auth" />
    <ind:state state_ref="state_accounts_passwords_pam_faillock_unlock_time_system-auth" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check authfail maximum failed login attempts allowed in /etc/pam.d/password-auth" id="test_accounts_passwords_pam_faillock_unlock_time_password-auth" version="2">
    <ind:object object_ref="object_accounts_passwords_pam_faillock_unlock_time_password-auth" />
    <ind:state state_ref="state_accounts_passwords_pam_faillock_unlock_time_password-auth" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="check preauth maximum failed login attempts allowed in /etc/pam.d/password-auth" id="test_accounts_passwords_pam_faillock_preauth_unlock_time_password-auth" version="2">
    <ind:object object_ref="object_accounts_passwords_pam_faillock_preauth_unlock_time_password-auth" />
    <ind:state state_ref="state_accounts_passwords_pam_faillock_unlock_time_password-auth" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="object_accounts_passwords_pam_faillock_unlock_time_system-auth" version="2">
    <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*auth\s+(?:(?:required))\s+pam_faillock\.so\s+preauth.*unlock_time=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_object id="object_accounts_passwords_pam_faillock_authfail_unlock_time_system-auth" version="2">
    <ind:filepath>/etc/pam.d/system-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*auth\s+(?:(?:sufficient)|(?:\[default=die\]))\s+pam_faillock\.so\s+authfail.*unlock_time=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_object id="object_accounts_passwords_pam_faillock_unlock_time_password-auth" version="2">
    <ind:filepath>/etc/pam.d/password-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*auth\s+(?:(?:sufficient)|(?:\[default=die\]))\s+pam_faillock\.so\s+authfail.*unlock_time=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_object id="object_accounts_passwords_pam_faillock_preauth_unlock_time_password-auth" version="2">
    <ind:filepath>/etc/pam.d/password-auth</ind:filepath>
    <ind:pattern operation="pattern match">^\s*auth\s+(?:(?:required))\s+pam_faillock\.so\s+preauth.*unlock_time=([0-9]*).*$</ind:pattern>
    <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_state id="state_accounts_passwords_pam_faillock_unlock_time_system-auth" version="2">
    <ind:subexpression datatype="int" operation="equals" var_ref="var_accounts_passwords_pam_faillock_unlock_time" />
  </ind:textfilecontent54_state>

  <ind:textfilecontent54_state id="state_accounts_passwords_pam_faillock_unlock_time_password-auth" version="2">
    <ind:subexpression datatype="int" operation="equals" var_ref="var_accounts_passwords_pam_faillock_unlock_time" />
  </ind:textfilecontent54_state>

  <external_variable comment="number of failed login attempts allowed" datatype="int" id="var_accounts_passwords_pam_faillock_unlock_time" version="2" />
</def-group>
