Details about the critical rule ensuring Lambda functions restrict public access.
Rule | Lambda functions should prohibit public access |
Framework | PCI v3.2.1 |
Severity | ✔ Critical |
Lambda Functions Public Access Prohibition for PCI v3
Description
This rule aims to enforce the prohibition of public access to Lambda functions in order to maintain compliance with the Payment Card Industry Data Security Standard (PCI DSS) version 3.
Lambda functions serve as serverless compute resources within AWS, allowing you to run your code without provisioning or managing servers. To ensure the security of PCI data, it is essential to prevent unauthorized access to Lambda functions by configuring them to be private and inaccessible from the public internet.
Troubleshooting Steps
If public access to a Lambda function is detected, follow these troubleshooting steps:
Necessary Code
Implementing this rule may involve modifying the existing Lambda function configuration. Below is an example code snippet that demonstrates how to configure a Lambda function to prohibit public access:
import boto3
def lambda_handler(event, context):
lambda_client = boto3.client('lambda')
# Specify the function name and remove public access permissions
function_name = 'your-lambda-function-name'
lambda_client.update_function_configuration(
FunctionName=function_name,
VpcConfig={
'SecurityGroupIds': ['sg-xxxxxxxx'],
'SubnetIds': ['subnet-xxxxxxxx']
}
)
The above code snippet sets the Lambda function's VPC configuration, associating it with specific security groups and subnets. This restricts the function's accessibility to within your private network, eliminating any public access.
Step-by-Step Guide for Remediation
Follow these steps to remediate the issue of public access to Lambda functions:
By following these steps diligently, you can ensure that your Lambda functions are properly secured and adhere to PCI DSS version 3 requirements.