mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Give warning if user inputs not encrypted password to user module (#43615)
* Check the password format Check the password format and notify user if they input unencrypted password. * Fix sanity error * Add integration test * Missed a task name * Hard code the testing password Since some testing platfrom has no passlib installed * Add changelog fragment * Rework some English sentences * Fix a grammar mistake
This commit is contained in:
parent
cceddfab9b
commit
b20d903cc4
3 changed files with 79 additions and 0 deletions
|
@ -64,6 +64,46 @@
|
|||
- user_test0_1 is not changed
|
||||
- '"ansibulluser" in user_names.stdout_lines'
|
||||
|
||||
# test user add with password
|
||||
- name: add an encrypted password for user
|
||||
user:
|
||||
name: ansibulluser
|
||||
password: "$6$rounds=656000$TT4O7jz2M57npccl$33LF6FcUMSW11qrESXL1HX0BS.bsiT6aenFLLiVpsQh6hDtI9pJh5iY7x8J7ePkN4fP8hmElidHXaeD51pbGS."
|
||||
state: present
|
||||
update_password: always
|
||||
register: test_user_encrypt0
|
||||
|
||||
- name: there should not be warnings
|
||||
assert:
|
||||
that: "'warnings' not in test_user_encrypt0"
|
||||
|
||||
- block:
|
||||
- name: add an plaintext password for user
|
||||
user:
|
||||
name: ansibulluser
|
||||
password: "plaintextpassword"
|
||||
state: present
|
||||
update_password: always
|
||||
register: test_user_encrypt1
|
||||
|
||||
- name: there should be a warning complains that the password is plaintext
|
||||
assert:
|
||||
that: "'warnings' in test_user_encrypt1"
|
||||
|
||||
- name: add an invalid hashed password
|
||||
user:
|
||||
name: ansibulluser
|
||||
password: "$6$rounds=656000$tgK3gYTyRLUmhyv2$lAFrYUQwn7E6VsjPOwQwoSx30lmpiU9r/E0Al7tzKrR9mkodcMEZGe9OXD0H/clOn6qdsUnaL4zefy5fG+++++"
|
||||
state: present
|
||||
update_password: always
|
||||
register: test_user_encrypt2
|
||||
|
||||
- name: there should be a warning complains about the character set of password
|
||||
assert:
|
||||
that: "'warnings' in test_user_encrypt2"
|
||||
when: ansible_system != 'Darwin'
|
||||
|
||||
|
||||
# https://github.com/ansible/ansible/issues/42484
|
||||
# Skipping macOS for now since there is a bug when changing home directory
|
||||
- block:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue