Calling vault kv put with a / in the secret

Hi,

I want to call vault kv put secret/$mysecret with mysecret=abc/def.

But vault seems not to process the request. I have tried to escape the slash with backslash, but same result.

How can I add secrets with a / in it?

Best regards,

Ronny

Please show an exact copy/paste of the commands you ran and the output and errors they produced.

vault kv put -mount=security Cloud/description=Secret Access ID Cloud/username=- Cloud/password=X/XXXXXX+XXXX+XXXXXXXXXXXXXXXXXXXXXXXXXX

I can’t show the real password, as it is real. There is no error message, the command doesn’t stop running and the vault server uses round about 1% of CPU and 2,9% mem.

Here is a shell session showing me testing out the command you provided:

maxb@q:~$ vault secrets enable -path=security kv
Success! Enabled the kv secrets engine at: security/

maxb@q:~$ vault kv put -mount=security Cloud/description=Secret Access ID Cloud/username=- Cloud/password=X/XXXXXX+XXXX+XXXXXXXXXXXXXXXXXXXXXXXXXX <<<placeholder_input
Failed to parse K=V data: invalid key/value pair "Access": format must be key=value

maxb@q:~$ vault kv put -mount=security Cloud/description="Secret Access ID" Cloud/username=- Cloud/password=X/XXXXXX+XXXX+XXXXXXXXXXXXXXXXXXXXXXXXXX <<<placeholder_input
Success! Data written to: security/Cloud/description=Secret Access ID

maxb@q:~$ vault kv get "security/Cloud/description=Secret Access ID"
========= Data =========
Key               Value
---               -----
Cloud/password    X/XXXXXX+XXXX+XXXXXXXXXXXXXXXXXXXXXXXXXX
Cloud/username    placeholder_input

As you can see, it kind of works, once quoting is added around the strings containing space characters… but not quite how I think you intended, since the way you have written it here, the Vault path written to is literally

security/Cloud/description=Secret Access ID

with the spaces being part of the path.

Ah, OK, thanks. It’s a quoting issue then. Weird thing just was, that I didn’t get any reply from the server.