Using VaultSharp with VaultAgent Proxy #313
-
Is there a way to use VaultSharp pointed at Vault Agent where the Vault Agent is serving as a proxy? Basically, I want to do the following: // Initialize settings to point to the vault proxy listener on that is running on the same machine IVaultClient vaultClient = new VaultClient(vaultClientSettings); Secret secret = await vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(mountPoint: "secret", path: "test"); The vault agent has already authenticated and gotten a token to connect to the vault. I have done something similar reading the token file and using the above code with the TokenAuth method pointed to the vault but would like to avoid that and have the Vault agent handle everything with regards to auth and renewals. Currently if I point to the Vault Agent listener, I get an error message of invalid token when trying to obtain the secret. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
It's a very interesting use case @shinyobject88. Can you please try the following steps?
Let me know. |
Beta Was this translation helpful? Give feedback.
-
Please send me the stack trace of the component exception. Also, can you try using postman or fiddler and make the vault agent http call succeed? Same url, port, dummy or no token etc. If that succeeds, then there is a problem with VaultSharp. I'll have a look over the weekend. |
Beta Was this translation helpful? Give feedback.
-
Thanks @shinyobject88. That error is normally related to ssl connections etc. and I don't see https in your url. Everything is http. So that's good. Let's see what postman yields |
Beta Was this translation helpful? Give feedback.
I think I found the issue and it was my end. It was a proxy issue. It didn't like that I was hitting 127.0.0.1 for the vault agent. I switched to localhost to make sure I didn't hit the proxy and it worked like a charm. Sorry for all the confusion, didn't even think of it until now