Chapter 42. Defining IdM Password Policies
This chapter describes Identity Management (IdM) password policies and how to add a new password policy in IdM using an Ansible playbook.
42.1. What is a password policy
A password policy is a set of rules that passwords must meet. For example, a password policy can define the minimum password length and the maximum password lifetime. All users affected by this policy are required to set a sufficiently long password and change it frequently enough to meet the specified conditions. In this way, password policies help reduce the risk of someone discovering and misusing a user’s password.
42.2. Password policies in IdM
Passwords are the most common way for Identity Management (IdM) users to authenticate to the IdM Kerberos domain. Password policies define the requirements that these IdM user passwords must meet.
The IdM password policy is set in the underlying LDAP directory, but the Kerberos Key Distribution Center (KDC) enforces the password policy.
Password policy attributes lists the attributes you can use to define a password policy in IdM.
Table 42.1. Password Policy Attributes
The maximum amount of time in days that a password is valid before a user must reset it.
Max lifetime = 90
User passwords are valid only for 90 days. After that, IdM prompts users to change them.
The minimum amount of time in hours that must pass between two password change operations.
Min lifetime = 1
After users change their passwords, they must wait at least 1 hour before changing them again.
The number of previous passwords that are stored. A user cannot reuse a password from their password history but can reuse old passwords that are not stored.
History size = 0
In this case, the password history is empty and users can reuse any of their previous passwords.
The number of different character classes the user must use in the password. The character classes are:
* Uppercase characters
* Lowercase characters
* Special characters, such as comma (,), period (.), asterisk (*)
* Other UTF-8 characters
Using a character three or more times in a row decreases the character class by one. For example:
Character classes = 0
The default number of classes required is 0. To configure the number, run the
See also the Important note below this table.
The minimum number of characters in a password.
Min length = 8
Users cannot use passwords shorter than 8 characters.
The maximum number of failed login attempts before IdM locks the user account.
Max failures = 6
IdM locks the user account when the user enters a wrong password 7 times in a row.
Failure reset interval
The amount of time in seconds after which IdM resets the current number of failed login attempts.
Failure reset interval = 60
If the user waits for more than 1 minute after the number of failed login attempts defined in
The amount of time in seconds that the user account is locked after the number of failed login attempts defined in
Lockout duration = 600
Users with locked accounts are unable to log in for 10 minutes.
Use the English alphabet and common symbols for the character classes requirement if you have a diverse set of hardware that may not have access to international characters and symbols. For more information about character class policies in passwords, see What characters are valid in a password? in Red Hat Knowledgebase.
42.3. Ensuring the presence of a password policy in IdM using an Ansible playbook
This section describes how to ensure the presence of a password policy in Identity Management (IdM) using an Ansible playbook.
In the default
global_policy password policy in IdM, the number of different character classes in the password is set to 0. The history size is also set to 0.
Complete this procedure to enforce a stronger password policy for an IdM group using an Ansible playbook.
You can only define a password policy for an IdM group. You cannot define a password policy for an individual user.
- You have installed the ansible-freeipa package on the Ansible controller.
- You know the IdM administrator password.
- The group for which you are ensuring the presence of a password policy exists in IdM.
Create an inventory file, for example
inventory.file, and define the
FQDNof your IdM server in the
Create your Ansible playbook file that defines the password policy whose presence you want to ensure. To simplify this step, copy and modify the example in the
--- - name: Tests hosts: ipaserver become: true tasks: - name: Ensure presence of pwpolicy for group ops ipapwpolicy: ipaadmin_password: MySecret123 name: ops minlife: 7 maxlife: 49 history: 5 priority: 1 lockouttime: 300 minlength: 8 minclasses: 4 maxfail: 3 failinterval: 5
For details on what the individual variables mean, see Password policy attributes.
Run the playbook:
$ ansible-playbook -v -i path_to_inventory_directory/inventory.file path_to_playbooks_directory_/new_pwpolicy_present.yml
You have successfully used an Ansible playbook to ensure that a password policy for the ops group is present in IdM.
The priority of the ops password policy is set to 1, whereas the global_policy password policy has no priority set. For this reason, the ops policy automatically supersedes global_policy for the ops group and is enforced immediately.
global_policy serves as a fallback policy when no group policy is set for a user, and it can never take precedence over a group policy.
For more details about using Ansible to define password policies in IdM and about playbook variables, see the README-pwpolicy.md Markdown file available in the
- For more details about how password policy priorities work in IdM, see Password policy priorities in RHEL 7 documentation.