documentation_complete: true


title: 'Ensure Cluster Service Account with read-only access to Amazon ECR'

description: |-
  Configure the Cluster Service Account with Storage Object Viewer Role to only
  allow read- only access to Amazon ECR.

rationale: |-
  The Cluster Service Account does not require administrative access to Amazon
  ECR, only requiring pull access to containers to deploy onto Amazon EKS.
  Restricting permissions follows the principles of least privilege and
  prevents credentials from being abused beyond the required role.

severity: unknown

identifiers:
  cce@eks: CCE-86681-4

references:
  cis@eks: 5.1.3

ocil_clause: 'Cluster Service Account has read-only access to Amazon ECR'

ocil: |-
  Review AWS ECS worker node IAM role (NodeInstanceRole) IAM Policy Permissions
  to verify that they are set and the minimum required level. If utilizing a
  3rd party tool to scan images utilize the minimum required permission level
  required to interact with the cluster - generally this should be read-only.

  Remediation:

  You can use your Amazon ECR images with Amazon EKS, but you need to satisfy
  the following prerequisites.
  The Amazon EKS worker node IAM role (NodeInstanceRole) that you use with your
  worker nodes must possess the following IAM policy permissions for Amazon
  ECR.

  <tt>
  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "ecr:BatchCheckLayerAvailability",
          "ecr:BatchGetImage",
          "ecr:GetDownloadUrlForLayer",
          "ecr:GetAuthorizationToken"
        ],
        "Resource": "*"
      }
    ]
  }
  </tt>
