Hi there,
I am following a tutorial which prints out a secret value to a txt file in Jenkins.
'echo $SECRET > secret.txt'
Jenkins has the vault plugin installed.
The credentials have been entered into Jenkins for an approle user. When the job is run, Jenkins authenticates with Vault. I have tried with a bad password and that failed the pipeline.
When I run the pipeline with the correct credentials I get the message:
Access denied to Vault Secrets at 'secret/dev/appsecret'
I have checked this user, there is a policy in place to allow access to this path and I have used the that user in the Vault cli to successfully get the secret.
vault login <approle-user-token>
Success! You are now authenticated.
vault kv get -field=username secret/dev/appsecret
dbUser
The policy is:
path "auth/approle/login" { capabilities = [ "create", "read" ] }
# Read test data
path "secret/dev/*" { capabilities = [ "read" ] }
I have tried everything that I can think of but must be missing something. Any insight would be gratefully received, thank you.