Skip to content

Unable to authenticate and read secrets in Hashicorp Vault using the argocd-vault-plugin command #355

Closed
@hdpdevops

Description

@hdpdevops

I’m working to setup ArgoCD to pull secrets out of Hashicorp Vault using the ArgoCD Vault plugin. Although I am able to read the secrets using the vault CLI in the approle I’ve created I’m having issues requesting secrets back from the Vault using this plugin.

What I’ve done:

I’ve created an approle (argocd) and assigned a policy to it (secret-ro) to ensure that it can read from secrets in the secret/test path.

$ vault read auth/approle/role/argocd
Key                        Value
---                        -----
bind_secret_id             true
local_secret_ids           false
policies                   [secret-ro]
secret_id_bound_cidrs      <nil>
secret_id_num_uses         0
secret_id_ttl              0s
token_bound_cidrs          []
token_explicit_max_ttl     0s
token_max_ttl              0s
token_no_default_policy    false
token_num_uses             0
token_period               0s
token_policies             [secret-ro]
token_ttl                  0s
token_type                 default
$ vault read sys/policy/secret-ro
Key      Value
---      -----
name     secret-ro
rules    path "secret/test" {
   capabilities = ["read", "list"]
}

I’ve created the secret with vault kv put secret/test ingress=my-ingress.domain.com

$ vault read secret/test
Key                 Value
---                 -----
refresh_interval    1h
ingress             my-ingress.domain.com

I’ve entered the role-id and secret-id (as well as the other required variable listed in the docs) into a vars.env file for argocd-vault-plugin to use.

I’ve created an test Kubernetes secret resource with the secret’s path specified in order for the argocd-vault-plugin command to do the replacement

kind: Secret
apiVersion: v1
metadata:
  name: example-annotation
type: Opaque
data:
  username: <path:secret/data/test#ingress>

Now when I run the cat secret.yaml | argocd-vault-plugin -c vars.env generate - command I expect to have successfully replaced the <path:secret/data/test#ingress> value with the secret stored in the vault. Instead I am getting the following error:

URL: PUT https://redacted.hashicorp.cloud:8200/v1/auth/approle/login
Code: 403. Errors:
* 1 error occurred:
	* permission denied

I have tried a different method of authenticating, by creating the token in the Vault and utilising that in the argocd-vault-plugin command (as documented here) which is providing a different error message:

Error: Replace: could not replace all placeholders in Template:
Error making API request.
URL: GET https://redacted.hashicorp.cloud:8200/v1/secret/data/test
Code: 403. Errors:
* 1 error occurred:
	* permission denied

So at this point I thought my policy configuration might have been incorrect, so I’ve logged into the vault CLI (vault login) using the same token that argocd-vault-plugin is using and verified that I can read the secret:

$ vault read secret/test
Key                 Value
---                 -----
refresh_interval    1h
ingress             my-ingress.domain.com

Now I’m coming up blank. I’m not sure what else I can look into to try and resolve this issue so any pointers or insight into this would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions