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

Support mv operation in v2 of kv secrets engine #129

Open
Ernest0x opened this issue Feb 4, 2020 · 3 comments
Open

Support mv operation in v2 of kv secrets engine #129

Ernest0x opened this issue Feb 4, 2020 · 3 comments

Comments

@Ernest0x
Copy link

Ernest0x commented Feb 4, 2020

I am not sure if vault-cli is expected to work with v2 of kv in general since I had to add the 'data/' in the secret path myself to fetch secrets with the 'get' subcommand. With 'mv' subcommand I was not so lucky though. Here is the debug output.

$ vault -vv mv kv/data/path/to/secret kv/data/new/path/to/secret
INFO:vault_cli.cli:Log level set to DEBUG
INFO:vault_cli.settings:Reading yaml config file at ./vault.yml, contains keys: token, url, verify
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): vaultserver.example.org:8200
DEBUG:urllib3.connectionpool:https://vaultserver.example.org:8200 "GET /v1/kv/data/path/to/secret?list=True HTTP/1.1" 405 64
DEBUG:urllib3.connectionpool:https://vaultserver.example.org:8200 "GET /v1/kv/data/path/to/secret HTTP/1.1" 200 410
Move 'kv/data/path/to/secret' to 'kv/data/new/path/to/secret'
DEBUG:urllib3.connectionpool:https://vaultserver.example.org:8200 "GET /v1/kv/data/new/path/to/secret HTTP/1.1" 200 312
DEBUG:urllib3.connectionpool:https://vaultserver.example.org:8200 "GET /v1/kv/data/new/path/to/secret?list=True HTTP/1.1" 405 64
Error: Unexpected vault error

The List operation of Vault API should be done differently (https://www.vaultproject.io/api/secret/kv/kv-v2.html#list-secrets) in version 2 of kv secrets engine, so I guess the problem has to do with this.

@ewjoachim
Copy link
Contributor

Hello, and thanks for your report !

I think v2 has not been supported yet. It might be an excellent idea to do so, maybe through a configuration parameter.
Would you be interested in working in this direction ? Otherwise, I'm not sure I'll be working on v2 right away. If you're interested, though, I'll be delighted to provide support and guidance, and help you shape design decisions :) !

@Ernest0x
Copy link
Author

Ernest0x commented Feb 6, 2020

So, if I am not wrong, this tool is currently designed to work with version 1 of kv secrets engine. Not other secrets engines, not version 2 of kv. Right? In that case, I guess I could look at supporting v2 too, with relatively not that many changes in the code. But, if the intention / plan is to support more secret engines in the future, I guess there is a lot more work that has to be done, perhaps changing the design to something more abstract.

@ewjoachim
Copy link
Contributor

So, if I am not wrong, this tool is currently designed to work with version 1 of kv secrets engine. Not other secrets engines, not version 2 of kv. Right?

Right!

But, if the intention / plan is to support more secret engines in the future, I guess there is a lot more work that has to be done

Hm, I believe we plan to use the PKI secret engine at some point, and we may want to use that tool for other secret engines too, so, you're absolutely right in the sense that an abstraction layer will be required. I understand if you'd rather not start that kind of work. On my side, I have quite little experience regarding vault secret engines so far, so I'll need to play with it first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants