From d52364bac923f2935b948882d5825e7488b0e9cf Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Fri, 31 Jul 2020 11:32:36 -0300 Subject: [PATCH] Fix random salt generation. The generation of a random salt, when one was not provided, was in the wrong place and being generated too late to be used properly. Also, the generation of the value was duplicated. --- plugins/modules/ipavault.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/modules/ipavault.py b/plugins/modules/ipavault.py index 8562ff72..dffd9722 100644 --- a/plugins/modules/ipavault.py +++ b/plugins/modules/ipavault.py @@ -768,7 +768,12 @@ def main(): commands.append([name, "vault_mod_internal", args]) else: + if vault_type == 'symmetric' \ + and 'ipavaultsalt' not in args: + args['ipavaultsalt'] = os.urandom(32) + commands.append([name, "vault_add_internal", args]) + if vault_type != 'standard' and vault_data is None: vault_data = '' @@ -826,14 +831,6 @@ def main(): commands.append( [name, 'vault_remove_owner', owner_del_args]) - if vault_type == 'symmetric' \ - and 'ipavaultsalt' not in args: - args['ipavaultsalt'] = os.urandom(32) - - if vault_type == 'symmetric' \ - and 'ipavaultsalt' not in args: - args['ipavaultsalt'] = os.urandom(32) - elif action in "member": # Add users and groups if any([users, groups, services]): -- GitLab