0

我为 AWS 开发人员高级用户提供了这个托管策略,它允许用户访问除 IAM 和组织之外的所有 AWS 资源和操作(仅比管理员角色低一级)。

AssumeRolePolicyDocument:
    Version: 2012-10-17
    Statement:
      - Effect: Allow
        Principal:
          Federated:
            - !Sub "arn:aws:iam::${AWS::AccountId}:saml-provider/ABC"
        Action: 'sts:AssumeRoleWithSAML'
        Condition:
          StringEquals:
            SAML:aud: "https://signin.aws.amazon.com/saml"
  Path: /
  Policies:
    - PolicyName: ABC
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            NotAction:
              - iam:*
              - organizations:*
              - account:*
            Resource: '*'  
          - Effect: Allow
            Action:
              - iam:CreateServiceLinkedRole
              - iam:DeleteServiceLinkedRole
              - iam:ListRoles
              - organizations:DescribeOrganization  
              - account:ListRegions
            Resource: '*'

我想在特定日期之间限制对用户的访问(例如在部署计划期间),并在下面添加了 Date 运算符的代码。

Condition:
DateGreaterThan:
  aws:CurrentTime: '2020-04-01T00:00:00Z'
DateLessThan:
  aws:CurrentTime: '2020-06-30T23:59:59Z'

但是,将上述条件子句添加到 PowerUserManaged 策略会在 AWS 控制台中部署策略期间引发错误 400 Malformed。

是否可以将日期条件子句添加到 PowerUserAccess 托管策略? https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_developer-power-user

4

1 回答 1

0

如果您想使用 IAM 托管策略,您只需向用户添加另一个策略,以在用户超出日期范围时拒绝该用户。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Deny",
            "Action": "*",
            "Resource": "*",
            "Condition": {
                "DateGreaterThan": {"aws:CurrentTime": "2020-04-01T00:00:00Z"},
                "DateLessThan": {"aws:CurrentTime": "2020-04-01T00:00:00Z"}
            }
        }
    ]
}

显式拒绝将始终覆盖任何允许语句,有关策略评估的更多信息,请查看 AWS 上的策略评估页面。

于 2020-07-20T15:05:59.000 回答