mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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 <abokovoy@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
38204856fd
commit
8c191ddf6d
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user