【问题标题】:unable to assume role with gitlab oidc and AWS无法承担 gitlab oidc 和 AWS 的角色
【发布时间】:2023-02-18 02:36:25
【问题描述】:

我已经使用以下定义配置了 IAM Role。配置以下条件时出现 AccessDenied 错误。我哪里错了?

拒绝访问

        "Condition": {
            "StringEquals": {
                "gitlab.com:sub": "https://gitlab.com/pradeepkumarl/configure-openid-connect-in-aws::ref_type:branch:ref:main"
            }
        }

总保单

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "",
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws:iam::<account-id>:oidc-provider/gitlab.com"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringEquals": {
                    "gitlab.com:sub": "https://gitlab.com/pradeepkumarl/configure-openid-connect-in-aws::ref_type:branch:ref:main"
                }
            }
        }
    ]
}

【问题讨论】:

    标签: gitlab-ci gitlab-ci-runner aws-iam-policy


    【解决方案1】:

    条件下您的子字段有错误。它应该是 project_path::ref_type:branch:ref: 的形式。您不需要包含 Gitlab url。

    另请记住,您可能需要将条件从“StringEquals”更改为“StringLike”以适应通配符,如文档的故障排除部分所述:https://docs.gitlab.com/ee/ci/cloud_services/aws/index.html

    【讨论】:

      猜你喜欢
      • 2020-04-29
      • 2017-11-20
      • 2018-08-06
      • 2019-09-15
      • 2019-12-31
      • 1970-01-01
      • 2023-03-13
      • 2018-09-19
      • 2016-03-24
      相关资源
      最近更新 更多