Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No permissions for sts role credentials when using Approle authentication #6699

Open
bsachin12 opened this issue May 8, 2019 · 1 comment

Comments

@bsachin12
Copy link

Hello,

My pipeline could not generate sts credentials when using Approle to authenticate via jenkins.

Here is the policy defined in vault

Jenkins policy

Login with AppRole

path "auth/approle/login" {
capabilities = [ "create", "read" ]
}

path "secret/aws/*" {
capabilities = ["create", "read", "update", "delete", "list", "sudo"]
}

Jenkins Code

def secretz = [
[$class: 'VaultSecret',
path: "aws/sts/VaultTFE-Sandbox",
secretValues: [
[
$class: 'VaultSecretValue', envVar: 'AWS_SESSION_TOKEN', vaultKey: 'security_token'
],
[
$class: 'VaultSecretValue', envVar: 'AWS_ACCESS_KEY_ID', vaultKey: 'access_key'
],
[
$class: 'VaultSecretValue', envVar: 'AWS_SECRET_ACCESS_KEY', vaultKey: 'secret_key']]]
]

def conf = [
$class: 'VaultConfiguration',
vaultUrl: 'http://17.10.101.10:8200',
vaultCredentialId: 'VAULT_APP_ROLE'
]

wrap([$class: 'VaultBuildWrapper', configuration:conf, vaultSecrets: secretz]) {
withCredentials([string(credentialsId: 'VAULTAWSTOKEN', variable: 'VAULT_TOKEN')]) {
sh "${env.TERRAFORM_HOME} plan ${env.TERRAFORM_INPUT_VARS}"
}

Error thrown

com.bettercloud.vault.VaultException: Vault responded with HTTP status code: 403
Response body: {"errors":["1 error occurred:\n\t* permission denied\n\n"]}

at com.bettercloud.vault.api.Logical.read(Logical.java:70)
at com.bettercloud.vault.api.Logical.read(Logical.java:50)
at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:34)

Caused: com.datapipe.jenkins.vault.exception.VaultPluginException: could not read from vault: Vault responded with HTTP status code: 403
Response body: {"errors":["1 error occurred:\n\t* permission denied\n\n"]}
at path: aws/sts/VaultTFE-Sandbox

@bsachin12
Copy link
Author

Can I get some help in configuring policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants