Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: declarative file processing #1913

Closed
thomas-mc-work opened this issue Apr 25, 2021 · 8 comments · Fixed by #2066
Closed

Feature: declarative file processing #1913

thomas-mc-work opened this issue Apr 25, 2021 · 8 comments · Fixed by #2066
Assignees
Labels
feature Enhancements and new features help-wanted
Milestone

Comments

@thomas-mc-work
Copy link

thomas-mc-work commented Apr 25, 2021

Summary

I'd love to be able to substitute key references in a template file using gopass.

Steps To Reproduce

You have a file like this local config file for mysql (.mylogin.cnf):

[client]
host=127.0.0.1
port=3306
user={{ server/local/mysql:username }}
password={{ server/local/mysql:password }}

Gopass of course needs to have these values within it's database:

gopass> ls
gopass
└── server/
    └── local/
        └── mysql

Next I would process the file like this: gopass process mysql.conf. The output is then printed to stdout and would look like this:

[client]
host=127.0.0.1
port=3306
user=root
password=123456

This concept would allow me to share configuration file formats to others without exposing any secrets. Also it would be possible to add such files to a git repository and allow every user to resolve the values programmatically.

@thomas-mc-work
Copy link
Author

The template syntax ({{ + }}) is just an example. Here everything else can be used that go provides.

@dominikschulz dominikschulz added feature Enhancements and new features help-wanted labels May 1, 2021
@dominikschulz dominikschulz added this to the 1.x.x milestone May 1, 2021
@dominikschulz
Copy link
Member

I'm not sure if I understand what exactly you're asking for.

We already have two simliar features:

  • gopass env that invokes a subcommand with a pre-populated env, with a small helper script that could do what you want already.
  • Then there are gopass templates for new secrets.

Can you provide a little more context how this feature would be used and if you did consider these alternatives/why they don't work?

@thomas-mc-work
Copy link
Author

thomas-mc-work commented May 4, 2021

It's not the gopass templates for new secrets. gopass env is similar, but rather decoupled and imperative. I'm looking for the declarative solution. Gopass shall resolve the declarations in the file.

From my example above: Given a simple gopass show -o server/local would return 123456 on the CLI and gopass show server/local login results in root. The goal is to have gopass resolve my declarations from a source file and write the generated output to stdout.

Does that help?

@thomas-mc-work
Copy link
Author

Regarding the context: I'm writing configuration files that shall be reused within the IT of organizations. The files can contain secrets. And instead of sharing or checking in the resulting file with the secrets, I'd like to share the template file which can be resolved by everyone with access to the gopass password store.

@thomas-mc-work
Copy link
Author

I've create a POC in Python: https://github.com/thomas-mc-work/gopasser

I hope this helps to get an idea.

@thomas-mc-work thomas-mc-work changed the title Feature: process template files Feature: declarative file processing May 18, 2021
@dominikschulz
Copy link
Member

Thanks, I'm still thinking about this. I think we could support that, but it's kind of a niche feature and every feature comes with some maintenance cost. So I wonder if it's really necessary to integrate this directly of if one would be better served by a different kind of integration.

@thomas-mc-work
Copy link
Author

Now I finally found the project that I've seen years ago which is solving the same problem leveraging multiple backends:

https://github.com/abtreece/confd

Sadly, it seems to be focusing on network based services, as opposed to gopass being a local CLI application.

@dominikschulz dominikschulz self-assigned this Dec 23, 2021
@dominikschulz dominikschulz modified the milestones: 1.x.x, 1.14.0 Dec 24, 2021
dominikschulz added a commit to dominikschulz/gopass that referenced this issue Dec 24, 2021
This commit adds the process command to process templates into full (configuration) files.

Fixes gopasspw#1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
dominikschulz added a commit to dominikschulz/gopass that referenced this issue Dec 25, 2021
This commit adds the process command to process templates into full (configuration) files.

Fixes gopasspw#1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
dominikschulz added a commit to dominikschulz/gopass that referenced this issue Dec 28, 2021
This commit adds the process command to process templates into full (configuration) files.

Fixes gopasspw#1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
dominikschulz added a commit to dominikschulz/gopass that referenced this issue Dec 28, 2021
This commit adds the process command to process templates into full (configuration) files.

Fixes gopasspw#1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
dominikschulz added a commit that referenced this issue Dec 28, 2021
This commit adds the process command to process templates into full (configuration) files.

Fixes #1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
@thomas-mc-work
Copy link
Author

Awesome!

kpitt pushed a commit to kpitt/gopass that referenced this issue Jul 21, 2022
This commit adds the process command to process templates into full (configuration) files.

Fixes gopasspw#1913

RELEASE_NOTES=[ENHANCEMENT] Add gopass process

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Enhancements and new features help-wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants