-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Support Vault's secrets engine v2 #862
Comments
I second this request and would be glad to help if any is needed. |
@McShauno thanks! Any help would be appreciated 🙂 I suppose the big question is how do we determine which kv version to use? Also it's a bit unclear if the Go client is any different between v1/v2 - I suspect the path is meant to be the API path, not the CLI path (for v2, the API path is In fact, it could work with kv v2 right now if you just use |
@hairyhenderson I think getting exact version is only missing, as getting
But what would be really nice, if one could select exact version of secret:
Basically looking for gomplate equivalent of
With current implementation of
Vault API reference for getting exact version of v2 secret: https://www.vaultproject.io/api/secret/kv/kv-v2.html#read-secret-version |
@petrjurasek I'm not sure if this'll work, but maybe try this instead: VAULT_TOKEN="root-token" VAULT_ADDR="http://localhost:8200" gomplate --datasource 'vault=vault://?version=1' -i '{{ (datasource "vault" "secret/data/foo/bar/baz").data.hello }}' If neither of those work (and they should be equivalent), then I think the key is to just handle the |
@hairyhenderson - same result
|
Thanks @petrjurasek, that makes sense. Looks like adding the I'll try and find some time this weekend to dig into this a bit more. |
We have been using gomplate for several years now and it has been working great. We too have a need to use v2 of the secrets engine to be able to version secrets. Looks like this request has gone a bit stale. |
Thanks for the bump @carltonmason - indeed this has gone stale... I'd love if someone could take this on if possible! 🙂 |
@hairyhenderson any hints where to start digging in the code? I guess the |
Also found this might be helpful to determine version of kv https://github.com/hashicorp/vault/blob/v1.7.3/command/kv_helpers.go#L99 |
Probably relevant to this whole discussion: at some point I'll be updating gomplate to use my new go-fsimpl library for datasource support. Currently go-fsimpl is missing Vault support however, and I've been working on it for a little while (still a few days from a PR for it though). |
@hairyhenderson, would be happy about KV2 support also - we have a mixed Vault setup with multiple tenant spaces in there and some have KV1, others have already KV2. The secrets are used for K8S deployments in multiple stages/branches and with Gomplate we were able to reduce the complexity dramatically :) Thank you for this nice templating engine! |
Update: go-fsimpl just got Vault support, though it doesn't yet support KV2 - that's tracked in hairyhenderson/go-fsimpl#24. I'm not totally opposed to KV2 support going into gomplate prior to moving to go-fsimpl, but I won't have the time to do that myself - I'll be focusing on the go-fsimpl support instead. |
I know I am a little late to the party, but for future reference: You have to add an extra "/data" between the name of the secret-engine (general) and the path of the secret (secretpath): You can then use It's a bit strange, but seems to work just fine. @hairyhenderson Maybe it would be worth it to add this piece of info to the documentation? |
Thanks @dbaumgarten - this is good information. Once kv2 is supported this will break, but it's at least worth noting with that caveat! |
Wouldn't it be possible do design the v2-support in a way that it at least emits a warning when it detects that you are using a (now broken) workaround. |
@dbaumgarten perhaps? It wouldn't be as simple though... Besides, what if someone is using the literal prefix If it's documented (I am open to PRs for this!!), I think that's enough. If someone's done this workaround and things break with a future version of gomplate, it should be relatively obvious why. |
kv2 would be something that I'm interested in having. I haven't had a look in how to implement it though, not by any means a golang expert. Perhaps looking at how chezmoi handles vault would be worthwhile? |
@dngray interesting! Never heard of chezmoi, thanks for the tip! kv2 support will come probably in gomplate 4.0, when it moves to use go-fsimpl in the backend. I would accept a PR to document the workaround, as mentioned above 😉 |
This issue is stale because it has been open for 60 days with no activity. Remove |
@hairyhenderson are you still considering this? |
I find it interesting that this issue is still marked stale, despite me commenting on it. |
I think that's because the stale workflow only runs weekly (I can increase frequency though). |
Yep. My latest comment in #862 (comment) still stands. To put it more concretely, #1336 will fix this issue. |
This issue is stale because it has been open for 60 days with no activity. Remove |
Go team ;) |
This is quite unusual comparing to any other repo that does this. Hourly seems like a good schedule, some run every 5 minutes. |
I would still like to see this feature. |
Me too. I'm stalling on one of my projects for this feature. |
Thanks for commenting folks. To re-iterate, this will be implemented by #1336. Once that makes it (which could very well take a while yet - I have limited time), this issue will auto-close.
I have a limited number of GitHub Actions minutes available to me per month, so I'm not really interested in running the workflow that often. I have assigned this issue to a new In other words: rest assured - this one'll make it in to 4.0. |
|
@AndrewSav Apologies - I missed the private/public split! Given this is a public repo, it doesn't apply... I have a number of private repos where it matters, so I forgot public was tracked separately 😉. In that case, I could run that workflow more often. However, I still don't see a need. Either way, this particular thread is entirely off-topic for this issue - if you want to continue the discussion let's take it to https://github.com/hairyhenderson/gomplate/discussions |
This is most frustrating. You said:
Now when I'm asking you to increase the frequency you "don't see a need". Why did you offer it in the first place, if you were not going to do it? Continued. |
@hairyhenderson So... fsimpl or not, parameters for dynamic backends for the Vault data source are passed via query string, which means if there is a query string the request is converted to PUT. It means we need a new interface to provide the version, but the URL is quite limiting here. How do you envision we pass this information at the data source?
|
according to what? With go-fsimpl, params can be set while using KV2 - see https://pkg.go.dev/github.com/hairyhenderson/go-fsimpl/vaultfs:
|
Assuming that it was you who wrote the code and documentation, according to you ;)
Oh I see how that works. First we query the backend and determine from options if it's kv2, If it's not and we have query parameters we convert to POST (used to be PUT), otherwise, for kv2 we stay with GET. Got it, thanks. |
🤦♂️ indeed... I thought you were referring to go-fsimpl there since that's the only way kv2 will be getting supported in gomplate. |
I was considering doing a quick and dirty PR for kv2 version support without go-fsimpl, that's why I asked. Now I see that it is not very practical. |
@AndrewSav if you're willing to contribute a PR, my comment last year still stands - a documented workaround would probably be worthwhile! |
@hairyhenderson if I'm not mistaken we do not have a workaround for getting a v2 version support, which I referred to in my previous comment did I miss something? I know that we have a work around for getting the latest value, but that was not what I was talking about. |
Currently the vault datasource will not work with v2 version of Vault's secret engine. Extending the datasource to support this would allow for the use of versioned secrets!
https://www.vaultproject.io/api/secret/kv/kv-v2
The text was updated successfully, but these errors were encountered: