Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ec2): restrict access to default security group (under feature flag) #25297

Merged
merged 6 commits into from
May 2, 2023
Merged

feat(ec2): restrict access to default security group (under feature flag) #25297

merged 6 commits into from
May 2, 2023

Conversation

corymhall
Copy link
Contributor

@corymhall corymhall commented Apr 25, 2023

This PR implements functionality which will remove the default ingress/egress rules from the VPC default security group. When a VPC is created, the default security group is created as well with default ingress/egress rules which allow all traffic. It is not possible to delete the default security group, but you should never use it. As a result there are a log of security standards that recommend removing the default rules so that the security group denies all traffic by default. See this rule.

Since the default security group cannot be managed through a CloudFormation resource, this PR introduces a new Custom Resource which will remove the ingress/egress rules.

I also think that this should be the default behavior so I have introduced a new feature flag to make this the default for new apps. As a result I had to update a lot of integration tests. Since This feature flag would only be introduced on new VPCs it didn't make sense to run the update workflow on all these integration tests so I updated them to disable this new feature.

I added one new integration test to test this functionality.

fixes #19394


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…lag)

This PR implements functionality which will remove the default
ingress/egress rules from the VPC default security group. When a VPC is
created, the default security group is created as well with default
ingress/egress rules which allow _all_ traffic. It is not possible to
delete the default security group, but you should never use it. As a
result there are a log of security standards that recommend removing the
default rules so that the security group denies all traffic by default.
See [this
rule](https://docs.aws.amazon.com/securityhub/latest/userguide/ec2-controls.html#ec2-2).

Since the default security group cannot be managed through a
CloudFormation resource, this PR introduces a new Custom Resource which
will remove the ingress/egress rules.

I also think that this should be the default behavior so I have
introduced a new feature flag to make this the default for new apps. As
a result I had to update _a lot_ of integration tests. Since This
feature flag would only be introduced on new VPCs it didn't make sense
to run the update workflow on all these integration tests so I updated
them to disable this new feature.

I added one new integration test to test this functionality.

fixes #19394
@gitpod-io
Copy link

gitpod-io bot commented Apr 25, 2023

@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 labels Apr 25, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team April 25, 2023 17:18
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 25, 2023
@corymhall corymhall changed the title feat(ec2): restrict access to default security group (under feature f… feat(ec2): restrict access to default security group (under feature flag) Apr 26, 2023
@mergify
Copy link
Contributor

mergify bot commented May 2, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 47789dd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented May 2, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-ec2): configuration so the default security group will not allow inbound and outbound traffic
3 participants