-
Notifications
You must be signed in to change notification settings - Fork 0
/
sra-securityhub-org-main-ssm.yaml
385 lines (372 loc) · 15.4 KB
/
sra-securityhub-org-main-ssm.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
########################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
########################################################################
AWSTemplateFormatVersion: 2010-09-09
Description:
This template creates a custom resource Lambda to delegate administration and configure SecurityHub within an AWS Organization - 'securityhub_org'
solution in the repo, https://github.com/aws-samples/aws-security-reference-architecture-examples (sra-1ssgnse6b)
Metadata:
SRA:
Version: 1.5
Entry: Parameters for deploying the solution resolving SSM parameters
Order: 1
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: General Properties
Parameters:
- pSRASolutionName
- pSRASolutionVersion
- pSRAStagingS3BucketName
- pSRAAlarmEmail
- pAuditAccountId
- pRootOrganizationalUnitId
- pOrganizationId
- pSourceStackName
- Label:
default: IAM Properties
Parameters:
- pStackSetAdminRole
- pStackExecutionRole
- Label:
default: SecurityHub Configuration Properties
Parameters:
- pDisableSecurityHub
- pEnableSecurityBestPracticesStandard
- pEnableCISStandard
- pCISStandardVersion
- pEnablePCIStandard
- pEnableNISTStandard
- pNISTStandardVersion
- pRegionLinkingMode
- pControlTowerRegionsOnly
- pEnabledRegions
- Label:
default: General Lambda Function Properties
Parameters:
- pCreateLambdaLogGroup
- pLambdaLogGroupRetention
- pLambdaLogGroupKmsKey
- pLambdaLogLevel
- Label:
default: EventBridge Rule Properties
Parameters:
- pComplianceFrequency
ParameterLabels:
pStackSetAdminRole:
default: Stack Set Role
pStackExecutionRole:
default: Stack execution role
pAuditAccountId:
default: Audit Account ID
pCISStandardVersion:
default: CIS Standard Version
pComplianceFrequency:
default: Frequency to Check for Organizational Compliance
pControlTowerRegionsOnly:
default: Control Tower Regions Only
pCreateLambdaLogGroup:
default: Create Lambda Log Group
pDisableSecurityHub:
default: Disable Security Hub
pEnableCISStandard:
default: Enable CIS Standard
pEnablePCIStandard:
default: Enable PCI Standard
pEnableNISTStandard:
default: Enable NIST Standard
pEnableSecurityBestPracticesStandard:
default: Enable AWS Foundational Security Best Practices Standard
pEnabledRegions:
default: (Optional) Enabled Regions
pLambdaLogGroupKmsKey:
default: (Optional) Lambda Logs KMS Key
pLambdaLogGroupRetention:
default: Lambda Log Group Retention
pLambdaLogLevel:
default: Lambda Log Level
pNISTStandardVersion:
default: NIST Standard Version
pOrganizationId:
default: Organization ID
pRegionLinkingMode:
default: Region Linking Mode
pRootOrganizationalUnitId:
default: Root Organizational Unit ID
pSourceStackName:
default: (Optional) Source Stack Name
pSRAAlarmEmail:
default: (Optional) SRA Alarm Email
pSRASolutionName:
default: SRA Solution Name
pSRASolutionVersion:
default: SRA Solution Version
pSRAStagingS3BucketName:
default: SRA Staging S3 Bucket Name
Parameters:
pStackSetAdminRole:
AllowedValues: [sra-stackset]
Default: sra-stackset
Description: The administration role name that is used in the stackset.
Type: String
pStackExecutionRole:
AllowedValues: [sra-execution]
Default: sra-execution
Description: The execution role name that is used in the stack.
Type: String
pAuditAccountId:
AllowedPattern: '^([\w.-]{1,900})$|^(\/[\w.-]{1,900})*[\w.-]{1,900}$'
ConstraintDescription:
Must be alphanumeric or special characters [., _, -]. In addition, the slash character ( / ) used to delineate hierarchies in parameter names.
Default: /sra/control-tower/audit-account-id
Description: SSM Parameter for AWS Account ID of the Control Tower account to delegate administration.
Type: AWS::SSM::Parameter::Value<String>
pCISStandardVersion:
AllowedValues: [1.2.0, 1.4.0]
Default: 1.4.0
Description: CIS Standard Version
Type: String
pComplianceFrequency:
ConstraintDescription: Compliance Frequency must be a number between 1 and 30, inclusive.
Default: 7
Description: Frequency (in days between 1 and 30, default is 7) to check organizational compliance by invoking the Lambda Function.
MinValue: 1
MaxValue: 30
Type: Number
pControlTowerRegionsOnly:
AllowedValues: ['true', 'false']
Default: 'true'
Description: Only enable in the Control Tower governed regions
Type: String
pCreateLambdaLogGroup:
AllowedValues: ['true', 'false']
Default: 'false'
Description:
Indicates whether a CloudWatch Log Group should be explicitly created for the Lambda function, to allow for setting a Log Retention and/or KMS
Key for encryption.
Type: String
pDisableSecurityHub:
AllowedValues: ['true', 'false']
Default: 'false'
Description: Update to 'true' to disable Security Hub in all accounts and regions before deleting the stack.
Type: String
pEnableCISStandard:
AllowedValues: ['true', 'false']
Default: 'false'
Description: Indicates whether to enable the CIS AWS Foundations Benchmark Standard.
Type: String
pEnabledRegions:
AllowedPattern: '^$|^([a-z0-9-]{1,64})$|^(([a-z0-9-]{1,64},)*[a-z0-9-]{1,64})$'
ConstraintDescription:
Only lowercase letters, numbers, and hyphens ('-') allowed. (e.g. us-east-1) Additional AWS regions can be provided, separated by commas. (e.g.
us-east-1,ap-southeast-2)
Default: ''
Description: (Optional) Enabled regions (AWS regions, separated by commas). Leave blank to enable all regions.
Type: String
pEnablePCIStandard:
AllowedValues: ['true', 'false']
Default: 'false'
Description: Indicates whether to enable the Payment Card Industry Data Security Standard (PCI DSS).
Type: String
pEnableNISTStandard:
AllowedValues: ['true', 'false']
Default: 'false'
Description: Indicates whether to enable the National Institute of Standards and Technology (NIST) SP 800-53 Rev. 5.
Type: String
pEnableSecurityBestPracticesStandard:
AllowedValues: ['true', 'false']
Default: 'true'
Description: Indicates whether to enable the AWS Foundational Security Best Practices Standard.
Type: String
pLambdaLogGroupKmsKey:
AllowedPattern: '^$|^arn:(aws[a-zA-Z-]*){1}:kms:[a-z0-9-]+:\d{12}:key\/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$'
ConstraintDescription: 'Key ARN example: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab'
Default: ''
Description:
(Optional) KMS Key ARN to use for encrypting the Lambda logs data. If empty, encryption is enabled with CloudWatch Logs managing the server-side
encryption keys.
Type: String
pLambdaLogGroupRetention:
AllowedValues: [1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653]
Default: 14
Description: Specifies the number of days you want to retain log events
Type: String
pLambdaLogLevel:
AllowedValues: [INFO, ERROR, DEBUG]
Default: INFO
Description: Lambda Function Logging Level
Type: String
pNISTStandardVersion:
AllowedValues: [5.0.0]
Default: 5.0.0
Description: NIST Standard Version
Type: String
pOrganizationId:
AllowedPattern: '^([\w.-]{1,900})$|^(\/[\w.-]{1,900})*[\w.-]{1,900}$'
ConstraintDescription:
Must be alphanumeric or special characters [., _, -]. In addition, the slash character ( / ) used to delineate hierarchies in parameter names.
Default: /sra/control-tower/organization-id
Description: SSM Parameter for AWS Organizations ID
Type: AWS::SSM::Parameter::Value<String>
pRegionLinkingMode:
AllowedValues: [SPECIFIED_REGIONS, ALL_REGIONS]
Default: SPECIFIED_REGIONS
Description:
Indicates whether to aggregate findings from all of the available Regions in the current partition. Also determines whether to automatically
aggregate findings from new Regions as Security Hub supports them and you opt into them.
Type: String
pRootOrganizationalUnitId:
AllowedPattern: '^([\w.-]{1,900})$|^(\/[\w.-]{1,900})*[\w.-]{1,900}$'
ConstraintDescription:
Must be alphanumeric or special characters [., _, -]. In addition, the slash character ( / ) used to delineate hierarchies in parameter names.
Default: /sra/control-tower/root-organizational-unit-id
Description: SSM Parameter for Root Organizational Unit ID
Type: AWS::SSM::Parameter::Value<String>
pSourceStackName:
Default: ''
Description:
(Optional) Input parameter used for the source stack name e.g. Quick Setup. This parameter is used to handle the DependsOn requirement for the
Config Management Account solution within the Quick Setup solution.
Type: String
pSRAAlarmEmail:
AllowedPattern: '^$|^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)$'
ConstraintDescription: Must be a valid email address.
Default: ''
Description: (Optional) Email address for receiving SRA alarms
Type: String
pSRASolutionName:
AllowedValues: [sra-securityhub-org]
Default: sra-securityhub-org
Description: The SRA solution name. The default value is the folder name of the solution
Type: String
pSRAStagingS3BucketName:
AllowedPattern: '^([\w.-]{1,900})$|^(\/[\w.-]{1,900})*[\w.-]{1,900}$'
ConstraintDescription:
Must be alphanumeric or special characters [., _, -]. In addition, the slash character ( / ) used to delineate hierarchies in parameter names.
Default: /sra/staging-s3-bucket-name
Description:
SSM Parameter for SRA Staging S3 bucket name for the artifacts relevant to solution. (e.g., lambda zips, CloudFormation templates) S3 bucket
name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-).
Type: AWS::SSM::Parameter::Value<String>
pSRASolutionVersion:
AllowedValues: [v1.5]
Default: v1.5
Description: The SRA solution version. Used to trigger updates on the nested StackSets.
Type: String
Conditions:
cNotGlobalRegionUsEast1: !Not [!Equals [!Ref 'AWS::Region', us-east-1]]
Resources:
rSecurityHubConfigurationIAMRoleStackSet:
Type: AWS::CloudFormation::StackSet
Properties:
StackSetName: sra-securityhub-org-configuration-role
AutoDeployment:
Enabled: true
RetainStacksOnAccountRemoval: false
CallAs: SELF
Capabilities:
- CAPABILITY_NAMED_IAM
Description: !Sub ${pSRASolutionVersion} - Deploys an IAM role via ${pSRASolutionName} for configuring SecurityHub
ManagedExecution:
Active: true
OperationPreferences:
FailureTolerancePercentage: 100
MaxConcurrentPercentage: 100
RegionConcurrencyType: PARALLEL
PermissionModel: SERVICE_MANAGED
StackInstancesGroup:
- DeploymentTargets:
OrganizationalUnitIds:
- !Ref pRootOrganizationalUnitId
Regions:
- !Ref AWS::Region
TemplateURL: !Sub https://${pSRAStagingS3BucketName}.s3.${AWS::Region}.${AWS::URLSuffix}/${pSRASolutionName}/templates/sra-securityhub-org-configuration-role.yaml
Parameters:
- ParameterKey: pDelegatedAdminAccountId
ParameterValue: !Ref pAuditAccountId
- ParameterKey: pManagementAccountId
ParameterValue: !Ref AWS::AccountId
Tags:
- Key: sra-solution
Value: !Ref pSRASolutionName
rSecurityHubConfigurationIAMRoleStack:
Type: AWS::CloudFormation::Stack
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Properties:
TemplateURL: !Sub https://${pSRAStagingS3BucketName}.s3.${AWS::Region}.${AWS::URLSuffix}/${pSRASolutionName}/templates/sra-securityhub-org-configuration-role.yaml
Parameters:
pDelegatedAdminAccountId: !Ref pAuditAccountId
pManagementAccountId: !Ref AWS::AccountId
Tags:
- Key: sra-solution
Value: !Ref pSRASolutionName
rSecurityHubConfigurationStack:
Type: AWS::CloudFormation::Stack
DeletionPolicy: Delete
DependsOn:
- rSecurityHubConfigurationIAMRoleStackSet
- rSecurityHubConfigurationIAMRoleStack
UpdateReplacePolicy: Delete
Properties:
TemplateURL: !Sub https://${pSRAStagingS3BucketName}.s3.${AWS::Region}.${AWS::URLSuffix}/${pSRASolutionName}/templates/sra-securityhub-org-configuration.yaml
Parameters:
pCISStandardVersion: !Ref pCISStandardVersion
pComplianceFrequency: !Ref pComplianceFrequency
pControlTowerRegionsOnly: !Ref pControlTowerRegionsOnly
pCreateLambdaLogGroup: !Ref pCreateLambdaLogGroup
pDelegatedAdminAccountId: !Ref pAuditAccountId
pDisableSecurityHub: !Ref pDisableSecurityHub
pEnableCISStandard: !Ref pEnableCISStandard
pEnablePCIStandard: !Ref pEnablePCIStandard
pEnableNISTStandard: !Ref pEnableNISTStandard
pEnableSecurityBestPracticesStandard: !Ref pEnableSecurityBestPracticesStandard
pEnabledRegions: !Ref pEnabledRegions
pLambdaLogGroupKmsKey: !Ref pLambdaLogGroupKmsKey
pLambdaLogGroupRetention: !Ref pLambdaLogGroupRetention
pLambdaLogLevel: !Ref pLambdaLogLevel
pNISTStandardVersion: !Ref pNISTStandardVersion
pOrganizationId: !Ref pOrganizationId
pRegionLinkingMode: !Ref pRegionLinkingMode
pSRAAlarmEmail: !Ref pSRAAlarmEmail
pSRAStagingS3BucketName: !Ref pSRAStagingS3BucketName
Tags:
- Key: sra-solution
Value: !Ref pSRASolutionName
rSecurityHubConfigRecorderStartEventRuleStackSet:
Type: AWS::CloudFormation::StackSet
DependsOn: rSecurityHubConfigurationStack
Properties:
StackSetName: sra-securityhub-org-config-recorder-start-event-rule
AutoDeployment:
Enabled: true
RetainStacksOnAccountRemoval: false
CallAs: SELF
Capabilities:
- CAPABILITY_NAMED_IAM
Description: !Sub ${pSRASolutionVersion} - Deploys an event rule via ${pSRASolutionName} for config recorder start events
ManagedExecution:
Active: true
OperationPreferences:
FailureTolerancePercentage: 100
MaxConcurrentPercentage: 100
RegionConcurrencyType: PARALLEL
PermissionModel: SERVICE_MANAGED
StackInstancesGroup:
- DeploymentTargets:
OrganizationalUnitIds:
- !Ref pRootOrganizationalUnitId
Regions:
- !Ref AWS::Region
TemplateURL: !Sub https://${pSRAStagingS3BucketName}.s3.${AWS::Region}.${AWS::URLSuffix}/${pSRASolutionName}/templates/sra-securityhub-org-recorder-start-event.yaml
Parameters:
- ParameterKey: pManagementAccountId
ParameterValue: !Ref AWS::AccountId
Tags:
- Key: sra-solution
Value: !Ref pSRASolutionName
Outputs:
oSourceStackName:
Description: Source stack name parameter used for orchestration solutions like the Quick Setup.
Value: !Ref pSourceStackName