Add support for basic EKC node functionality#41
Open
thatmikereed wants to merge 6 commits intoalertlogic:masterfrom
Open
Add support for basic EKC node functionality#41thatmikereed wants to merge 6 commits intoalertlogic:masterfrom
thatmikereed wants to merge 6 commits intoalertlogic:masterfrom
Conversation
Co-authored-by: thatmikereed <259488673+thatmikereed@users.noreply.github.com>
- Add eksInfrastructure and eksNodeGroup check configurations to config.js - Update utilities/assets.js with EKS asset type mappings - Add getEksClustersInScope function to assets.js - Create checks/eksInfrastructure.js with cluster security checks - Create checks/eksNodeGroup.js with node group configuration checks - Update checks/awsConfigRules.js with EKS resource type scope mappings - Add comprehensive README_EKS.md documentation Co-authored-by: thatmikereed <259488673+thatmikereed@users.noreply.github.com>
- Remove incorrect fallback to empty object which prevented proper null checks - Add proper validation for missing or empty updateConfig objects Co-authored-by: thatmikereed <259488673+thatmikereed@users.noreply.github.com>
Co-authored-by: thatmikereed <259488673+thatmikereed@users.noreply.github.com>
…e-checks Add Phase 1 EKS infrastructure security checks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EKS Infrastructure Checks - Phase 1
Overview
This document describes Phase 1 of EKS (Amazon Elastic Kubernetes Service) infrastructure checks for the CI Lambda Checks project. These checks enable security and compliance evaluations for EKS resources, similar to existing EC2 resource monitoring.
Supported EKS Resources
Phase 1 supports the following AWS resource types:
Future phases will add support for:
Checks Implemented
1. EKS Infrastructure Check (
eksInfrastructure)Validates EKS cluster security configurations against organizational policies.
Check: Cluster Logging
Purpose: Ensures all required control plane log types are enabled for audit and troubleshooting.
Policy Configuration:
What it checks:
Remediation:
aws eks update-cluster-config \ --name <cluster-name> \ --logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'Check: Kubernetes Version
Purpose: Ensures EKS clusters are running a supported Kubernetes version.
Policy Configuration:
What it checks:
Remediation:
aws eks update-cluster-version \ --name <cluster-name> \ --kubernetes-version 1.27Check: Endpoint Access
Purpose: Prevents unrestricted public access to the EKS cluster API endpoint.
Policy Configuration:
What it checks:
Remediation:
aws eks update-cluster-config \ --name <cluster-name> \ --resources-vpc-config endpointPublicAccess=true,publicAccessCidrs=["203.0.113.0/24"]Or disable public access entirely:
aws eks update-cluster-config \ --name <cluster-name> \ --resources-vpc-config endpointPublicAccess=false,endpointPrivateAccess=trueCheck: Secrets Encryption
Purpose: Ensures Kubernetes secrets are encrypted at rest using AWS KMS.
Policy Configuration:
What it checks:
Remediation:
Encryption must be enabled at cluster creation time. For existing clusters, you must:
aws eks create-cluster \ --name <cluster-name> \ --encryption-config '[{"resources":["secrets"],"provider":{"keyArn":"arn:aws:kms:region:account:key/key-id"}}]' \ ...2. EKS Node Group Check (
eksNodeGroup)Validates EKS managed node group configurations against organizational policies.
Check: AMI Type
Purpose: Ensures node groups use approved Amazon Machine Images.
Policy Configuration:
What it checks:
Remediation:
Create a new node group with an approved AMI type:
aws eks create-nodegroup \ --cluster-name <cluster-name> \ --nodegroup-name <nodegroup-name> \ --ami-type AL2_x86_64 \ ...Check: Update Configuration
Purpose: Ensures node groups have safe update policies that limit disruption.
Policy Configuration:
What it checks:
Remediation:
aws eks update-nodegroup-config \ --cluster-name <cluster-name> \ --nodegroup-name <nodegroup-name> \ --update-config maxUnavailable=1Check: Required Tags
Purpose: Enforces organizational tagging policies for cost allocation and management.
Policy Configuration:
What it checks:
Remediation:
aws eks tag-resource \ --resource-arn <nodegroup-arn> \ --tags Environment=production,Team=platform,CostCenter=engineeringCheck: Scaling Configuration
Purpose: Validates logical consistency of scaling parameters.
What it checks:
Remediation:
aws eks update-nodegroup-config \ --cluster-name <cluster-name> \ --nodegroup-name <nodegroup-name> \ --scaling-config minSize=1,maxSize=10,desiredSize=3Configuration
Enabling EKS Checks
By default, EKS checks are disabled. To enable them, update
config.js:Customizing Policies
You can customize the policy settings to match your organization's requirements:
AWS Config Requirements
These checks rely on AWS Config to track EKS resource changes. You must:
aws configservice put-configuration-recorder \ --configuration-recorder name=default,roleARN=arn:aws:iam::account:role/config-role \ --recording-group allSupported=false,includeGlobalResources=false,resourceTypes=AWS::EKS::Cluster,AWS::EKS::Nodegroup,AWS::EC2::SecurityGroup,AWS::IAM::RoleEvent Processing Modes
Both checks support two AWS Config event modes:
Configuration Item Mode
Snapshot Event Mode
Testing
Prerequisites
Test Scenarios
Test 1: Cluster Logging Violation
aws eks create-cluster \ --name test-cluster \ --role-arn <role-arn> \ --resources-vpc-config subnetIds=<subnets> \ --logging '{"clusterLogging":[{"types":["api"],"enabled":true}]}'Test 2: Public Endpoint Violation
aws eks update-cluster-config \ --name test-cluster \ --resources-vpc-config endpointPublicAccess=true,publicAccessCidrs=["0.0.0.0/0"]Test 3: Node Group Tag Violation
aws eks create-nodegroup \ --cluster-name test-cluster \ --nodegroup-name test-nodegroup \ --subnets <subnets> \ --node-role <role-arn>Verification
Check CloudWatch Logs for the Lambda function:
Verify vulnerabilities appear in Alert Logic Cloud Insight console.
Phase 1 Limitations
This initial implementation has the following limitations:
Future Phases
Phase 2 (Planned)
Phase 3 (Proposed)
Troubleshooting
Check Not Running
Problem: Checks don't execute for EKS resources
Solutions:
config.jsFalse Positives
Problem: Vulnerabilities reported for compliant resources
Solutions:
config.jschecks/eksInfrastructure.jsorchecks/eksNodeGroup.jsMissing Vulnerabilities
Problem: Expected vulnerabilities not reported
Solutions:
References
AWS Documentation
Related Documentation
Support
For issues or questions: