-
Notifications
You must be signed in to change notification settings - Fork 0
Secure security group rules #43
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
Conversation
…ss Canvas Data API.
…ss to the Internet for Canvas Data API and the RDS Aurora Cluster.
For
For
I deployed the changes to I tested I also executed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Sung. I noted a couple of small changes.
template.yaml
Outdated
DatabaseClientSGToEgress5439: | ||
Type: AWS::EC2::SecurityGroupEgress | ||
Properties: | ||
GroupId: !Ref DatabaseClientSecurityGroup | ||
IpProtocol: tcp | ||
FromPort: 5432 | ||
ToPort: 5432 | ||
DestinationSecurityGroupId: !Sub ${DatabaseSecurityGroupParameter} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be mindful of conditions we should cover to keep our changes upstream friendly.
CreateDatabaseSecurityGroup
ExistingDatabaseSecurityGroup
- Where someone has an existing database security group that they'd like to use.
I'd do this:
DatabaseClientEgressToDatabase:
Type: AWS::EC2::SecurityGroupEgress
Condition: CreateDatabaseSecurityGroup
Properties:
GroupId: !Ref DatabaseClientSecurityGroup
IpProtocol: tcp
FromPort: 5432
ToPort: 5432
DestinationSecurityGroupId: !GetAtt DatabaseSecurityGroup.GroupId
DatabaseClientEgressToExistingDatabase:
Type: AWS::EC2::SecurityGroupEgress
Condition: ExistingDatabaseSecurityGroup
Properties:
GroupId: !Ref DatabaseClientSecurityGroup
IpProtocol: tcp
FromPort: 5432
ToPort: 5432
DestinationSecurityGroupId: !Ref DatabaseSecurityGroupParameter
- Key: !Sub ${TagNameParameter} | ||
Value: !Sub ${TagValueParameter} | ||
Value: !Sub ${TagValueParameter} | ||
|
||
DatabaseClientSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
Properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not specific to your changes, but I noticed the group is unnamed. Can you add a GroupName
like Canvas Data 2 Database Client
?
Edit: This comment refers to the DatabaseClientSecurityGroup
, not sure how it ended up attaching to the tag.
template.yaml
Outdated
EmptySecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
Properties: | ||
GroupDescription: !Sub ${ResourcePrefixParameter}-cd2-empty-sg-${EnvironmentParameter} | ||
VpcId: !Ref VpcIdParameter | ||
Tags: | ||
SecurityGroupEgress: | ||
- IpProtocol: tcp | ||
FromPort: 443 | ||
ToPort: 443 | ||
CidrIp: 0.0.0.0/0 | ||
Tags: | ||
- Key: !Sub ${TagNameParameter} | ||
Value: !Sub ${TagValueParameter} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not specific to your change, but the naming of this resource has always bugged me. ListFunctionSecurityGroup
is more descriptive than EmptySecurityGroup
. Can you change it and also add a GroupName
like Canvas Data 2 ListFunction
?
…eated two separate Egress rule for the conditions CreateDatabaseSecurityGroup and ExistingDatabaseSecurityGroup.
…ter readability. Added GroupNames for security groups.
…Tag and value for the security group names.
@jlongland I made the changes. Tested on ubcla-stg. |
closes #22