-
Notifications
You must be signed in to change notification settings - Fork 4
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
CDK cross-span vuln fix (WIP) #1436
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ Object { | |
"GuEc2App", | ||
"GuCertificate", | ||
"GuInstanceRole", | ||
"GuSsmSshPolicy", | ||
"GuDescribeEC2Policy", | ||
"GuLoggingStreamNameParameter", | ||
"GuLogShippingPolicy", | ||
|
@@ -134,6 +135,11 @@ Object { | |
}, | ||
}, | ||
"MaxSize": "6", | ||
"MetricsCollection": Array [ | ||
Object { | ||
"Granularity": "1Minute", | ||
}, | ||
], | ||
"MinSize": "3", | ||
"Tags": Array [ | ||
Object { | ||
|
@@ -1805,20 +1811,6 @@ Object { | |
], | ||
"Version": "2012-10-17", | ||
}, | ||
"ManagedPolicyArns": Array [ | ||
Object { | ||
"Fn::Join": Array [ | ||
"", | ||
Array [ | ||
"arn:", | ||
Object { | ||
"Ref": "AWS::Partition", | ||
}, | ||
":iam::aws:policy/AmazonSSMManagedInstanceCore", | ||
], | ||
], | ||
}, | ||
], | ||
"Path": "/", | ||
"Tags": Array [ | ||
Object { | ||
|
@@ -1921,6 +1913,7 @@ Object { | |
}, | ||
"Port": 443, | ||
"Protocol": "HTTPS", | ||
"SslPolicy": "ELBSecurityPolicy-TLS13-1-2-2021-06", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as fastly user TLS v1.2 or later this should be fine (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html) |
||
}, | ||
"Type": "AWS::ElasticLoadBalancingV2::Listener", | ||
}, | ||
|
@@ -1931,6 +1924,14 @@ Object { | |
"Key": "deletion_protection.enabled", | ||
"Value": "true", | ||
}, | ||
Object { | ||
"Key": "routing.http.x_amzn_tls_version_and_cipher_suite.enabled", | ||
"Value": "true", | ||
}, | ||
Object { | ||
"Key": "routing.http.drop_invalid_header_fields.enabled", | ||
"Value": "true", | ||
}, | ||
Comment on lines
+1931
to
+1934
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're not sure what constitutes an invalid header, but this sounds sensible. |
||
], | ||
"Scheme": "internet-facing", | ||
"SecurityGroups": Array [ | ||
|
@@ -2231,6 +2232,42 @@ Object { | |
}, | ||
"Type": "AWS::IAM::Policy", | ||
}, | ||
"SsmSshPolicy4CFC977E": Object { | ||
"Properties": Object { | ||
"PolicyDocument": Object { | ||
"Statement": Array [ | ||
Object { | ||
"Action": Array [ | ||
"ec2messages:AcknowledgeMessage", | ||
"ec2messages:DeleteMessage", | ||
"ec2messages:FailMessage", | ||
"ec2messages:GetEndpoint", | ||
"ec2messages:GetMessages", | ||
"ec2messages:SendReply", | ||
"ssm:UpdateInstanceInformation", | ||
"ssm:ListInstanceAssociations", | ||
"ssm:DescribeInstanceProperties", | ||
"ssm:DescribeDocumentParameters", | ||
"ssmmessages:CreateControlChannel", | ||
"ssmmessages:CreateDataChannel", | ||
"ssmmessages:OpenControlChannel", | ||
"ssmmessages:OpenDataChannel", | ||
Comment on lines
+2241
to
+2254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These match the current permissions needed according to https://github.com/guardian/ssm-scala?tab=readme-ov-file#in-aws |
||
], | ||
"Effect": "Allow", | ||
"Resource": "*", | ||
}, | ||
], | ||
"Version": "2012-10-17", | ||
}, | ||
"PolicyName": "ssm-ssh-policy", | ||
"Roles": Array [ | ||
Object { | ||
"Ref": "InstanceRoleManagefrontendC8EBF20D", | ||
}, | ||
], | ||
}, | ||
"Type": "AWS::IAM::Policy", | ||
}, | ||
"TargetGroupManagefrontend7AE2B787": Object { | ||
"Properties": Object { | ||
"HealthCheckIntervalSeconds": 10, | ||
|
@@ -2345,6 +2382,9 @@ Object { | |
"Type": "AWS::EC2::SecurityGroupIngress", | ||
}, | ||
"supportPRODmanagefrontend8911518E": Object { | ||
"DependsOn": Array [ | ||
"InstanceRoleManagefrontendC8EBF20D", | ||
], | ||
"Properties": Object { | ||
"LaunchTemplateData": Object { | ||
"IamInstanceProfile": Object { | ||
|
@@ -2359,6 +2399,9 @@ Object { | |
"Ref": "AMIManagefrontend", | ||
}, | ||
"InstanceType": "t4g.small", | ||
"MetadataOptions": Object { | ||
"InstanceMetadataTags": "enabled", | ||
}, | ||
Comment on lines
+2402
to
+2404
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is to allow access to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html |
||
"SecurityGroupIds": Array [ | ||
Object { | ||
"Fn::GetAtt": Array [ | ||
|
@@ -2377,6 +2420,10 @@ Object { | |
Object { | ||
"ResourceType": "instance", | ||
"Tags": Array [ | ||
Object { | ||
"Key": "App", | ||
"Value": "manage-frontend", | ||
}, | ||
Object { | ||
"Key": "gu:cdk:version", | ||
"Value": "TEST", | ||
|
@@ -2402,6 +2449,10 @@ Object { | |
Object { | ||
"ResourceType": "volume", | ||
"Tags": Array [ | ||
Object { | ||
"Key": "App", | ||
"Value": "manage-frontend", | ||
}, | ||
Object { | ||
"Key": "gu:cdk:version", | ||
"Value": "TEST", | ||
|
@@ -2482,6 +2533,10 @@ systemctl start manage-frontend | |
Object { | ||
"ResourceType": "launch-template", | ||
"Tags": Array [ | ||
Object { | ||
"Key": "App", | ||
"Value": "manage-frontend", | ||
}, | ||
Object { | ||
"Key": "gu:cdk:version", | ||
"Value": "TEST", | ||
|
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.
We think this replaces the old AmazonSSMManagedInstanceCore policy below to ssh into the ec2 instance.
TODO: test in code to make sure we can still ssh into the instance