Skip to content

Commit 2106173

Browse files
committed
Add SCP policies and update some
1 parent c6c05a6 commit 2106173

File tree

7 files changed

+35
-2
lines changed

7 files changed

+35
-2
lines changed

modules/scp/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ No modules.
3535
| [aws_organizations_policy.deny_guardduty_modify](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
3636
| [aws_organizations_policy.deny_member_leaving](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
3737
| [aws_organizations_policy.deny_s3_public](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
38+
| [aws_organizations_policy.deny_s3_unsecure_requests](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
3839
| [aws_organizations_policy.deny_securityhub_disable](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
3940
| [aws_organizations_policy.require_s3_encryption](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/organizations_policy) | resource |
4041

modules/scp/REFERENCES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
https://aws-samples.github.io/aws-iam-permissions-guardrails/guardrails/scp-guardrails.html
3+
https://github.com/ScaleSec/terraform_aws_scp

modules/scp/files/deny-cloudtrail-tamper.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"Effect": "Deny",
77
"Action": [
88
"cloudtrail:DeleteTrail",
9-
"cloudtrail:StopLogging",
109
"cloudtrail:PutEventSelectors",
10+
"cloudtrail:StopLogging",
1111
"cloudtrail:UpdateTrail"
1212
],
1313
"Resource": [

modules/scp/files/deny-config-modify.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
"Effect": "Deny",
77
"Action": [
88
"config:DeleteConfigRule",
9+
"config:DeleteConfigurationAggregator",
910
"config:DeleteConfigurationRecorder",
1011
"config:DeleteDeliveryChannel",
12+
"config:DeleteEvaluationResults",
13+
"config:DeleteRetentionConfiguration",
1114
"config:StopConfigurationRecorder"
1215
],
1316
"Resource": "*"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Sid": "DenyS3UnsecureRequests",
6+
"Effect": "Deny",
7+
"Action": [
8+
"s3:*"
9+
],
10+
"Resource": "*",
11+
"Condition": {
12+
"Bool": {
13+
"aws:SecureTransport": "false"
14+
}
15+
}
16+
}
17+
]
18+
}

modules/scp/files/require-s3-encryption.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Resource": "*",
99
"Condition": {
1010
"StringNotEquals": {
11-
"s3:x-amz-server-side-encryption": "AES256"
11+
"s3:x-amz-server-side-encryption": ["AES256", "aws:kms"]
1212
}
1313
}
1414
},

modules/scp/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ resource "aws_organizations_policy" "deny_s3_public" {
113113
type = "SERVICE_CONTROL_POLICY"
114114
content = file("${path.module}/files/deny-s3-public.json")
115115
}
116+
resource "aws_organizations_policy" "deny_s3_unsecure_requests" {
117+
count = local.enable && var.enable_s3 ? 1 : 0
118+
name = "deny_s3_unsecure_requests"
119+
description = "Prevent S3 unsecured requests"
120+
tags = var.tags
121+
type = "SERVICE_CONTROL_POLICY"
122+
content = file("${path.module}/files/deny-s3-unsecure-requests.json")
123+
}
116124
resource "aws_organizations_policy" "require_s3_encryption" {
117125
count = local.enable && var.enable_s3 ? 1 : 0
118126
name = "require_s3_encryption"

0 commit comments

Comments
 (0)