This rule focuses on restricting TCP and UDP access in VPC security groups from a wide IP range.
Rule | VPC security groups should restrict ingress TCP and UDP access from 0.0.0.0/0 |
Framework | FedRAMP Low Revision 4 |
Severity | ✔ High |
Rule Description:
VPC security groups for FedRAMP Low Revision 4 should restrict ingress TCP and UDP access from the IP range 0.0.0.0/0. This rule aims to enforce a more secure networking environment by limiting access only to the required IP addresses or ranges.
Troubleshooting Steps:
Necessary Codes:
Amazon Web Services (AWS) provides a CLI (Command Line Interface) that can be used to manage security groups. Below are the necessary commands to configure the desired ingress restriction:
aws ec2 modify-security-group-rules --group-id <security-group-id> --ingress <ingress-rules>
Replace
<security-group-id>
with the actual ID of the security group you want to modify and <ingress-rules>
with the specific rules that need to be enabled.aws ec2 authorize-security-group-ingress --group-id <security-group-id> --protocol tcp --port <port-number> --source-security-group <security-group-id> --source-security-group-owner-id <owner-id>
Replace
<security-group-id>
with the actual ID of the security group you want to modify, <port-number>
with the desired TCP port number, <security-group-id>
with the ID of the security group that is allowed access, and <owner-id>
with the owner ID of the source security group.aws ec2 authorize-security-group-ingress --group-id <security-group-id> --protocol udp --port <port-number> --source-security-group <security-group-id> --source-security-group-owner-id <owner-id>
Replace the placeholders as mentioned in the previous command.
Step-by-Step Guide for Remediation:
aws ec2 describe-security-groups --query 'SecurityGroups[?GroupName==`<security-group-name>`].GroupId' --output text
Replace
<security-group-name>
with the actual name of the security group you are targeting.aws ec2 describe-security-groups --group-ids <security-group-id> --query 'SecurityGroups[].IpPermissions[? (ToPort <= `<port-number>` && FromPort >= `<port-number>` && (IpRanges[? (CidrIp == `0.0.0.0/0`)] || Ipv6Ranges[? (CidrIpv6 == `::/0`)] || PrefixListIds[? (PrefixListId == `pl-xxxxxxxx`)]))]'
Replace
<security-group-id>
and <port-number>
with the actual security group ID and port number you want to check.Remember to replace the required placeholders with the actual values to ensure correct execution.
By following these steps and using the provided commands, you can successfully restrict ingress TCP and UDP access from 0.0.0.0/0 for the specified VPC security group, ensuring compliance with FedRAMP Low Revision 4 requirements.