forked from awslabs/aws-config-engine-for-compliance-as-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication-account-ruleset-pci-guidance-8-rules-setup.yaml
332 lines (307 loc) · 11 KB
/
application-account-ruleset-pci-guidance-8-rules-setup.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
#
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# This RuleSet provides guidance for achieving the Payment Card Industry Data Security Standard (PCI DSS) in Amazon Web Services. This content is provided "as is" with no guarantees expressed or implied. The content of this RuleSet is subject to change without notice. Likewise, future changes to the AWS environment may alter some of the guidance in this RuleSet. Your PCI assessor may have different interpretations and the guidance in this RuleSet. None of the content in this RuleSet is intended to replace or supersede the requirements of the PCI DSS.
#
# Intent
# While this RuleSet discusses AWS aspects useful for validating PCI compliance readiness as well as formal compliance, it does not offer step-by-step instructions on conducting an assessment of an AWS environment. However, it may assist QSAs in understanding how an AWS environment can be PCI-compliant.
#
# The RuleSet provides the following configuration verifications leveraging AWS Config Rules.
#
# This RuleSet has been designed to provide up to 8 managed rules in the Application account depending if it is Prod or Non-Prod.
#
# Rule | Rule Name | Prod | NonProd
# 1 | s3-bucket-public-read-prohibited | Yes | Yes
# 2 | ec2-ebs-volume-encrypted | Yes | Yes
# 3 | rds-multi-az-enabled | Yes | No
# 4 | rds-storage-encrypted | Yes | Yes
# 5 | cloudtrail-enabled | Yes | Yes
# 6 | acm-certificate-expiry-90-days | Yes | No
# 7 | root-account-mfa-enabled | Yes | Yes
# 8 | s3-bucket-ssl-requests-only | Yes | Yes
AWSTemplateFormatVersion: '2010-09-09'
Description: Setup the PCI Guidance RuleSet in Application Account
Parameters:
CentralizedS3BucketConfigFullName:
ConstraintDescription: Enter DNS-compliant name
Description: Bucket name where Config logs are centrally stored. It is located in the Compliance Account.
Default: centralized-config-112233445566
MaxLength: 63
MinLength: 10
Type: String
ComplianceAccountId:
ConstraintDescription: 12 digits, no dashes
Description: Account ID of the Compliance Account is running from
Default: 112233445566
MaxLength: 12
MinLength: 12
Type: String
ComplianceAuditRoleName:
Description: Role Name of the Compliance Account Cross Account Role
Default: ComplianceAuditRole-DO-NOT-DELETE
Type: String
#
# BEGINNING OF THE PARAMETER SECTION TO BE ADAPTED TO YOUR NEEDS
#
AccountClassification:
# AccountClassification is an input parameter in the RuleSetReporter resource.
Description: The classification of this AWS account.
Type: String
Default: 1-Sensitive
AllowedValues:
- 1-Sensitive
- 2-Confidential
- 3-Private
- 4-Public
ConstraintDescription: "must be one of those 4 values: 1-Sensitive | 2-Confidential | 3-Private | 4-Public"
EnvironmentType:
Description: The environment type
Type: String
Default: prod
AllowedValues:
- prod
- nonprod
ConstraintDescription: "must be one of those 2 values: prod | nonprod"
Conditions:
CreateInProd: !Equals [ !Ref EnvironmentType, prod ]
CreateInNonProd: !Equals [ !Ref EnvironmentType, nonprod ]
CreateInProdNonProd: !Or [ !Equals [ !Ref EnvironmentType, prod ], !Equals [ !Ref EnvironmentType, nonprod ]]
#
# END OF THE PARAMETER SECTION TO BE ADAPTED TO YOUR NEEDS
#
Resources:
#
# BEGINNING OF THE RESOURCES SECTION TO BE ADAPTED TO YOUR NEEDS
# Modify your rule set here (sample below). Each new Config rule of the ruleSet needs Config Rule creation. For managed rules, modify the Source parameter.
#
RuleSetRule1:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: s3-bucket-public-read-prohibited
Scope:
ComplianceResourceTypes:
- 'AWS::S3::Bucket'
Source:
Owner: AWS
SourceIdentifier: S3_BUCKET_PUBLIC_READ_PROHIBITED
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule2:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: ec2-ebs-volume-encrypted
Scope:
ComplianceResourceTypes:
- 'AWS::EC2::Volume'
Source:
Owner: AWS
SourceIdentifier: ENCRYPTED_VOLUMES
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule3:
Type: AWS::Config::ConfigRule
Condition: CreateInProd
Properties:
ConfigRuleName: rds-multi-az-enabled
Scope:
ComplianceResourceTypes:
- 'AWS::RDS::DBInstance'
Source:
Owner: AWS
SourceIdentifier: RDS_MULTI_AZ_SUPPORT
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule4:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: rds-storage-encrypted
Scope:
ComplianceResourceTypes:
- 'AWS::RDS::DBInstance'
Source:
Owner: AWS
SourceIdentifier: RDS_STORAGE_ENCRYPTED
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule5:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: cloudtrail-enabled
Scope:
ComplianceResourceTypes:
- 'AWS::CloudTrail::Trail'
Source:
Owner: AWS
SourceIdentifier: CLOUD_TRAIL_ENABLED
MaximumExecutionFrequency: TwentyFour_Hours
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule6:
Type: AWS::Config::ConfigRule
Condition: CreateInProd
Properties:
ConfigRuleName: acm-certificate-expiry-90-days
Description: "Checks whether ACM Certificates in your account are marked for expiration within 90 days (configurable). Certificates provided by ACM are automatically renewed. ACM does not automatically renew certificates that you import."
InputParameters:
daysToExpiration: 90
Scope:
ComplianceResourceTypes:
- 'AWS::ACM::Certificate'
Source:
Owner: AWS
SourceIdentifier: ACM_CERTIFICATE_EXPIRATION_CHECK
MaximumExecutionFrequency: TwentyFour_Hours
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule7:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: root-account-mfa-enabled
Description: "Checks whether the root user of your AWS account requires multi-factor authentication for console sign-in."
Source:
Owner: AWS
SourceIdentifier: ROOT_ACCOUNT_MFA_ENABLED
MaximumExecutionFrequency: TwentyFour_Hours
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
RuleSetRule8:
Type: AWS::Config::ConfigRule
Condition: CreateInProdNonProd
Properties:
ConfigRuleName: s3-bucket-ssl-requests-only
Description: "Checks whether S3 buckets have policies that require requests to use Secure Socket Layer (SSL)."
Scope:
ComplianceResourceTypes:
- 'AWS::S3::Bucket'
Source:
Owner: AWS
SourceIdentifier: S3_BUCKET_SSL_REQUESTS_ONLY
DependsOn:
- ConfigurationRecorder
- DeliveryChannel
#
# END OF THE RESOURCES SECTION TO BE ADAPTED TO YOUR NEEDS
#
ConfigurationRecorder:
Type: AWS::Config::ConfigurationRecorder
Properties:
RecordingGroup:
AllSupported: 'True'
IncludeGlobalResourceTypes: 'True'
RoleARN: !Join ["", ["arn:aws:iam::", !Ref 'AWS::AccountId', ":role/service-role/AWSConfigRole-DO-NOT-DELETE"]]
DependsOn:
- AWSConfigRole
DeliveryChannel:
Type: AWS::Config::DeliveryChannel
Properties:
ConfigSnapshotDeliveryProperties:
DeliveryFrequency: TwentyFour_Hours
S3BucketName: !Ref CentralizedS3BucketConfigFullName
AWSConfigRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service: config.amazonaws.com
Version: '2012-10-17'
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSConfigRole
Path: /service-role/
RoleName: AWSConfigRole-DO-NOT-DELETE
ConfigS3WritePolicy:
Type: 'AWS::IAM::Policy'
Properties:
Roles:
- AWSConfigRole-DO-NOT-DELETE
PolicyName: !Join
- '-'
- - ConfigS3Write
- !Ref 'AWS::AccountId'
- !Ref 'AWS::Region'
PolicyDocument:
Statement:
- Action:
- s3:PutObject
Effect: Allow
Resource:
- !Join [ "", [ "arn:aws:s3:::", !Ref CentralizedS3BucketConfigFullName, "/AWSLogs/", !Ref 'AWS::AccountId', "/*"] ]
Sid: !Join ["", ["ConfigS3Write", !Ref 'AWS::AccountId'] ]
Version: 2012-10-17
DependsOn:
- AWSConfigRole
CrossAcountAuditRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: !Ref ComplianceAuditRoleName
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
AWS: !Join ["", ["arn:aws:iam::", !Ref ComplianceAccountId, ":root"]]
Action:
- "sts:AssumeRole"
Path: "/"
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/SecurityAudit'
- 'arn:aws:iam::aws:policy/CloudWatchEventsReadOnlyAccess'
- 'arn:aws:iam::aws:policy/AWSCloudTrailReadOnlyAccess'
CrossAcountAuditRolePolicy:
Type: "AWS::IAM::Policy"
Properties:
PolicyDocument:
Statement:
- Action: 'config:PutEvaluations'
Effect: Allow
Resource: '*'
Version: 2012-10-17
PolicyName: PutEvaluationPolicy
Roles:
- !Ref ComplianceAuditRoleName
DependsOn: CrossAcountAuditRole
RuleSetReporter:
Type: AWS::Config::ConfigRule
Properties:
ConfigRuleName: Ruleset_Status_Reporter
InputParameters:
RoleToAssume: !Ref ComplianceAuditRoleName
AccountClassification: !Ref AccountClassification
Source:
Owner: CUSTOM_LAMBDA
SourceIdentifier: !Join [ ":", [ 'arn:aws:lambda', !Ref "AWS::Region", !Ref ComplianceAccountId, 'function', Ruleset_Status_Reporter ] ]
SourceDetails:
-
EventSource: "aws.config"
MaximumExecutionFrequency: One_Hour
MessageType: ScheduledNotification
DependsOn:
- ConfigurationRecorder
- DeliveryChannel