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

"Could not list credentials in Secrets Manager" #324

Open
tgooderham opened this issue May 30, 2024 · 2 comments
Open

"Could not list credentials in Secrets Manager" #324

tgooderham opened this issue May 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tgooderham
Copy link

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins controller 2.440.3.7 running on CentOS 7.8.2003 x86_64
AWS Secrets Manager Credentials Provider Version1.214.va_0a_d8268d068

Reproduction steps

Installed plugin: AWS Secrets Manager Credentials Provider Version1.214.va_0a_d8268d068

According to the docs, the default configuration should provide authentication to AWS via the instance profile if the server is within EC2 which it is.

The attached instance profile name is: role-deployment-automation-within-ec2

The policy on that profile is:

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt",
                "kms:DescribeKey",
                "kms:GenerateDataKey"
            ],
            "Resource": [
                "arn:aws:kms:us-east-1:331560656580:key/20c8ca2e-6073-4aa0-8e2d-65ea10f8a9bc"
            ]
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:CreateSecret",
                "secretsmanager:ListSecrets",
                "secretsmanager:DescribeSecret",
                "kms:ListAliases"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "secretsmanager:GetSecretValue",
                "secretsmanager:ListSecrets",
                "secretsmanager:DescribeSecret"
            ],
            "Resource": "*"
        }
    ]
}


Expected Results

AWS Secrets appear in jenkins credential store

Actual Results

Repeated occurrances of:

May 30, 2024 8:42:40 AM WARNING io.jenkins.plugins.credentials.secretsmanager.AwsCredentialsProvider getCredentials
Could not list credentials in Secrets Manager: message=[Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: You must specify a value for roleArn and roleSessionName, com.amazonaws.auth.profile.ProfileCredentialsProvider@9279de4: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@22deced1: Unable to load credentials. Access key or secret key are null.]]

Anything else?

No response

Are you interested in contributing a fix?

No response

@tgooderham tgooderham added the bug Something isn't working label May 30, 2024
@chriskilding
Copy link
Contributor

For what it's worth, I noticed there is no Sid on the relevant policy stanza that the Jenkins plugin would use, i.e. this bit

        {
            "Effect": "Allow",
            "Action": [
                "secretsmanager:GetSecretValue",
                "secretsmanager:ListSecrets",
                "secretsmanager:DescribeSecret"
            ],
            "Resource": "*"
        }

Just in case the absence of a Sid causes that policy stanza to be read as invalid (and therefore ignored by IAM), could you try adding a Sid to it, and re-running your test scenario to see if the error still happens?

@tgooderham
Copy link
Author

tgooderham commented May 30, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants