Permission Denied to access HCP Vault via cURL

Hello,

I created a vault cluster with public domain. I can access using the cli and the vault command. However, when I try to reach it using cURL, I always get permission denied. As an example, I was following the tutorial [ Build Your Own Certificate Authority (CA)] { Build Your Own Certificate Authority (CA) | Vault - HashiCorp Learn} but as soon as in the first step I get permission denied, ie, when running curl --header "X-Vault-Token: $VAULT_TOKEN" --request POST --data '{"type":"pki"}' $VAULT_ADDR/v1/sys/mounts/pki I get as response {"errors":["1 error occurred:\n\t* permission denied\n\n"]}

Any idea what can be causing this problem?

In my experience this usually means you have an expired or invalid token set in your VAULT_ADDR environment variable or the token has insufficient permissions.

This is what I would start asking myself if I ran into this:

  1. Have I substituted the token specified in the doc for a token generated from my own Vault environment and is it still valid?
  2. If so, am I using a root token or something with less privilege?
  3. If the latter do I have all the necessary capabilities applied?
  4. If so, are you sure you have all the necessary capabilities applied (e.g. missing sudo)

Hopefully this helps!