ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
784 stars 1.45k forks source link

Adding the gopass features "support for binary files" community.general.passwordstore lookup #7621

Open DO1JLR opened 7 months ago

DO1JLR commented 7 months ago

Summary

community.general.passwordstore is a great lookup plugin. But there are some gopass features like binary file support that I would like to see in it.

For example gopass can copy binary files using the "fscopy" command. See https://github.com/gopasspw/gopass/blob/master/docs/features.md#support-for-binary-content This saves a file as a Base64-encoded, GPG-encrypted file. I don't currently see a way to use this in the current version of the passwordstore plugin.

Gopass example ```bash gopass show test/hello_World.txt Secret: test/hello_World.txt Content-Disposition: attachment; filename="hello_World.txt" Content-Transfer-Encoding: Base64 TG9yZW0gSXBzdW0KZXRjLi4uCg== ```

It could be very useful, for example, to deploy certificates directly from the gopass password manager using ansible.

Issue Type

Feature Idea

Component Name

passwordstore

Additional Information

- name: Copy a binary file from gopass to filesystem, using pass ans inline content (example)           
  ansible.builtin.copy:
    content: "{{ lookup('community.general.passwordstore', 'test/image.png', binary=true)}}"
    dest: '/media/image.png'
    mode: '0644'

Example Binary File in Gopass:

 $ gopass show test/image.png
Secret: test/image.png

Content-Disposition: attachment; filename="image.png"
Content-Transfer-Encoding: Base64
iVBORw0KGgoAAAANSUhEUgAAABEAAAAOCAMAAAD+MweGAAADAFBMVEUAAAAAAFUAAKoAAP8AJAAAJFUAJKoAJP8ASQAASVUASaoASf8AbQAAbVUAbaoAbf8AkgAAklUAkqoAkv8AtgAAtlUAtqoAtv8A2wAA21UA26oA2/8A/wAA/1UA/6oA//8kAAAkAFUkAKokAP8kJAAkJFUkJKokJP8kSQAkSVUkSaokSf8kbQAkbVUkbaokbf8kkgAkklUkkqokkv8ktgAktlUktqoktv8k2wAk21Uk26ok2/8k/wAk/1Uk/6ok//9JAABJAFVJAKpJAP9JJABJJFVJJKpJJP9JSQBJSVVJSapJSf9JbQBJbVVJbapJbf9JkgBJklVJkqpJkv9JtgBJtlVJtqpJtv9J2wBJ21VJ26pJ2/9J/wBJ/1VJ/6pJ//9tAABtAFVtAKptAP9tJABtJFVtJKptJP9tSQBtSVVtSaptSf9tbQBtbVVtbaptbf9tkgBtklVtkqptkv9ttgBttlVttqpttv9t2wBt21Vt26pt2/9t/wBt/1Vt/6pt//+SAACSAFWSAKqSAP+SJACSJFWSJKqSJP+SSQCSSVWSSaqSSf+SbQCSbVWSbaqSbf+SkgCSklWSkqqSkv+StgCStlWStqqStv+S2wCS21WS26qS2/+S/wCS/1WS/6qS//+2AAC2AFW2AKq2AP+2JAC2JFW2JKq2JP+2SQC2SVW2Saq2Sf+2bQC2bVW2baq2bf+2kgC2klW2kqq2kv+2tgC2tlW2tqq2tv+22wC221W226q22/+2/wC2/1W2/6q2///bAADbAFXbAKrbAP/bJADbJFXbJKrbJP/bSQDbSVXbSarbSf/bbQDbbVXbbarbbf/bkgDbklXbkqrbkv/btgDbtlXbtqrbtv/b2wDb21Xb26rb2//b/wDb/1Xb/6rb////AAD/AFX/AKr/AP//JAD/JFX/JKr/JP//SQD/SVX/Sar/Sf//bQD/bVX/bar/bf//kgD/klX/kqr/kv//tgD/tlX/tqr/tv//2wD/21X/26r/2////wD//1X//6r////qm24uAAAA1ElEQVR42h1PMW4CQQwc73mlFJGCQChFIp0Rh0RBGV5AFUXKC/KPfCFdqryEgoJ8IX0KEF64q0PPnow3jT2WxzNj+gAgAGfvvDdCQIHoSnGYcGDE2nH92DoRqTYJ2bTcsKgqhIi47VdgAWNmwFSFA1UAAT2sSFcnq8a3x/zkkJrhaHT3N+hD3aH7ZuabGHX7bsSMhxwTJLr3evf1e0nBVcwmqcTZuatKoJaB7dSHjTZdM0G1HBTWefly//q2EB7/BEvk5vmzeQaJ7/xKPImpzv8/s4grhAxHl0DsqGUAAAAASUVORK5CYII=

In this case the lookup plugin would have to use the equivalent of "gopass cat test/image.png" instead of "gopass show test/image.png"...

Note: The binary option does not exist yet. It is just an example of a feature that will hopefully exist soon!

Code of Conduct

ansibullbot commented 7 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help