Skip to content

Commit 670d825

Browse files
Add support in org scenario
1 parent 44bc54e commit 670d825

File tree

1 file changed

+72
-7
lines changed

1 file changed

+72
-7
lines changed

templates_cloudlogs/OrgCloudLogs.yaml

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22
Description: >
33
CloudFormation organizational template for provisioning
4-
the necessary resources for the `cloud-logs`
5-
component and the read-only role required to itneract with
6-
the target organizational environment.
4+
the necessary resources for the `cloud-logs` component and the read-only role required to interact with the target organizational environment.
75
86
Metadata:
97
AWS::CloudFormation::Interface:
@@ -16,6 +14,9 @@ Metadata:
1614
- ExternalID
1715
- TrustedIdentity
1816
- BucketARN
17+
- CreateTopic
18+
- TopicARN
19+
- Endpoint
1920

2021
ParameterLabels:
2122
CSPMRoleName:
@@ -28,23 +29,44 @@ Metadata:
2829
default: "Trusted Identity (Sysdig use only)"
2930
BucketARN:
3031
default: "Bucket ARN"
32+
CreateTopic:
33+
default: "Create SNS Topic"
34+
TopicARN:
35+
default: "SNS Topic ARN"
36+
Endpoint:
37+
default: "Sysdig Secure endpoint"
3138

3239
Parameters:
3340
CSPMRoleName:
3441
Type: String
3542
Description: The name of the read-only IAM Role that Sysdig will use to interact with the target environment
3643
CloudLogsRoleName:
3744
Type: String
38-
Description: The name of the IAM Role that will enable access to the Cloudtrail logs.
45+
Description: The name of the IAM Role that will enable access to the CloudTrail logs.
3946
ExternalID:
4047
Type: String
4148
Description: Random string generated unique to a customer.
4249
TrustedIdentity:
4350
Type: String
44-
Description: The name of Sysdig trusted identity.
51+
Description: The name of Sysdig's trusted identity.
4552
BucketARN:
4653
Type: String
47-
Description: The ARN of your s3 bucket associated with your Cloudtrail trail.
54+
Description: The ARN of your S3 bucket associated with your CloudTrail trail.
55+
CreateTopic:
56+
Type: String
57+
AllowedValues:
58+
- "true"
59+
- "false"
60+
Default: "false"
61+
Description: "Whether to create a new SNS Topic for CloudTrail notifications."
62+
TopicARN:
63+
Type: String
64+
Default: ""
65+
Description: "The ARN of an existing SNS Topic. If CreateTopic is true, this will be used as the name of the new topic."
66+
Endpoint:
67+
Type: String
68+
Default: ""
69+
Description: "Sysdig Secure endpoint to receive CloudTrail notifications."
4870

4971
Resources:
5072
CloudLogsRole:
@@ -62,6 +84,7 @@ Resources:
6284
Condition:
6385
StringEquals:
6486
"sts:ExternalId": !Ref ExternalID
87+
6588
CloudLogsRolePolicies:
6689
Type: "AWS::IAM::Policy"
6790
Properties:
@@ -84,7 +107,8 @@ Resources:
84107
- !Sub '${BucketARN}'
85108
- !Sub '${BucketARN}/*'
86109
Roles:
87-
- Ref: "CloudLogsRole"
110+
- !Ref CloudLogsRole
111+
88112
CloudAgentlessRole:
89113
Type: "AWS::IAM::Role"
90114
Properties:
@@ -101,3 +125,44 @@ Resources:
101125
sts:ExternalId: !Ref ExternalID
102126
ManagedPolicyArns:
103127
- arn:aws:iam::aws:policy/SecurityAudit
128+
129+
CloudTrailNotificationsTopic:
130+
Condition: CreateSNSTopic
131+
Type: "AWS::SNS::Topic"
132+
Properties:
133+
TopicName: !Select [ 5, !Split [ ":", !Ref TopicARN ] ]
134+
135+
CloudTrailNotificationsSubscription:
136+
Type: "AWS::SNS::Subscription"
137+
Properties:
138+
TopicArn: !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
139+
Protocol: "https"
140+
Endpoint: !Ref Endpoint
141+
142+
CloudTrailNotificationsPolicy:
143+
Condition: CreateSNSTopic
144+
Type: "AWS::SNS::TopicPolicy"
145+
Properties:
146+
Topics:
147+
- !Ref CloudTrailNotificationsTopic
148+
PolicyDocument:
149+
Version: "2012-10-17"
150+
Statement:
151+
- Sid: "AllowCloudTrailPublish"
152+
Effect: "Allow"
153+
Principal:
154+
Service: "cloudtrail.amazonaws.com"
155+
Action: "SNS:Publish"
156+
Resource: !Ref CloudTrailNotificationsTopic
157+
158+
Conditions:
159+
CreateSNSTopic: !Equals [!Ref CreateTopic, "true"]
160+
161+
Outputs:
162+
RoleARN:
163+
Description: "The ARN of the IAM Role created for CloudTrail logs."
164+
Value: !GetAtt CloudLogsRole.Arn
165+
166+
TopicARN:
167+
Description: "The ARN of the SNS Topic created for CloudTrail notifications."
168+
Value: !If [CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN]

0 commit comments

Comments
 (0)