Skip to content

Commit

Permalink
Merge pull request #280 from komtaki/feature/add-aws-waf
Browse files Browse the repository at this point in the history
chore: add cloud formation of waf
  • Loading branch information
ayuki-joto authored Sep 6, 2021
2 parents fc33c0e + 2a1a92a commit 664b570
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
89 changes: 89 additions & 0 deletions .cloudformation/waf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: "Create webAcl"

Parameters:
AppEnvironment:
Description: Type of app environment.
Type: String
Default: staging
AllowedValues:
- staging
- production

Resources:
# ------------------------------------------------------------#
# AWS WAFv2
# ------------------------------------------------------------#
WebAclCloudFront:
Type: AWS::WAFv2::WebACL
Properties:
DefaultAction:
Allow: {}
Description: WebACL for CloudFront
Name: !Sub ${AppEnvironment}-cfj-decidim-web-acl
Rules:
- Name: !Sub ${AppEnvironment}-AWSManagedRulesCommonRuleSet
Priority: 0
OverrideAction:
Count: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesCommonRuleSetMetric
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesCommonRuleSet
- Name: !Sub ${AppEnvironment}-AWSManagedRulesKnownBadInputsRuleSet
Priority: 1
OverrideAction:
Count: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesKnownBadInputsRuleSetMetric
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesKnownBadInputsRuleSet
- Name: !Sub ${AppEnvironment}-AWSManagedRulesAmazonIpReputationList
Priority: 2
OverrideAction:
Count: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesAmazonIpReputationListMetric
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesAmazonIpReputationList
- Name: !Sub ${AppEnvironment}-AWSManagedRulesLinuxRuleSet
Priority: 3
OverrideAction:
Count: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesLinuxRuleSetMetric
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesLinuxRuleSet
- Name: !Sub ${AppEnvironment}-AWSManagedRulesSQLiRuleSet
Priority: 4
OverrideAction:
Count: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: AWSManagedRulesSQLiRuleSetMetric
Statement:
ManagedRuleGroupStatement:
VendorName: AWS
Name: AWSManagedRulesSQLiRuleSet
Scope: CLOUDFRONT
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: !Sub ${AppEnvironment}-cfj-decidim-web-acl
13 changes: 13 additions & 0 deletions docs/INFRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ https://github.com/awsdocs/elastic-beanstalk-samples/blob/main/cfn-templates/vpc

- staging-decidim-app-cloud-front

## WAF

Cloud frontに合わせてus-east-1にあります。

### Template file

[.cloudformation/waf.yml](/.cloudformation/waf.yml)

### Stack Name

- staging-decidim-waf
- production-decidim-waf

## ECR

staging用と本番は同じリポジトリです。Dockerイメージのタグで区別します。
Expand Down

0 comments on commit 664b570

Please sign in to comment.