0

是否有可以创建/附加到CodeStarWorker-*-CloudFormation限制CodeStar 工作人员可以使用的Subnets 或s 的 IAM 策略?HostedZoneId

这是一个示例 template.yml:

Resources:
  # other resources
  DevAlb:
    Properties:
      LoadBalancerAttributes: []
      Name: !Sub '${ProjectId}-dev-alb'
      Scheme: internal
      SecurityGroups:
        - !Ref AlbSecurityGroup
      Subnets:
        - !ImportValue PrivateSubnet1
        - !ImportValue PrivateSubnet2
      Tags:
        - Key: Name
          Value: !Sub '${ProjectId}-dev'
    Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
  DevAlbDns:
    Properties:
      AliasTarget:
        DNSName: !GetAtt 
          - AlbDev
          - DNSName
        HostedZoneId: !GetAtt 
          - AlbDev
          - CanonicalHostedZoneID
      HostedZoneId: !ImportValue InternalDomainDotCom
      Name: !Sub '${ProjectId}.internal-domain.com'
      Type: A
    Type: 'AWS::Route53::RecordSet'

我不希望拥有 CodeStar 访问权限的用户导入/使用任何允许公共 Internet 访问的内容(无论如何,未经管理员批准)。如何防止某人设置/导入PublicSubnet1PublicSubnet2作为其中之一Subnet?或者阻止他们设置/导入PublicDomainDotComHostedZoneId

4

1 回答 1

0

我可以通过将以下策略附加到CodeStarWorker-app-CloudFormation!

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:GetChange",
                "route53:GetHostedZone",
                "route53:ListHostedZones",
                "route53:ListHostedZonesByName",
                "route53:ListResourceRecordSets",
                "route53:GetHostedZoneCount",
                "route53domains:*"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "route53:ChangeResourceRecordSets",
                "route53:ListResourceRecordSets",
                "apigateway:GET"
            ],
            "Resource": [
                "arn:aws:route53:::hostedzone/REPLACE_WITH_HOSTED_ZONE_ID",
                "arn:aws:apigateway:*::/domainnames"
            ]
        }
    ]
}

这将仅允许 CodeStar 的 CloudFormation 角色在管理员允许的托管区域 ID 中创建 Route 53 记录集。

我确信还有其他方法可以保护您的基础设施和数据免受具有 CodeStar 角色的不良行为者的侵害。如果您有任何想法(例如,限制 EC2 VPC/子网),请随时分享。

于 2020-02-08T09:23:15.937 回答