-
Notifications
You must be signed in to change notification settings - Fork 31
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: fix deny exception policy #272
Changes from all commits
b001f57
2ba83fb
c9680cf
e0c6ac0
372c5d5
608d49e
d363838
9af15d6
52cd8d4
b761e3b
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 |
---|---|---|
|
@@ -26,8 +26,7 @@ locals { | |
governance_iamroles = join("\",\"", var.apiary_governance_iamroles) | ||
consumer_prefix_roles = lookup(var.apiary_consumer_prefix_iamroles, schema["schema_name"], {}) | ||
common_producer_iamroles = join("\",\"", var.apiary_common_producer_iamroles) | ||
deny_global_write_access = lookup(schema, "deny_global_write_access", var.deny_global_write_access) | ||
producer_roles = lookup(schema, "producer_roles", var.producer_roles) | ||
deny_exception_iamroles = lookup(schema, "deny_exception_iamroles", "") == "" ? "" : join("\",\"", compact(concat(split(",", schema["deny_exception_iamroles"]), var.apiary_managed_service_iamroles, var.apiary_governance_iamroles))) | ||
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. I am not sure about this anymore. If you add apiary_governance_iamroles and apiary_managed_service_iamroles by default, this means that all buckets will restrict writing from now on. Because in many clauses Before, with my last update, only 1 bucket was affected, and the rest of buckets were with same functionality, but now with these changes, you are forcing all buckets to be restricted. Is that correct? 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. Nope, there is a condition, add it to default only when |
||
}) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,36 @@ | |
%{endif} | ||
%{endfor ~} | ||
%{endif} | ||
%{if deny_global_write_access == "true" && producer_roles != "" } | ||
%{if deny_exception_iamroles != "" } | ||
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. I believe roles have access by default if it is from the same account, right? |
||
{ | ||
"Sid": "Allow write permissions to the exception roles", | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": [ | ||
"s3:GetBucketLocation", | ||
"s3:GetObject", | ||
"s3:GetObjectAcl", | ||
"s3:GetBucketAcl", | ||
"s3:ListBucket", | ||
"s3:PutObject", | ||
"s3:PutObjectAcl", | ||
"s3:DeleteObject", | ||
"s3:GetBucketVersioning", | ||
"s3:PutBucketVersioning", | ||
"s3:ReplicateObject", | ||
"s3:ReplicateDelete", | ||
"s3:ObjectOwnerOverrideToBucketOwner" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::${bucket_name}", | ||
"arn:aws:s3:::${bucket_name}/*" | ||
], | ||
"Condition": { | ||
"StringLike": { | ||
"aws:PrincipalArn": [ "${deny_exception_iamroles}" ] | ||
} | ||
} | ||
}, | ||
{ | ||
"Sid": "Deny write permissions to everything except the specified roles", | ||
"Effect": "Deny", | ||
|
@@ -97,7 +126,7 @@ | |
"Resource": "arn:aws:s3:::${bucket_name}/*", | ||
"Condition": { | ||
"StringNotLike": { | ||
"aws:PrincipalArn": [ "${producer_roles}" ] | ||
"aws:PrincipalArn": [ "${deny_exception_iamroles}" ] | ||
} | ||
} | ||
}, | ||
|
@@ -139,7 +168,7 @@ | |
} | ||
}, | ||
%{endif} | ||
%{if producer_iamroles != ""} | ||
%{if deny_exception_iamroles == "" && producer_iamroles != ""} | ||
{ | ||
"Sid": "Apiary producer iamrole permissions", | ||
"Effect": "Allow", | ||
|
@@ -167,7 +196,7 @@ | |
] | ||
}, | ||
%{endif} | ||
%{if common_producer_iamroles != ""} | ||
%{if deny_exception_iamroles == "" && common_producer_iamroles != ""} | ||
{ | ||
"Sid": "General read-write iamrole permissions", | ||
"Effect": "Allow", | ||
|
@@ -198,7 +227,7 @@ | |
} | ||
}, | ||
%{endif} | ||
%{if governance_iamroles != ""} | ||
%{if deny_exception_iamroles == "" && governance_iamroles != ""} | ||
{ | ||
"Sid": "Apiary governance iamrole permissions", | ||
"Effect": "Allow", | ||
|
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.
Why do we need this section specifically for system bucket?
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.
the producer iam role does not apply to system buckets and s3 access log, as well as s3 inventory buckets