1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/lib/ansible/plugins/lookup
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.
2018-08-27 08:40:41 -07:00
..
__init__.py Better error message when file lookup fails (#30894) 2018-01-23 10:48:35 -06:00
_openshift.py K8s dynamic collected changes (#40745) 2018-05-30 12:04:48 -05:00
_redis_kv.py doc fix 2018-06-21 16:30:33 -04:00
aws_account_attribute.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
aws_service_ip_ranges.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
aws_ssm.py Documentation fix, decrypt is True by default (#44435) 2018-08-21 09:21:25 -07:00
cartesian.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
chef_databag.py Add yamllint for plugin docs and fix issues. 2018-05-23 09:19:30 -07:00
config.py Add yamllint for plugin docs and fix issues. 2018-05-23 09:19:30 -07:00
conjur_variable.py Add yamllint for plugin docs and fix issues. 2018-05-23 09:19:30 -07:00
consul_kv.py Remove use of simplejson throughout code base (#43548) 2018-08-10 11:13:29 -05:00
cpm_status.py Add module cpm_status for WTI device management (#42970) 2018-08-20 21:56:06 -04:00
credstash.py fixed credstash docs 2017-09-20 20:52:52 -04:00
csvfile.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
cyberarkpassword.py cyberarkpassword: Display.vvvv expects a string (#40335) 2018-05-25 08:11:26 +02:00
dict.py Add example of using loop: with when: statements (#42776) 2018-07-19 13:48:08 +10:00
dig.py removed typo from dig docs 2017-09-29 11:23:58 -04:00
dnstxt.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
env.py Fix env lookup plugin docs (#34235) 2017-12-26 05:20:33 -05:00
etcd.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
file.py add rstrip and lstrip bool flags to file lookup plugin (#31738) 2018-01-23 10:14:19 -06:00
fileglob.py Updates to fileglob Documentation (#40461) 2018-05-24 11:59:42 +10:00
filetree.py Windows: Clean up documentation (#36684) 2018-02-25 03:09:54 +01:00
first_found.py first_found: fix examples to match the code (#40821) 2018-06-06 12:45:30 +02:00
flattened.py flattened: doc: Typo in lookup example (#38006) 2018-03-28 08:25:40 +02:00
grafana_dashboard.py Add new grafana dashboard lookup plugin (#41319) 2018-07-23 11:11:42 -04:00
hashi_vault.py Update my own author email in comments block 2018-06-18 16:15:31 -04:00
hiera.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
indexed_items.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
ini.py Udate ini.py with corrected intended use (#42232) 2018-07-03 08:48:43 -04:00
inventory_hostnames.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
items.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
k8s.py K8s dynamic collected changes (#40745) 2018-05-30 12:04:48 -05:00
keyring.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
lastpass.py lastpass filter: add example 2018-04-09 14:20:21 -04:00
lines.py fix plugin-to-doc naming mismatch, typos, grammar (#36366) 2018-02-26 14:25:28 -08:00
list.py Handle incorrect data type in list lookup plugin (#35483) 2018-05-17 15:29:36 -05:00
mongodb.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
nested.py Add yamllint for plugin docs and fix issues. 2018-05-23 09:19:30 -07:00
nios.py infoblox list requirements as infoblox_client and should be infoblox-client (#42993) 2018-07-19 12:19:46 -04:00
nios_next_ip.py Added Support for excluding IPs in nios_next_ip and created new pluggin for nios_next_network (#44437) 2018-08-23 03:08:39 +00:00
nios_next_network.py Added Support for excluding IPs in nios_next_ip and created new pluggin for nios_next_network (#44437) 2018-08-23 03:08:39 +00:00
onepassword.py 1Password lookup plugin (#37207) 2018-05-17 17:29:47 -04:00
onepassword_raw.py 1Password lookup plugin (#37207) 2018-05-17 17:29:47 -04:00
password.py Share the implementation of hashing for both vars_prompt and password_hash (#21215) 2018-08-27 08:40:41 -07:00
passwordstore.py Add backup option to passwordstore lookup (and improve doc) (#39676) 2018-06-08 10:33:53 -04:00
pipe.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
random_choice.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
redis.py Fix spelling of "lookup" across docs and src comments 2018-04-04 15:52:55 +02:00
sequence.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
shelvefile.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
subelements.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
template.py Lookup docs (#30280) 2017-09-19 10:49:07 -04:00
together.py plugins: Doc improvement (#41378) 2018-06-13 11:52:42 +05:30
url.py moved to use 'get_option' 2018-07-13 11:41:04 -04:00
vars.py fix vars hostname fallback 2018-06-22 15:29:40 -04:00