From ff6984e2eea0f54851db796c8b3ad29c54a4e325 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mar 25 2020 09:11:48 +0000 Subject: Add ability to change a user password as the Directory Manager This is to confirm that the Directory Manager is not affected by password policy. Reviewed-By: Alexander Bokovoy Reviewed-By: Christian Heimes --- diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py index e2f457b..c061a2a 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -1768,15 +1768,21 @@ def get_host_ip_with_hostmask(host): return None -def ldappasswd_user_change(user, oldpw, newpw, master): +def ldappasswd_user_change(user, oldpw, newpw, master, use_dirman=False): container_user = dict(DEFAULT_CONFIG)['container_user'] basedn = master.domain.basedn userdn = "uid={},{},{}".format(user, container_user, basedn) master_ldap_uri = "ldap://{}".format(master.hostname) - args = [paths.LDAPPASSWD, '-D', userdn, '-w', oldpw, '-a', oldpw, - '-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri] + if use_dirman: + args = [paths.LDAPPASSWD, '-D', + str(master.config.dirman_dn), # pylint: disable=no-member + '-w', master.config.dirman_password, + '-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri, userdn] + else: + args = [paths.LDAPPASSWD, '-D', userdn, '-w', oldpw, '-a', oldpw, + '-s', newpw, '-x', '-ZZ', '-H', master_ldap_uri] master.run_command(args)