hashicorp-vault

Can't get vault kv-v2 secret using curl


To begin with, I've been searching a lot and I may have missed the answer I'm looking for as I'm sure others certainly have the same issue... I've found some dead topics on github and at other places with no solution to my current problem, so I'm creating a new post.

I've got a working vault, I can access the secrets through the UI and I can make requests using the vault kv get ... command. But the issue is that when I'm trying to connect other apps it tells me that the path does not exists. I checked and it does not seem to be an issue with the authentication or policy rights as I've been trying to do curl request with the root token and i've got this result:

curl --header "X-Vault-Token:SECRETTOKEN" http://127.0.0.1:8200/v1/secret/data/PATHTOSECRET
{"errors":["no handler for route 'secret/data/dev/postgres/postgres'"]}

In that request I tried to add the /data to the path as I'm using the kv v2 api... But I've got the same result without it.

Does someone has an idea what I did wrong there?

The secrets where created using kv-v2, I'm using vault 1.5.3 if it helps.

Thanks in advance.


Solution

  • Ok, for those that may have that error, I finally found my answer here: HashiCorp Vault No handler for route error despite secrets engine being enabled through the UI

    The error being that in all example they are using secret/data/PATH... And that's wrong... You need to use "KV engine name"/data/PATHTOSECRET

    So in my case it was: dev/data/postgres/postgres in my test secret.