From 8c191ddf6d75090c80f567dd665bdacc44ef8883 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Mar 25 2020 09:11:48 +0000 Subject: ipatests: allow changing sysaccount passwords as cn=Directory Manager Extend ldappasswd_sysaccount_change() helper to allow changing passwords as a cn=Directory Manager. Related to: https://pagure.io/freeipa/issue/7181 Signed-off-by: Alexander Bokovoy 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 3b12311..e2f457b 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -1780,15 +1780,23 @@ def ldappasswd_user_change(user, oldpw, newpw, master): master.run_command(args) -def ldappasswd_sysaccount_change(user, oldpw, newpw, master): +def ldappasswd_sysaccount_change(user, oldpw, newpw, master, use_dirman=False): container_sysaccounts = dict(DEFAULT_CONFIG)['container_sysaccounts'] basedn = master.domain.basedn userdn = "uid={},{},{}".format(user, container_sysaccounts, 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, + '-a', oldpw, + '-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)