turbot/steampipe-mod-aws-compliance

Control: EKS clusters should be configured to have kubernetes secrets encrypted using KMS

Description

Ensure that AWS Elastic Kubernetes Service clusters are configured to have Kubernetes secrets encrypted using AWS Key Management Service (KMS) keys.

Usage

Run the control in your terminal:

powerpipe control run aws_compliance.control.eks_cluster_secrets_encrypted

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_compliance.control.eks_cluster_secrets_encrypted --share

SQL

This control uses a named query:

with eks_secrets_encrypted as (
select
distinct arn as arn
from
aws_eks_cluster,
jsonb_array_elements(encryption_config) as e
where
e -> 'Resources' @> '["secrets"]'
)
select
a.arn as resource,
case
when encryption_config is null then 'alarm'
when b.arn is not null then 'ok'
else 'alarm'
end as status,
case
when encryption_config is null then a.title || ' encryption not enabled.'
when b.arn is not null then a.title || ' encrypted with EKS secrets.'
else a.title || ' not encrypted with EKS secrets.'
end as reason
, region, account_id
from
aws_eks_cluster as a
left join eks_secrets_encrypted as b on a.arn = b.arn;

Tags