Chapter 21. Using Ansible to configure a system account in IdM to change user passwords without requiring a reset


Use Ansible to configure an Identity Management (IdM) system account so an external credential-management system can set user passwords without forcing a reset on first login. You keep IdM password policy enforcement while integrating with external services.

By default, when an IdM administrator resets an IdM user’s password, the password expires after the first successful login. However, when integrating your IdM deployment with external credential-management systems to take care of password storage, you may want to ensure that the passwords set by this external system do not expire when used for the first time, as this could be inconvenient for end users. At the same time, bypassing the IdM password policy would introduce a security risk, so keeping password strength and history checks in place on the IdM side is important.

To support this scenario, a system accounts interface is available in ansible-freeipa starting with RHEL 10.2. The sysaccount module allows you, for example, to delegate the security of managing highly privileged IdM accounts, that is those that possess administrative privileges, to this dedicated, external service, thereby meeting your compliance requirements.

21.1. System accounts in Identity Management

Learn how system accounts enable automation and third-party integration while keeping your human administrator credentials safe and your audit logs clean.

System accounts, also known as service accounts, are non-human identities that applications, services, or automation tools use to interact with the Identity Management (IdM) directory. Their primary purpose is to provide a secure, trackable, and manageable way for software to perform tasks without using a human administrator’s credentials.

The primary purposes of system accounts include the following:

Programmatic LDAP access (the bind account)
Many applications, such as a legacy wiki, or a human resources portal, must connect to IdM to verify if a user exists or to retrieve their group memberships. The application uses a system account to perform an LDAP bind. This enables the application to search the directory without requiring a human to log in first. To improve security, restrict the application to read-only access to specific parts of the directory.
Password synchronization (integration with Active Directory)
System accounts act as the bridge in synchronization workflows. When integrating with Active Directory (AD) through WinSync, the Windows-side service uses a system account, for example, cn=ad_sync,cn=sysaccounts,cn=etc, to authenticate to IdM and push password updates. This integration enables the external service to bypass standard user password policies, such as the requirement to change the password on the first login.
Automation and DevOps (CI/CD)
Modern infrastructure as code (IaC) tools, such as Ansible, must often modify the IdM environment. For example, these tools can automatically add a new virtual machine to the domain or create a DNS record. Instead of hard-coding an administrator’s password into a script, you can create a system account with limited privileges. If the script is compromised, the attacker gains only the limited rights assigned to that specific system account, rather than full domain administrator rights.
Expand
Table 21.1. Differences between standard user accounts and system accounts
FeatureStandard user accountSystem account (sysaccount)

Location

cn=users,cn=accounts

cn=sysaccounts,cn=etc

Interactive login

Yes (SSH, web UI, desktop)

No (LDAP bind only)

Password expiry

Subject to global policy

Usually set to never expire

Kerberos support

Full support

None

Default object classes

top, person, posixAccount, inetOrgPerson, inetuser, organizationalPerson, ipaUser, ipaSshUser, posixAccount, krbprincipalaux, krbticketpolicyaux, ipaobject, mepOriginEntry

top, account, simpleSecurityObject

Learn how Identity Management (IdM) uses SysAcctManagersDNs with the ipa_pwd_extop plugin so that trusted system accounts can update user passwords without a forced reset while password policy is still enforced.

Starting with RHEL 10.2, IdM can configure trusted exceptions for automated system accounts by using two components:

  • The ipa_pwd_extop plugin: A plugin that handles password change requests.
  • The SysAcctManagersDNs list: A configuration attribute where you specify the distinguished names (DNs) of automated system accounts that are allowed to change a password without enforcing a reset.

When a password change request arrives, the ipa_pwd_extop plugin verifies if the requesting account is in the SysAcctManagersDNs list:

  • If the account is not in the list, the plugin treats the request as a standard administrator reset. The user must change their password at the next login.
  • If the account is in the list, the plugin verifies that the new password complies with the password policies defined for the user, such as length and complexity requirements, and updates the password. It does not force the user to change it.

    NOTE
    These configurations are server-specific: the LDAP entry cn=ipa_pwd_extop,cn=plugins,cn=config is not replicated. If you need multiple servers to allow password modifications without triggering a reset, you must update the configuration on each server individually. System accounts, on the other hand, are replicated.

Configure an Identity Management (IdM) system account with the correct privilege and role using Ansible, so that an external credential-management system can set user passwords without requiring a reset on first login.

In the example below, you use modules from the ansible-freeipa package to create the following:

  • A system account named my-app.
  • A privilege named my-app password change privilege with the System: Change User password permission.
  • A role named my-app role that grants the privilege to the system account.

Optionally, you configure the system account so that passwords it sets do not expire on first login.

Prerequisites

  • You are a member of a role that has the System Accounts Administrators privilege, for example admin.
  • You have configured your Ansible control node to meet the following requirements:

    • You are using Ansible version 2.15 or later.
    • You have installed the ansible-freeipa package.
    • The example assumes that in the ~/MyPlaybooks/ directory, you have created an Ansible inventory file with the fully-qualified domain name (FQDN) of the IdM server.
    • The example assumes that the secret.yml Ansible vault stores your ipaadmin_password and that you have access to a file that stores the password protecting the secret.yml file.
  • The target node, that is the node on which the freeipa.ansible_freeipa module is executed, is part of the IdM domain as an IdM client, server or replica.

Procedure

  1. Navigate to the ~/MyPlaybooks/ directory:

    $ cd ~/MyPlaybooks/
  2. Create a configure-system-account-to-change-user-passwords.yml playbook with the following content:

    ---
    - name: Configure a system account in IdM to change user passwords without requiring a reset
      hosts: ipaserver
      become: false
      gather_facts: false
    
      vars_files:
      - /home/user_name/MyPlaybooks/secret.yml
      tasks:
      - name: Ensure sysaccount my-app is present with a random password
        freeipa.ansible_freeipa.ipasysaccount:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: my-app
          random: true
        register: sysaccount_result
    
      - name: Print the generated random password
        ansible.builtin.debug:
          var: sysaccount_result.sysaccount.randompassword
    
      - name: Ensure privilege my-app password change privilege is present with the password change permission
        freeipa.ansible_freeipa.ipaprivilege:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: my-app password change privilege
          permission:
          - "System: Change User password"
    
      - name: Ensure role my-app role is present with the privilege and system account as member
        freeipa.ansible_freeipa.iparole:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: my-app role
          privilege:
          - my-app password change privilege
          sysaccount:
          - my-app
    
      - name: Ensure sysaccount my-app can change passwords without requiring a reset
        freeipa.ansible_freeipa.ipasysaccount:
          ipaadmin_password: "{{ ipaadmin_password }}"
          name: my-app
          privileged: true
  3. Save the file.

    For details about variables and example playbooks in the FreeIPA Ansible collection, see the /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-sysaccount.md and /usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-role.md files on the control node.

  4. Run the playbook:

    $ ansible-playbook --vault-password-file=password_file -v -i inventory configure-system-account-to-change-user-passwords.yml

Verification

  1. Verify that the system account exists and is configured as privileged:

    $ ipa sysaccount-show my-app
      System account login: my-app
      Privileged: True
  2. Verify that the role has the correct privilege and system account member:

    $ ipa role-show 'my-app role'
      Role name: my-app role
      Privileges: my-app password change privilege
      System accounts: my-app
  3. Using your external credential-management system, change an IdM user’s password.
  4. Log in to IdM as the IdM user:

    $ kinit idmuser
  5. When prompted, enter the new password:

    idmuser's password:
  6. Verify that you have idmuser's Kerberos ticket-granting ticket:

    $ klist
    Credentials cache: API:0A481BBD-C3AA-473D-B43A-42CD19C7F045
            Principal: idmuser@IDM.EXAMPLE.COM
    
      Issued                Expires               Principal
    Feb 23 16:06:56 2026  Feb 24 02:04:54 2026  krbtgt/IDM.EXAMPLE.COM@IDM.EXAMPLE.COM

    The output confirms that you have a valid Kerberos ticket. You were able to log in without having to reset idmuser's password.

Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top