Skip to content

passwordstore lookup plugin gopass compatibility #4766

@stephan-devop

Description

@stephan-devop

Summary

The passwordstore lookup plugin uses the binary pass. The plugin used to work fine with the gopass drop-in replacement using a small wrapper script. But sadly, that does not work anymore.

The reason is that the passwordstore plugin checks the internal pass configuration. It checks for the ~/.password-store directory and the .gpg file at a location where pass would store it. If either fails the plugin throws an error.

For me, the main advantage of gopass over pass is the mounts feature which allows multiple password stores at arbitrary paths. They happen to be stored somewhere completely different than pass would store them but the interface to retrieve them is the same. I think that it's not a good idea if the passwordstore lookup plugin verifies the backend's configuration. It should rely on the pass interface instead.

I've tried to understand why the passwordstore plugin checks for the directory and the gpg file and I have two questions:

Why is there an else which kicks in if the passwordstore directory does not exist? Isn't this handled by pass?

Then there is a comment I do not understand:

# Only accept password as found, if there a .gpg file for it (might be a tree node otherwise)

What kind of tree node is this? This looks suspiciously like a workaround for some pass bug which should be fixed upstream.

For the time being, I've implemented a workaround for our (virtual) development environment by applying a simple patch which removes both checks. Of course, this is hardly a general solution, as those checks probably exist for a reason. Could someone please tell me for which reason?

Issue Type

Bug Report

Component Name

passwordstore lookup plugin

Ansible Version

$ ansible --version
ansible [core 2.12.6]
  config file = None
  configured module search path = ['/Users/tovenaar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /Users/tovenaar/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 4.8.1

Configuration

$ ansible-config dump --only-changed

OS / Environment

Debian GNU/Linux 11 (bullseye), cf. takelage-dev

Steps to Reproduce

Use gopass as backend instead of pass.

Expected Results

gopass should work as a passwordstore lookup plugin backend as its interface is the same as the pass interface.

Actual Results

The passwordstore lookup plugin complains about the missing pass configuration directory and missing gpg files.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bughas_pr

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions