lacework-global-335
info
This rule also encompasses lacework-global-665 and lacework-global-666. See Adjusted Rules for CIS Amazon EKS 1.1.0 for further details.
4.1.5 Ensure that default service accounts are not actively used. (Automated)
note
This rule has been changed to automated, see Automated Rules for CIS Amazon EKS 1.1.0 for details.
Profile Applicability
• Level 1
Description
The default
service account should not be used to ensure that rights granted to applications can be more easily audited and reviewed.
Rationale
Kubernetes provides a default
service account which is used by cluster workloads where no specific service account is assigned to the pod.
Where access to the Kubernetes API from a pod is required, a specific service account should be created for that pod, and rights granted to that service account.
The default service account should be configured such that it does not provide a service account token and does not have any explicit rights assignments.
Impact
All workloads which require access to the Kubernetes API will require an explicit service account to be created.
Audit
For each namespace in the cluster, review the rights assigned to the default service account and ensure that it has no roles or cluster roles bound to it apart from the defaults.
Additionally ensure that the automountServiceAccountToken: false
setting is in place for each default service account.
Remediation
Create explicit service accounts wherever a Kubernetes workload requires specific access to the Kubernetes API server.
Modify the configuration of each default service account to include this value
automountServiceAccountToken: false
Automatic remediation for the default account:
kubectl patch serviceaccount default -p $'automountServiceAccountToken: false'
References
https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
https://aws.github.io/aws-eks-best-practices/iam/#disable-auto-mounting-of-service-account-tokens