11AWSTemplateFormatVersion : " 2010-09-09"
22Description : >
3- CloudFormation organizational template for provisioning
4- the necessary resources for the `cloud-logs`
5- component and the read-only role required to itneract with
3+ CloudFormation organizational template for provisioning the necessary resources
4+ for the `cloud-logs` component and the read-only role required to interact with
65 the target organizational environment.
76
87Metadata :
@@ -15,6 +14,9 @@ Metadata:
1514 - ExternalID
1615 - TrustedIdentity
1716 - BucketARN
17+ - CreateTopic
18+ - TopicARN
19+ - Endpoint
1820
1921 ParameterLabels :
2022 NameSuffix :
@@ -25,6 +27,12 @@ Metadata:
2527 default : Trusted Identity
2628 BucketARN :
2729 default : Bucket ARN
30+ CreateTopic :
31+ default : Create SNS Topic
32+ TopicARN :
33+ default : SNS Topic ARN
34+ Endpoint :
35+ default : Sysdig Secure endpoint
2836
2937Parameters :
3038 NameSuffix :
@@ -41,7 +49,20 @@ Parameters:
4149 Description : The Role in Sysdig's AWS Account with permissions to your account
4250 BucketARN :
4351 Type : String
44- Description : The ARN of your s3 bucket associated with your Cloudtrail trail logs.
52+ Description : The ARN of your S3 bucket associated with your CloudTrail trail logs.
53+ CreateTopic :
54+ Type : String
55+ AllowedValues :
56+ - " true"
57+ - " false"
58+ Default : " false"
59+ Description : Whether to create a new SNS Topic for CloudTrail notifications.
60+ TopicARN :
61+ Type : String
62+ Description : The ARN of an existing SNS Topic. If CreateTopic is true, this will be used as the name of the new topic.
63+ Endpoint :
64+ Type : String
65+ Description : Sysdig Secure endpoint to receive CloudTrail notifications.
4566
4667Resources :
4768 CloudLogsRole :
@@ -51,30 +72,60 @@ Resources:
5172 AssumeRolePolicyDocument :
5273 Version : " 2012-10-17"
5374 Statement :
54- - Effect : " Allow"
55- Principal :
56- AWS : !Ref TrustedIdentity
57- Action :
58- - " sts:AssumeRole"
59- Condition :
60- StringEquals :
61- " sts:ExternalId " : !Ref ExternalID
62- Policies :
63- - PolicyName : !Sub sysdig-secure-cloudlogs-${NameSuffix}
64- PolicyDocument :
65- Version : " 2012-10-17"
66- Statement :
67- - Sid : " CloudlogsS3AccessGet"
68- Effect : " Allow"
75+ - Effect : " Allow"
76+ Principal :
77+ AWS : !Ref TrustedIdentity
6978 Action :
70- - " s3:Get*"
71- Resource :
72- - !Sub ' ${BucketARN}'
73- - !Sub ' ${BucketARN}/*'
74- - Sid : " CloudlogsS3AccessList"
79+ - " sts:AssumeRole"
80+ Condition :
81+ StringEquals :
82+ " sts:ExternalId " : !Ref ExternalID
83+ Policies :
84+ - PolicyName : !Sub sysdig-secure-cloudlogs-${NameSuffix}
85+ PolicyDocument :
86+ Version : " 2012-10-17"
87+ Statement :
88+ - Sid : " CloudlogsS3AccessGet"
89+ Effect : " Allow"
90+ Action :
91+ - " s3:Get*"
92+ Resource :
93+ - !Sub ' ${BucketARN}'
94+ - !Sub ' ${BucketARN}/*'
95+
96+ CloudTrailNotificationsTopic :
97+ Condition : CreateSNSTopic
98+ Type : " AWS::SNS::Topic"
99+ Properties :
100+ TopicName : !Select [ 5, !Split [ ":", !Ref TopicARN ] ]
101+
102+ CloudTrailNotificationsSubscription :
103+ Type : " AWS::SNS::Subscription"
104+ Properties :
105+ TopicArn : !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
106+ Protocol : " https"
107+ Endpoint : !Ref Endpoint
108+
109+ CloudTrailNotificationsPolicy :
110+ Condition : CreateSNSTopic
111+ Type : " AWS::SNS::TopicPolicy"
112+ Properties :
113+ Topics :
114+ - !Ref CloudTrailNotificationsTopic
115+ PolicyDocument :
116+ Version : " 2012-10-17"
117+ Statement :
118+ - Sid : " AllowCloudTrailPublish"
75119 Effect : " Allow"
76- Action :
77- - " s3:List*"
78- Resource :
79- - !Sub ' ${BucketARN}'
80- - !Sub ' ${BucketARN}/*'
120+ Principal :
121+ Service : " cloudtrail.amazonaws.com"
122+ Action : " SNS:Publish"
123+ Resource : !Ref CloudTrailNotificationsTopic
124+
125+ Conditions :
126+ CreateSNSTopic : !Equals [ !Ref CreateTopic, "true" ]
127+
128+ Outputs :
129+ TopicARN :
130+ Description : " The ARN of the SNS Topic created for CloudTrail notifications."
131+ Value : !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
0 commit comments