/
aws-waf-security-automations-webacl.template
804 lines (709 loc) · 26.1 KB
/
aws-waf-security-automations-webacl.template
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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
AWSTemplateFormatVersion: 2010-09-09
Description: >-
(SO0006-WebACL) - AWS WAF Security Automations %VERSION%: This AWS CloudFormation template helps
you provision the AWS WAF Security Automations stack without worrying about creating and
configuring the underlying AWS infrastructure.
**WARNING** This template creates an AWS WAF Web ACL and Amazon CloudWatch custom metrics.
You will be billed for the AWS resources used if you create a stack from this template.
Parameters:
ActivateAWSManagedRulesParam:
Type: String
ActivateSqlInjectionProtectionParam:
Type: String
ActivateCrossSiteScriptingProtectionParam:
Type: String
ActivateHttpFloodProtectionParam:
Type: String
ActivateScannersProbesProtectionParam:
Type: String
ActivateReputationListsProtectionParam:
Type: String
ActivateBadBotProtectionParam:
Type: String
RequestThreshold:
Type: Number
RegionScope:
Type: String
ParentStackName:
Type: String
GlueAccessLogsDatabase:
Type: String
GlueAppAccessLogsTable:
Type: String
GlueWafAccessLogsTable:
Type: String
LogLevel:
Type: String
SqlInjectionProtectionSensitivityLevelParam:
Type: String
Conditions:
AWSManagedRulesActivated: !Equals
- !Ref ActivateAWSManagedRulesParam
- 'yes'
SqlInjectionProtectionActivated: !Not [!Equals [!Ref ActivateSqlInjectionProtectionParam, 'no']]
CrossSiteScriptingProtectionActivated: !Not [!Equals [!Ref ActivateCrossSiteScriptingProtectionParam, 'no']]
SqlInjectionProtectionContinueActivated: !Equals
- !Ref ActivateSqlInjectionProtectionParam
- 'yes'
SqlInjectionProtectionMatchActivated: !Equals
- !Ref ActivateSqlInjectionProtectionParam
- 'yes - MATCH'
SqlInjectionProtectionNoMatchActivated: !Equals
- !Ref ActivateSqlInjectionProtectionParam
- 'yes - NO_MATCH'
CrossSiteScriptingProtectionContinueActivated: !Equals
- !Ref ActivateCrossSiteScriptingProtectionParam
- 'yes'
CrossSiteScriptingProtectionMatchActivated: !Equals
- !Ref ActivateCrossSiteScriptingProtectionParam
- 'yes - MATCH'
CrossSiteScriptingProtectionNoMatchActivated: !Equals
- !Ref ActivateCrossSiteScriptingProtectionParam
- 'yes - NO_MATCH'
HttpFloodProtectionRateBasedRuleActivated: !Equals
- !Ref ActivateHttpFloodProtectionParam
- 'yes - AWS WAF rate based rule'
HttpFloodLambdaLogParser: !Equals
- !Ref ActivateHttpFloodProtectionParam
- 'yes - AWS Lambda log parser'
HttpFloodAthenaLogParser: !Equals
- !Ref ActivateHttpFloodProtectionParam
- 'yes - Amazon Athena log parser'
HttpFloodProtectionLogParserActivated: !Or
- Condition: HttpFloodLambdaLogParser
- Condition: HttpFloodAthenaLogParser
ScannersProbesLambdaLogParser: !Equals
- !Ref ActivateScannersProbesProtectionParam
- 'yes - AWS Lambda log parser'
ScannersProbesAthenaLogParser: !Equals
- !Ref ActivateScannersProbesProtectionParam
- 'yes - Amazon Athena log parser'
ScannersProbesProtectionActivated: !Or
- Condition: ScannersProbesLambdaLogParser
- Condition: ScannersProbesAthenaLogParser
ReputationListsProtectionActivated: !Equals
- !Ref ActivateReputationListsProtectionParam
- 'yes'
BadBotProtectionActivated: !Equals
- !Ref ActivateBadBotProtectionParam
- 'yes'
Mappings:
SourceCode:
General:
TemplateBucket: '%TEMPLATE_OUTPUT_BUCKET%'
SourceBucket: '%DIST_OUTPUT_BUCKET%'
KeyPrefix: '%SOLUTION_NAME%/%VERSION%'
Resources:
# Timers
# There is a rate throttling issue when creating so many calls to create IPSet (1 TPS)
# By daisychaining these timers at N second intervals we can pace the calls to create new IPSets
# binding them with DependsOn to the right timer
TimerWhiteV4:
Type: 'Custom::Timer'
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerBlackV4:
Type: 'Custom::Timer'
DependsOn: TimerWhiteV4
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerHttpFloodV4:
Type: 'Custom::Timer'
DependsOn: TimerBlackV4
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerScannersV4:
Type: 'Custom::Timer'
DependsOn: TimerHttpFloodV4
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerReputationV4:
DependsOn: TimerScannersV4
Type: 'Custom::Timer'
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerBadBotV4:
Type: 'Custom::Timer'
DependsOn: TimerReputationV4
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerWhiteV6:
Type: 'Custom::Timer'
DependsOn: TimerBadBotV4
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerBlackV6:
Type: 'Custom::Timer'
DependsOn: TimerWhiteV6
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerHttpFloodV6:
Type: 'Custom::Timer'
DependsOn: TimerBlackV6
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerScannersV6:
Type: 'Custom::Timer'
DependsOn: TimerHttpFloodV6
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerReputationV6:
DependsOn: TimerScannersV6
Type: 'Custom::Timer'
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
TimerBadBotV6:
Type: 'Custom::Timer'
DependsOn: TimerReputationV6
Properties:
ServiceToken: !GetAtt CustomTimer.Arn
# IPV4 IPSets
WAFWhitelistSetV4:
Type: 'AWS::WAFv2::IPSet'
DependsOn: TimerWhiteV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}WhitelistSetIPV4'
Description: 'Allow List for IPV4 addresses'
Addresses: []
WAFBlacklistSetV4:
Type: 'AWS::WAFv2::IPSet'
DependsOn: TimerBlackV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}BlacklistSetIPV4'
Description: 'Block Denied List for IPV4 addresses'
Addresses: []
WAFHttpFloodSetV4:
Type: 'AWS::WAFv2::IPSet'
Condition: HttpFloodProtectionLogParserActivated
DependsOn: TimerHttpFloodV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}HTTPFloodSetIPV4'
Description: 'Block HTTP Flood IPV4 addresses'
Addresses: []
WAFScannersProbesSetV4:
Type: 'AWS::WAFv2::IPSet'
Condition: ScannersProbesProtectionActivated
DependsOn: TimerScannersV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}ScannersProbesSetIPV4'
Description: 'Block Scanners/Probes IPV4 addresses'
Addresses: []
WAFReputationListsSetV4:
Type: 'AWS::WAFv2::IPSet'
Condition: ReputationListsProtectionActivated
DependsOn: TimerReputationV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}IPReputationListsSetIPV4'
Description: 'Block Reputation List IPV4 addresses'
Addresses: []
WAFBadBotSetV4:
Type: 'AWS::WAFv2::IPSet'
Condition: BadBotProtectionActivated
DependsOn: TimerBadBotV4
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: 'IPV4'
Name: !Sub '${ParentStackName}IPBadBotSetIPV4'
Description: 'Block Bad Bot IPV4 addresses'
Addresses: []
# IPV6 IPSets
# Introduced an artificial DependsOn property here on each of the previous IPSets to address
# a rate throttling issue when creating so many calls to create IPSet
# The rate limit is 1 call per second to the IPSet API
WAFWhitelistSetV6:
Type: 'AWS::WAFv2::IPSet'
DependsOn: TimerWhiteV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}WhitelistSetIPV6'
Description: 'Allow list for IPV6 addresses'
Addresses: []
WAFBlacklistSetV6:
Type: 'AWS::WAFv2::IPSet'
DependsOn: TimerBlackV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}BlacklistSetIPV6'
Description: 'Block Denied List for IPV6 addresses'
Addresses: []
WAFHttpFloodSetV6:
Type: 'AWS::WAFv2::IPSet'
Condition: HttpFloodProtectionLogParserActivated
DependsOn: TimerHttpFloodV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}HTTPFloodSetIPV6'
Description: 'Block HTTP Flood IPV6 addresses'
Addresses: []
WAFScannersProbesSetV6:
Type: 'AWS::WAFv2::IPSet'
Condition: ScannersProbesProtectionActivated
DependsOn: TimerScannersV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}ScannersProbesSetIPV6'
Description: 'Block Scanners/Probes IPV6 addresses'
Addresses: []
WAFReputationListsSetV6:
Type: 'AWS::WAFv2::IPSet'
Condition: ReputationListsProtectionActivated
DependsOn: TimerReputationV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}IPReputationListsSetIPV6'
Description: 'Block Reputation List IPV6 addresses'
Addresses: []
WAFBadBotSetV6:
Type: 'AWS::WAFv2::IPSet'
Condition: BadBotProtectionActivated
DependsOn: TimerBadBotV6
Properties:
Scope: !Sub '${RegionScope}'
IPAddressVersion: IPV6
Name: !Sub '${ParentStackName}IPBadBotSetIPV6'
Description: 'Block Bad Bot IPV6 addresses'
Addresses: []
LambdaRoleCustomTimer:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action: 'sts:AssumeRole'
Policies:
- PolicyName: CloudWatchLogs
PolicyDocument:
Statement:
- Effect: Allow
Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource:
- !Sub 'arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/*CustomTimer*'
CustomTimer:
Type: 'AWS::Lambda::Function'
Properties:
Description: >-
This lambda function counts X seconds and can be used to slow down component creation in CloudFormation
Handler: 'timer.lambda_handler'
Role: !GetAtt LambdaRoleCustomTimer.Arn
Code:
S3Bucket: !Join ['-', [!FindInMap ["SourceCode", "General", "SourceBucket"], !Ref 'AWS::Region']]
S3Key: !Join ['/', [!FindInMap ["SourceCode", "General", "KeyPrefix"], 'timer.zip']]
Runtime: python3.8
MemorySize: 128
Timeout: 300
Environment:
Variables:
SECONDS: '2'
LOG_LEVEL: !Ref LogLevel
Metadata:
cfn_nag:
rules_to_suppress:
- id: W89
reason: There is no need to run this lambda in a VPC
- id: W92
reason: There is no need for Reserved Concurrency
# Adding a (priority 0) rule for AWS Managed RuleSet, optionally triggered by params
WAFWebACL:
Type: AWS::WAFv2::WebACL
Properties:
Name: !Ref 'ParentStackName'
Description: 'Custom WAFWebACL'
Scope: !Sub '${RegionScope}'
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'WAFWebACL']]
DefaultAction:
Allow: {}
Rules:
- !If
- AWSManagedRulesActivated
- Name: AWS-AWSManagedRulesCommonRuleSet
Priority: 0
OverrideAction:
None: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: MetricForAMRCRS
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesCommonRuleSet
- !Ref 'AWS::NoValue'
- Name: !Sub '${ParentStackName}WhitelistRule'
Priority: 1
Action:
Allow: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'WhitelistRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFWhitelistSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFWhitelistSetV6.Arn
- Name: !Sub '${ParentStackName}BlacklistRule'
Priority: 2
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'BlacklistRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFBlacklistSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFBlacklistSetV6.Arn
- !If
- HttpFloodProtectionLogParserActivated
- Name: !Sub '${ParentStackName}HttpFloodRegularRule'
Priority: 3
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'HttpFloodRegularRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFHttpFloodSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFHttpFloodSetV6.Arn
- !Ref 'AWS::NoValue'
- !If
- HttpFloodProtectionRateBasedRuleActivated
- Name: !Sub '${ParentStackName}HttpFloodRateBasedRule'
Priority: 4
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'HttpFloodRateBasedRule']]
Statement:
RateBasedStatement:
AggregateKeyType: "IP"
Limit: !Ref RequestThreshold
- !Ref 'AWS::NoValue'
- !If
- ScannersProbesProtectionActivated
- Name: !Sub '${ParentStackName}ScannersAndProbesRule'
Priority: 5
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'ScannersProbesRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFScannersProbesSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFScannersProbesSetV6.Arn
- !Ref 'AWS::NoValue'
- !If
- ReputationListsProtectionActivated
- Name: !Sub '${ParentStackName}IPReputationListsRule'
Priority: 6
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'IPReputationListsRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFReputationListsSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFReputationListsSetV6.Arn
- !Ref 'AWS::NoValue'
- !If
- BadBotProtectionActivated
- Name: !Sub '${ParentStackName}BadBotRule'
Priority: 7
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'BadBotRule']]
Statement:
OrStatement:
Statements:
- IPSetReferenceStatement:
Arn: !GetAtt WAFBadBotSetV4.Arn
- IPSetReferenceStatement:
Arn: !GetAtt WAFBadBotSetV6.Arn
- !Ref 'AWS::NoValue'
- !If
- SqlInjectionProtectionActivated
- Name: !Sub '${ParentStackName}SqlInjectionRule'
Priority: 20
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'SqlInjectionRule']]
Statement:
OrStatement:
Statements:
- SqliMatchStatement:
FieldToMatch:
QueryString: {}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
SensitivityLevel: !Ref SqlInjectionProtectionSensitivityLevelParam
- SqliMatchStatement:
FieldToMatch:
Body:
# Select the option based on user input
OversizeHandling:
!If [SqlInjectionProtectionContinueActivated, 'CONTINUE',
!If [SqlInjectionProtectionMatchActivated, 'MATCH',
!If [SqlInjectionProtectionNoMatchActivated, 'NO_MATCH', 'CONTINUE']
]
]
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
SensitivityLevel: !Ref SqlInjectionProtectionSensitivityLevelParam
- SqliMatchStatement:
FieldToMatch:
UriPath: {}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
SensitivityLevel: !Ref SqlInjectionProtectionSensitivityLevelParam
- SqliMatchStatement:
FieldToMatch:
SingleHeader: {Name: "Authorization"}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
SensitivityLevel: !Ref SqlInjectionProtectionSensitivityLevelParam
- SqliMatchStatement:
FieldToMatch:
SingleHeader: {Name: "Cookie"}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
SensitivityLevel: !Ref SqlInjectionProtectionSensitivityLevelParam
- !Ref 'AWS::NoValue'
- !If
- CrossSiteScriptingProtectionActivated
- Name: !Sub '${ParentStackName}XssRule'
Priority: 30
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'XssRule']]
Statement:
OrStatement:
Statements:
- XssMatchStatement:
FieldToMatch:
QueryString: {}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
- XssMatchStatement:
FieldToMatch:
Body:
OversizeHandling:
# Select the option based on user input
!If [CrossSiteScriptingProtectionContinueActivated, 'CONTINUE',
!If [CrossSiteScriptingProtectionMatchActivated, 'MATCH',
!If [CrossSiteScriptingProtectionNoMatchActivated, 'NO_MATCH', 'CONTINUE']
]
]
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
- XssMatchStatement:
FieldToMatch:
UriPath: {}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
- XssMatchStatement:
FieldToMatch:
SingleHeader: {Name: "Cookie"}
TextTransformations:
- Priority: 1
Type: URL_DECODE
- Priority: 2
Type: HTML_ENTITY_DECODE
- !Ref 'AWS::NoValue'
Outputs:
# Arns
WAFWhitelistSetV4Arn:
Value: !GetAtt WAFWhitelistSetV4.Arn
WAFBlacklistSetV4Arn:
Value: !GetAtt WAFBlacklistSetV4.Arn
WAFHttpFloodSetV4Arn:
Value: !GetAtt WAFHttpFloodSetV4.Arn
Condition: HttpFloodProtectionLogParserActivated
WAFScannersProbesSetV4Arn:
Value: !GetAtt WAFScannersProbesSetV4.Arn
Condition: ScannersProbesProtectionActivated
WAFReputationListsSetV4Arn:
Value: !GetAtt WAFReputationListsSetV4.Arn
Condition: ReputationListsProtectionActivated
WAFBadBotSetV4Arn:
Value: !GetAtt WAFBadBotSetV4.Arn
Condition: BadBotProtectionActivated
WAFWhitelistSetV6Arn:
Value: !GetAtt WAFWhitelistSetV6.Arn
WAFBlacklistSetV6Arn:
Value: !GetAtt WAFBlacklistSetV6.Arn
WAFHttpFloodSetV6Arn:
Value: !GetAtt WAFHttpFloodSetV6.Arn
Condition: HttpFloodProtectionLogParserActivated
WAFScannersProbesSetV6Arn:
Value: !GetAtt WAFScannersProbesSetV6.Arn
Condition: ScannersProbesProtectionActivated
WAFReputationListsSetV6Arn:
Value: !GetAtt WAFReputationListsSetV6.Arn
Condition: ReputationListsProtectionActivated
WAFBadBotSetV6Arn:
Value: !GetAtt WAFBadBotSetV6.Arn
Condition: BadBotProtectionActivated
# Names
NameWAFWhitelistSetV4:
Value: !Sub '${ParentStackName}WhitelistSetIPV4'
NameWAFBlacklistSetV4:
Value: !Sub '${ParentStackName}BlacklistSetIPV4'
NameHttpFloodSetV4:
Value: !Sub '${ParentStackName}HTTPFloodSetIPV4'
Condition: HttpFloodProtectionLogParserActivated
NameScannersProbesSetV4:
Value: !Sub '${ParentStackName}ScannersProbesSetIPV4'
Condition: ScannersProbesProtectionActivated
NameReputationListsSetV4:
Value: !Sub '${ParentStackName}IPReputationListsSetIPV4'
Condition: ReputationListsProtectionActivated
NameBadBotSetV4:
Value: !Sub '${ParentStackName}IPBadBotSetIPV4'
Condition: BadBotProtectionActivated
NameWAFWhitelistSetV6:
Value: !Sub '${ParentStackName}WhitelistSetIPV6'
NameWAFBlacklistSetV6:
Value: !Sub '${ParentStackName}BlacklistSetIPV6'
NameHttpFloodSetV6:
Value: !Sub '${ParentStackName}HTTPFloodSetIPV6'
Condition: HttpFloodProtectionLogParserActivated
NameScannersProbesSetV6:
Value: !Sub '${ParentStackName}ScannersProbesSetIPV6'
Condition: ScannersProbesProtectionActivated
NameReputationListsSetV6:
Value: !Sub '${ParentStackName}IPReputationListsSetIPV6'
Condition: ReputationListsProtectionActivated
NameBadBotSetV6:
Value: !Sub '${ParentStackName}IPBadBotSetIPV6'
Condition: BadBotProtectionActivated
GlueAccessLogsDatabase:
Value: !Ref GlueAccessLogsDatabase
GlueAppAccessLogsTable:
Value: !Ref GlueAppAccessLogsTable
GlueWafAccessLogsTable:
Value: !Ref GlueWafAccessLogsTable
WAFWebACL:
Value: !Ref WAFWebACL
WAFWebACLArn:
Value: !GetAtt WAFWebACL.Arn
WAFWebACLMetricName:
Value: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'MaliciousRequesters']]
IPReputationListsMetricName:
Value: !Join ['', [!Join ['', !Split ['-', !Ref ParentStackName]], 'IPReputationListsRule']]
Version:
Value: "%VERSION%"
# Ids
WAFWhitelistSetV4Id:
Value: !GetAtt WAFWhitelistSetV4.Id
WAFBlacklistSetV4Id:
Value: !GetAtt WAFBlacklistSetV4.Id
WAFHttpFloodSetV4Id:
Value: !GetAtt WAFHttpFloodSetV4.Id
Condition: HttpFloodProtectionLogParserActivated
WAFScannersProbesSetV4Id:
Value: !GetAtt WAFScannersProbesSetV4.Id
Condition: ScannersProbesProtectionActivated
WAFReputationListsSetV4Id:
Value: !GetAtt WAFReputationListsSetV4.Id
Condition: ReputationListsProtectionActivated
WAFBadBotSetV4Id:
Value: !GetAtt WAFBadBotSetV4.Id
Condition: BadBotProtectionActivated
WAFWhitelistSetV6Id:
Value: !GetAtt WAFWhitelistSetV6.Id
WAFBlacklistSetV6Id:
Value: !GetAtt WAFBlacklistSetV6.Id
WAFHttpFloodSetV6Id:
Value: !GetAtt WAFHttpFloodSetV6.Id
Condition: HttpFloodProtectionLogParserActivated
WAFScannersProbesSetV6Id:
Value: !GetAtt WAFScannersProbesSetV6.Id
Condition: ScannersProbesProtectionActivated
WAFReputationListsSetV6Id:
Value: !GetAtt WAFReputationListsSetV6.Id
Condition: ReputationListsProtectionActivated
WAFBadBotSetV6Id:
Value: !GetAtt WAFBadBotSetV6.Id
Condition: BadBotProtectionActivated