Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared ALB WAF #799

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 38 additions & 24 deletions spire/templates/shared-alb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -435,30 +435,44 @@ Resources:
SetIdentifier: !Ref AWS::StackName
Type: A

# Waf:
# Type: AWS::WAFv2::WebACL
# Properties:
# DefaultAction:
# Allow: {}
# Description: !Sub WAF for Spire ${EnvironmentType} shared ALB
# Scope: REGIONAL
# Tags:
# - { Key: prx:meta:tagging-version, Value: "2021-04-07" }
# - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
# - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
# - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName }
# - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId }
# - { Key: prx:ops:environment, Value: !Ref EnvironmentType }
# - { Key: prx:dev:application, Value: Common }
# VisibilityConfig:
# CloudWatchMetricsEnabled: false
# MetricName: !Sub ${Alb.LoadBalancerName}-WAF
# SampledRequestsEnabled: false
# WafAssociation:
# Type: AWS::WAFv2::WebACLAssociation
# Properties:
# ResourceArn: !Ref Alb
# WebACLArn: !GetAtt Waf.Arn
Waf:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to put this in its own template, so we can more easily share it between this ALB and the DT ALB?

Type: AWS::WAFv2::WebACL
Properties:
DefaultAction:
Allow: {}
Description: !Sub WAF for Spire ${EnvironmentType} shared ALB
Scope: REGIONAL
Rules:
- Action:
Challenge: {}
Name: reject-exchange-geo
Priority: 20
Statement:
GeoMatchStatement:
CountryCodes:
- CN
- HK
VisibilityConfig:
CloudWatchMetricsEnabled: true
MetricName: reject-exchange-geo
SampledRequestsEnabled: true
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName }
- { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId }
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Common }
VisibilityConfig:
CloudWatchMetricsEnabled: false
MetricName: !Sub ${Alb.LoadBalancerName}-WAF
SampledRequestsEnabled: false
WafAssociation:
Type: AWS::WAFv2::WebACLAssociation
Properties:
ResourceArn: !Ref Alb
WebACLArn: !GetAtt Waf.Arn

Outputs:
AlbArn:
Expand Down
Loading