randomly generated passwords must obey some constraints

The password constraints of security.py require at least one digit,
one lower case, one upper case and one special character.

https://github.com/wazuh/wazuh/blob/master/framework/wazuh/security.py#L22

Fixes: https://github.com/wazuh/wazuh-ansible/issues/518
This commit is contained in:
singuliere 2020-12-11 13:26:20 +01:00
parent fc67b96b63
commit 0440e5dce9
No known key found for this signature in database
GPG Key ID: 900857755EF189C2

View File

@ -69,13 +69,20 @@ if __name__ == "__main__":
# set a random password for all other users # set a random password for all other users
for name, id in initial_users.items(): for name, id in initial_users.items():
if name != username: if name != username:
specials = "@$!%*?&-_"
random_pass = "".join( random_pass = "".join(
[
random.choice(string.ascii_uppercase),
random.choice(string.ascii_lowercase),
random.choice(string.digits),
random.choice(specials),
] +
random.choices( random.choices(
string.ascii_uppercase string.ascii_uppercase
+ string.ascii_lowercase + string.ascii_lowercase
+ string.digits + string.digits
+ "@$!%*?&-_", + specials,
k=16, k=14,
) )
) )
update_user( update_user(