c0sco / ansible-modules-bitwarden

Bitwarden integrations for Ansible
GNU General Public License v3.0
109 stars 45 forks source link

Feature request: Automatically generate new passwords if an entry doesn't exist #3

Open nogweii opened 5 years ago

nogweii commented 5 years ago

A new option to create a random password and an associated entry if it doesn't exist. Much like the password lookup plugin in core ansible.

c0sco commented 5 years ago

Thanks for the idea. I think having some functionality around using the bw generate command would be interesting. One thing I wonder about is how to specify the parameters to the generate command. I think we could specify some sane defaults, but in the case where someone needed to override them (changing the length, char set, etc.), I'm not sure how that would look. Any ideas or PRs are most certainly welcome.

MegaphoneJon commented 5 years ago

The pass lookup module supports this feature. It does a pretty good job of specifying length, char set, etc.: https://docs.ansible.com/ansible/latest/plugins/lookup/passwordstore.html.

Note that the char set support isn't as flexible as pass or bw allows, which is perhaps acceptable for improved UX. However, I wrote an alternate implementation to specify char set (https://github.com/ansible/ansible/pull/44541), which would allow using bw generate as flexibly as the CLI itself does. I think both approaches have merit.

danielo515 commented 4 years ago

I think that just providing a function to store a generated password may be enough? Then you generate it with whathever method you want (ansible built-in password generator, openssh, /dev/random) and save it to bitwarden?