Skip to main content

lacework-global-355

5.1.3 Minimize cluster access to read-only for Amazon Elastic Container Registry (ECR) (Manual)

Profile Applicability

• Level 1

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.

Impact

A separate dedicated service account may be required for use by build servers and other robot users pushing or managing container images.

Audit

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 Elastic Kubernetes Service (EKS), but you need to satisfy the following prerequisites.

The Amazon EKS worker node Identity and Access Management (IAM) role (NodeInstanceRole) that you use with your worker nodes must possess the following IAM policy permissions for Amazon ECR:

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

References

https://docs.aws.amazon.com/AmazonECR/latest/userguide/ECR_on_EKS.html