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

fix(eks): overly permissive trust policies #25473

Merged
merged 33 commits into from
May 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
be65a30
mid work
iliapolo Apr 30, 2023
1f28d33
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 1, 2023
0e6df1a
test fixes
comcalvi May 2, 2023
42ec407
sdk-call.js
comcalvi May 2, 2023
fabc819
no longer create mastersrole by default
comcalvi May 3, 2023
18cd6f5
package.json
comcalvi May 3, 2023
30e4a05
tests, pt 1
comcalvi May 4, 2023
e8d978a
snapshots
comcalvi May 4, 2023
8cef984
merge conflicts
comcalvi May 5, 2023
19bcca9
integ test conflicts pt2
comcalvi May 5, 2023
4281cc3
snap
comcalvi May 9, 2023
c5a9845
more merge conflicts
comcalvi May 9, 2023
60482e5
stepfunctions
comcalvi May 9, 2023
6c77eba
Merge branch 'main' into epolon/eks-creation-role-trust-policy
comcalvi May 9, 2023
c90b351
cleanup
iliapolo May 10, 2023
94c759b
cleanup
iliapolo May 10, 2023
4e5805d
cleanup
iliapolo May 10, 2023
3942a30
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 10, 2023
9c0f62e
fix unit tests
iliapolo May 10, 2023
870490e
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 10, 2023
4b64e50
snapshots
iliapolo May 10, 2023
bc8665a
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 10, 2023
4b1ce65
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 11, 2023
01d6d05
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 14, 2023
dd92079
kubectl provider role is not in the main stack
iliapolo May 14, 2023
36d4dfe
remove stale files
iliapolo May 14, 2023
3242e99
fix unit tests
iliapolo May 14, 2023
3bb1c61
snapshots
iliapolo May 15, 2023
3389486
snapshots
iliapolo May 15, 2023
305cc6d
dummy
iliapolo May 15, 2023
248344b
revert dummy
iliapolo May 15, 2023
82512a2
snapshots
iliapolo May 15, 2023
3498490
Merge branch 'main' into epolon/eks-creation-role-trust-policy
iliapolo May 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
snapshots
  • Loading branch information
iliapolo committed May 10, 2023
commit 4b64e50f45e977e58f31ff49c17116da50920a11
Original file line number Diff line number Diff line change
@@ -118,41 +118,41 @@
}
}
},
"4c6918bf63f8b24e5209d75ea2a9081c8c5644044af3c9d170914ed24570d0a3": {
"98c9c6774eb739bb973566660e567a27891cac36bd47546d9c0a0816bebce538": {
"source": {
"path": "awscdkeksclusteralbcontrollertestawscdkawseksClusterResourceProvider5DBBAFBB.nested.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "4c6918bf63f8b24e5209d75ea2a9081c8c5644044af3c9d170914ed24570d0a3.json",
"objectKey": "98c9c6774eb739bb973566660e567a27891cac36bd47546d9c0a0816bebce538.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"2a9b6f878c47ebd8f226474bb748ab8daf1a747a28bcf1035189b3e0c01e93c0": {
"3464accca5ca710ddd803fb731922cbe4f32e230a553d9079bf35e97473877d5": {
"source": {
"path": "awscdkeksclusteralbcontrollertestawscdkawseksKubectlProviderA1AC28D1.nested.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "2a9b6f878c47ebd8f226474bb748ab8daf1a747a28bcf1035189b3e0c01e93c0.json",
"objectKey": "3464accca5ca710ddd803fb731922cbe4f32e230a553d9079bf35e97473877d5.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"ae64b33010df76aee1d15714cd0806dc19774e4d8aeed09bafc2dcb97fe6ead9": {
"1e6d4e76c3eb320afe356ba03fa32c0962ed1b5de8c75f72b599f2aeddfe5121": {
"source": {
"path": "aws-cdk-eks-cluster-alb-controller-test.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "ae64b33010df76aee1d15714cd0806dc19774e4d8aeed09bafc2dcb97fe6ead9.json",
"objectKey": "1e6d4e76c3eb320afe356ba03fa32c0962ed1b5de8c75f72b599f2aeddfe5121.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Original file line number Diff line number Diff line change
@@ -408,6 +408,117 @@
"LicenseInfo": "Apache-2.0"
}
},
"ClusterKubectlHandlerRole94549F93": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
]
]
},
{
"Fn::If": [
"ClusterHasEcrPublic8EE1114E",
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly"
]
]
},
{
"Ref": "AWS::NoValue"
}
]
}
]
}
},
"ClusterKubectlHandlerRoleDefaultPolicyE44083DD": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "eks:DescribeCluster",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"Cluster9EE0221C",
"Arn"
]
}
},
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"ClusterCreationRole360249B6",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "ClusterKubectlHandlerRoleDefaultPolicyE44083DD",
"Roles": [
{
"Ref": "ClusterKubectlHandlerRole94549F93"
}
]
}
},
"ClusterRoleFA261979": {
"Type": "AWS::IAM::Role",
"Properties": {
@@ -467,7 +578,7 @@
"AWS": [
{
"Fn::GetAtt": [
"KubectlHandlerRoleD25EBD08",
"ClusterKubectlHandlerRole94549F93",
"Arn"
]
},
@@ -941,7 +1052,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/4c6918bf63f8b24e5209d75ea2a9081c8c5644044af3c9d170914ed24570d0a3.json"
"/98c9c6774eb739bb973566660e567a27891cac36bd47546d9c0a0816bebce538.json"
]
]
}
@@ -968,14 +1079,14 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/2a9b6f878c47ebd8f226474bb748ab8daf1a747a28bcf1035189b3e0c01e93c0.json"
"/3464accca5ca710ddd803fb731922cbe4f32e230a553d9079bf35e97473877d5.json"
]
]
},
"Parameters": {
"referencetoawscdkeksclusteralbcontrollertestKubectlHandlerRole00B715AEArn": {
"referencetoawscdkeksclusteralbcontrollertestClusterKubectlHandlerRole205F60D2Arn": {
"Fn::GetAtt": [
"KubectlHandlerRoleD25EBD08",
"ClusterKubectlHandlerRole94549F93",
"Arn"
]
},
@@ -997,8 +1108,8 @@
}
},
"DependsOn": [
"KubectlHandlerRoleDefaultPolicyA09B4223",
"KubectlHandlerRoleD25EBD08",
"ClusterKubectlHandlerRoleDefaultPolicyE44083DD",
"ClusterKubectlHandlerRole94549F93",
"VpcPrivateSubnet1DefaultRouteBE02A9ED",
"VpcPrivateSubnet1RouteTableAssociation70C59FA6",
"VpcPrivateSubnet2DefaultRoute060D2087",
@@ -1007,107 +1118,6 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"KubectlHandlerRoleD25EBD08": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
]
]
},
{
"Fn::If": [
"HasEcrPublic",
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly"
]
]
},
{
"Ref": "AWS::NoValue"
}
]
}
]
}
},
"KubectlHandlerRoleDefaultPolicyA09B4223": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "eks:DescribeCluster",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"Cluster9EE0221C",
"Arn"
]
}
}
],
"Version": "2012-10-17"
},
"PolicyName": "KubectlHandlerRoleDefaultPolicyA09B4223",
"Roles": [
{
"Ref": "KubectlHandlerRoleD25EBD08"
}
]
}
},
"awscdkeksclusteralbcontrollertestCluster481F6464AlbControlleralbsaConditionJsonCB1A2F4A": {
"Type": "Custom::AWSCDKCfnJson",
"Properties": {
@@ -1864,7 +1874,7 @@
}
},
"Conditions": {
"HasEcrPublic": {
"ClusterHasEcrPublic8EE1114E": {
"Fn::Equals": [
{
"Ref": "AWS::Partition"
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"S3Key": "9017774b84ae2457b1b2ad6fcbb4860d8ce2537062c77010b24d9b156ced5a1b.zip"
},
"Role": {
"Ref": "referencetoawscdkeksclusteralbcontrollertestKubectlHandlerRole00B715AEArn"
"Ref": "referencetoawscdkeksclusteralbcontrollertestClusterKubectlHandlerRole205F60D2Arn"
},
"Description": "onEvent handler for EKS kubectl resource provider",
"Handler": "index.handler",
@@ -201,7 +201,7 @@
}
},
"Parameters": {
"referencetoawscdkeksclusteralbcontrollertestKubectlHandlerRole00B715AEArn": {
"referencetoawscdkeksclusteralbcontrollertestClusterKubectlHandlerRole205F60D2Arn": {
"Type": "String"
},
"referencetoawscdkeksclusteralbcontrollertestKubectlLayerD13282C5Ref": {
Loading