You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/units
Matthias Fuchs 7871027c9d Share the implementation of hashing for both vars_prompt and password_hash (#21215)
* Share the implementation of hashing for both vars_prompt and password_hash.
* vars_prompt with encrypt does not require passlib for the algorithms
  supported by crypt.
* Additional checks ensure that there is always a result.
  This works around issues in the crypt.crypt python function that returns
  None for algorithms it does not know.
  Some modules (like user module) interprets None as no password at all,
  which is misleading.
* The password_hash filter supports all parameters of passlib.
  This allows users to provide a rounds parameter, fixing #15326.
* password_hash is not restricted to the subset provided by crypt.crypt,
  fixing one half of #17266.
* Updated documentation fixes other half of #17266.
* password_hash does not hard-code the salt-length, which fixes bcrypt
  in connection with passlib.
  bcrypt requires a salt with length 22, which fixes #25347
* Salts are only generated by ansible when using crypt.crypt.
  Otherwise passlib generates them.
* Avoids deprecated functionality of passlib with newer library versions.
* When no rounds are specified for sha256/sha256_crypt and sha512/sha512_crypt
  always uses the default values used by crypt, i.e. 5000 rounds.
  Before when installed passlibs' defaults were used.
  passlib changes its defaults with newer library versions, leading to non
  idempotent behavior.

  NOTE: This will lead to the recalculation of existing hashes generated
        with passlib and without a rounds parameter.
        Yet henceforth the hashes will remain the same.
        No matter the installed passlib version.
        Making these hashes idempotent.

Fixes #15326
Fixes #17266
Fixes #25347 except bcrypt still uses 2a, instead of the suggested 2b.

* random_salt is solely handled by encrypt.py.
  There is no _random_salt function there anymore.
  Also the test moved to test_encrypt.py.
* Uses pytest.skip when passlib is not available, instead of a silent return.
* More checks are executed when passlib is not available.

* Moves tests that require passlib into their own test-function.

* Uses the six library to reraise the exception.

* Fixes integration test.

When no rounds are provided the defaults of crypt are used.
In that case the rounds are not part of the resulting MCF output.
6 years ago
..
cli Add APB role_type to ansible-galaxy init (#36789) 7 years ago
config Fix another corner case of too many warnings for world readable current working directory 6 years ago
contrib Update vmware_inventory (#26308) 7 years ago
errors test/: PEP8 compliancy (#24803) 8 years ago
executor Fix unittests for always adding basic to the AnsiBallZ zips 6 years ago
inventory_test_data/group_vars Merge branch 'v2_final' into devel_switch_v2 10 years ago
mock AnsiballZ improvements 6 years ago
module_utils new nos_command module (#43056) 6 years ago
modules adds the bigip_cli_script module (#44674) 6 years ago
parsing Mass nuke deprecated items that are easily removed. ci_complete (#44320) 6 years ago
playbook Unit tests for ansible.playbook.become (#38541) 6 years ago
plugins Share the implementation of hashing for both vars_prompt and password_hash (#21215) 6 years ago
template Remove bare_deprecated functionality (#44517) 6 years ago
utils Share the implementation of hashing for both vars_prompt and password_hash (#21215) 6 years ago
vars Don't use copy.deepcopy in high workload areas, use naive_deepcopy (#44337) 6 years ago
__init__.py Add empty-init code-smell script. (#18406) 8 years ago
ansible.cfg Fix ansible-test config management. 7 years ago
conftest.py Fix bugs in ansible-test units command. (#24044) 8 years ago
test_constants.py 1st part of ansible config, adds ansible-config to view/manage configs (#12797) 8 years ago