Skip to content

Commit 5a5a0b1

Browse files
authored
Update S3 access policy in cloudlogs-related templates (#108)
1 parent 6e9bd4b commit 5a5a0b1

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

templates_cloudlogs/CloudLogs.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Metadata:
1414
- ExternalID
1515
- TrustedIdentity
1616
- BucketARN
17+
- AccountID
1718

1819
ParameterLabels:
1920
CloudLogsRoleName:
@@ -24,6 +25,8 @@ Metadata:
2425
default: "Trusted Identity (Sysdig use only)"
2526
BucketARN:
2627
default: "Bucket ARN"
28+
AccountID:
29+
default: "Account ID"
2730

2831
Parameters:
2932
CloudLogsRoleName:
@@ -38,6 +41,9 @@ Parameters:
3841
BucketARN:
3942
Type: String
4043
Description: The ARN of your s3 bucket associated with your Cloudtrail trail.
44+
AccountID:
45+
Type: String
46+
Description: The Identifier of your AWS account.
4147

4248
Resources:
4349
CloudLogsRole:
@@ -62,13 +68,19 @@ Resources:
6268
PolicyDocument:
6369
Version: "2012-10-17"
6470
Statement:
65-
- Sid: "CloudlogsS3Access"
71+
- Sid: "CloudlogsS3AccessGet"
6672
Effect: "Allow"
6773
Action:
6874
- "s3:Get*"
69-
- "s3:List*"
7075
Resource:
7176
- !Sub '${BucketARN}'
7277
- !Sub '${BucketARN}/*'
78+
- Sid: "CloudlogsS3AccessList"
79+
Effect: "Allow"
80+
Action:
81+
- "s3:List*"
82+
Resource:
83+
- !Sub '${BucketARN}/AWSLogs/${AccountID}'
84+
- !Sub '${BucketARN}/AWSLogs/${AccountID}/*'
7385
Roles:
7486
- Ref: "CloudLogsRole"

templates_cloudlogs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ packaged-template-org.yaml:
4747
aws s3 rm s3://$(S3_BUCKET)/cloudlogs/org/$(S3_PREFIX) --recursive
4848
aws cloudformation package \
4949
--region $(S3_REGION) \
50-
--template-file OrgCloudlogs.yaml \
50+
--template-file OrgCloudLogs.yaml \
5151
--s3-bucket $(S3_BUCKET) \
5252
--s3-prefix cspm/$(S3_PREFIX) \
5353
--force-upload \

templates_cloudlogs/OrgCloudLogs.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Metadata:
1616
- ExternalID
1717
- TrustedIdentity
1818
- BucketARN
19+
- AccountID
1920

2021
ParameterLabels:
2122
CSPMRoleName:
@@ -28,6 +29,8 @@ Metadata:
2829
default: "Trusted Identity (Sysdig use only)"
2930
BucketARN:
3031
default: "Bucket ARN"
32+
AccountID:
33+
default: "Account ID"
3134

3235
Parameters:
3336
CSPMRoleName:
@@ -45,6 +48,9 @@ Parameters:
4548
BucketARN:
4649
Type: String
4750
Description: The ARN of your s3 bucket associated with your Cloudtrail trail.
51+
AccountID:
52+
Type: String
53+
Description: The Identifier of your AWS account.
4854

4955
Resources:
5056
CloudLogsRole:
@@ -69,14 +75,20 @@ Resources:
6975
PolicyDocument:
7076
Version: "2012-10-17"
7177
Statement:
72-
- Sid: "CloudlogsS3Access"
78+
- Sid: "CloudlogsS3AccessGet"
7379
Effect: "Allow"
7480
Action:
7581
- "s3:Get*"
76-
- "s3:List*"
7782
Resource:
7883
- !Sub '${BucketARN}'
7984
- !Sub '${BucketARN}/*'
85+
- Sid: "CloudlogsS3AccessList"
86+
Effect: "Allow"
87+
Action:
88+
- "s3:List*"
89+
Resource:
90+
- !Sub '${BucketARN}/AWSLogs/${AccountID}'
91+
- !Sub '${BucketARN}/AWSLogs/${AccountID}/*'
8092
Roles:
8193
- Ref: "CloudLogsRole"
8294
CloudAgentlessRole:

templates_cspm_cloudlogs/FullInstall.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Metadata:
1212
- ExternalID
1313
- TrustedIdentity
1414
- BucketARN
15+
- AccountID
1516

1617
ParameterLabels:
1718
CSPMRoleName:
@@ -24,6 +25,8 @@ Metadata:
2425
default: "Trusted Identity (Sysdig use only)"
2526
BucketARN:
2627
default: "Bucket ARN"
28+
AccountID:
29+
default: "Account ID"
2730

2831
Parameters:
2932
CSPMRoleName:
@@ -41,6 +44,9 @@ Parameters:
4144
BucketARN:
4245
Type: String
4346
Description: The ARN of your s3 bucket associated with your Cloudtrail trail.
47+
AccountID:
48+
Type: String
49+
Description: The Identifier of your AWS account.
4450

4551
Resources:
4652
CloudAgentlessRole:
@@ -82,13 +88,19 @@ Resources:
8288
PolicyDocument:
8389
Version: "2012-10-17"
8490
Statement:
85-
- Sid: "CloudlogsS3Access"
91+
- Sid: "CloudlogsS3AccessGet"
8692
Effect: "Allow"
8793
Action:
8894
- "s3:Get*"
89-
- "s3:List*"
9095
Resource:
9196
- !Sub '${BucketARN}'
9297
- !Sub '${BucketARN}/*'
98+
- Sid: "CloudlogsS3AccessList"
99+
Effect: "Allow"
100+
Action:
101+
- "s3:List*"
102+
Resource:
103+
- !Sub '${BucketARN}/AWSLogs/${AccountID}'
104+
- !Sub '${BucketARN}/AWSLogs/${AccountID}/*'
93105
Roles:
94106
- Ref: "CloudLogsRole"

templates_cspm_cloudlogs/OrgFullInstall.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Metadata:
1313
- TrustedIdentity
1414
- BucketARN
1515
- OrganizationUnitIDs
16+
- AccountID
1617

1718
ParameterLabels:
1819
CSPMRoleName:
@@ -27,6 +28,8 @@ Metadata:
2728
default: "Trusted Identity (Sysdig use only)"
2829
OrganizationUnitIDs:
2930
default: "Organization Unit IDs (Sysdig use only)"
31+
AccountID:
32+
default: "Account ID"
3033

3134
Parameters:
3235
CSPMRoleName:
@@ -47,6 +50,9 @@ Parameters:
4750
OrganizationUnitIDs:
4851
Type: String
4952
Description: Organization Unit IDs to deploy
53+
AccountID:
54+
Type: String
55+
Description: The Identifier of your AWS account.
5056

5157
Resources:
5258
CloudAgentlessRole:
@@ -87,14 +93,20 @@ Resources:
8793
PolicyDocument:
8894
Version: "2012-10-17"
8995
Statement:
90-
- Sid: "CloudlogsS3Access"
96+
- Sid: "CloudlogsS3AccessGet"
9197
Effect: "Allow"
9298
Action:
9399
- "s3:Get*"
94-
- "s3:List*"
95100
Resource:
96101
- !Sub '${BucketARN}'
97102
- !Sub '${BucketARN}/*'
103+
- Sid: "CloudlogsS3AccessList"
104+
Effect: "Allow"
105+
Action:
106+
- "s3:List*"
107+
Resource:
108+
- !Sub '${BucketARN}/AWSLogs/${AccountID}'
109+
- !Sub '${BucketARN}/AWSLogs/${AccountID}/*'
98110
Roles:
99111
- Ref: "CloudLogsRole"
100112
RolesStackSet:

0 commit comments

Comments
 (0)