-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2217 from vrk-kpa/AV-2221_implement_new_waf_confi…
…guration_options AV-2221: Implement new waf configuration options
- Loading branch information
Showing
6 changed files
with
349 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import {aws_ssm, CfnParameter, Stack} from "aws-cdk-lib"; | ||
import {Construct} from "constructs"; | ||
|
||
import {EnvStackProps} from "./env-stack-props"; | ||
|
||
export class CloudfrontParameterStack extends Stack { | ||
readonly cloudFrontDistributionArn: aws_ssm.IStringParameter; | ||
readonly bannedIpListParameterName: string; | ||
readonly whitelistedIpListParameterName: string; | ||
readonly highPriorityCountryCodeListParameterName: string; | ||
readonly highPriorityRateLimit: aws_ssm.IStringParameter; | ||
readonly rateLimit: aws_ssm.IStringParameter; | ||
readonly managedRulesParameterName: string; | ||
readonly wafAutomationArn: aws_ssm.IStringParameter; | ||
readonly snsTopicArn: aws_ssm.IStringParameter; | ||
readonly evaluationPeriod: aws_ssm.IStringParameter; | ||
|
||
constructor(scope: Construct, id: string, props: EnvStackProps ) { | ||
super(scope, id, props); | ||
|
||
this.cloudFrontDistributionArn = new aws_ssm.StringParameter(this, 'cloudfrontDistributionArn', { | ||
stringValue: 'some placeholder', | ||
description: 'Arn of cloudfront distribution', | ||
parameterName: `/${props.environment}/waf/cloudfrontDistributionArn`, | ||
}) | ||
|
||
this.bannedIpListParameterName = `/${props.environment}/waf/banned_ips` | ||
new aws_ssm.StringListParameter(this, 'bannedIplist', { | ||
stringListValue: ["127.0.0.1"], | ||
description: 'List of banned IP addresses', | ||
parameterName: this.bannedIpListParameterName | ||
}) | ||
|
||
this.whitelistedIpListParameterName = `/${props.environment}/waf/whitelisted_ips` | ||
new aws_ssm.StringListParameter(this, 'whitelistedIplist', { | ||
stringListValue: ["127.0.0.1"], | ||
description: 'List of whitelisted IP addresses', | ||
parameterName: this.whitelistedIpListParameterName | ||
}) | ||
|
||
this.highPriorityCountryCodeListParameterName = `/${props.environment}/waf/high_priority_country_codes` | ||
new aws_ssm.StringListParameter(this, 'highPriorityCountryCodeList', { | ||
stringListValue: ["Some bogus country code"], | ||
description: 'Country codes deemed high priority', | ||
parameterName: this.highPriorityCountryCodeListParameterName | ||
}) | ||
|
||
this.highPriorityRateLimit = new aws_ssm.StringParameter(this, 'highPriorityRateLimit', { | ||
stringValue: '0', | ||
description: 'Rate limit for high priority country codes', | ||
parameterName: `/${props.environment}/waf/high_priority_rate_limit` | ||
}) | ||
|
||
this.rateLimit = new aws_ssm.StringParameter(this, 'rateLimit', { | ||
stringValue: '0', | ||
description: 'Rate limit for others', | ||
parameterName: `/${props.environment}/waf/rate_limit` | ||
}) | ||
|
||
this.managedRulesParameterName = `/${props.environment}/waf/managed_rules` | ||
new aws_ssm.StringParameter(this, 'managedRules', { | ||
stringValue: 'some placeholder', | ||
description: 'JSON value for managed rules', | ||
parameterName: this.managedRulesParameterName | ||
}) | ||
|
||
this.wafAutomationArn = new aws_ssm.StringParameter(this, 'wafAutomationArn', { | ||
stringValue: 'some placeholder', | ||
description: 'Arn of waf automation lambda', | ||
parameterName: `/${props.environment}/waf/waf_automation_arn`, | ||
}) | ||
|
||
this.snsTopicArn = new aws_ssm.StringParameter(this, 'snsTopicArn', { | ||
stringValue: 'some placeholder', | ||
description: 'Arn of sns topic', | ||
parameterName: `/${props.environment}/waf/sns_topic_arn`, | ||
}) | ||
|
||
this.evaluationPeriod = new aws_ssm.StringParameter(this, 'evaluationPeriod', { | ||
stringValue: '0', | ||
description: 'Evaluation period for rate limits', | ||
parameterName: `/${props.environment}/waf/evaluation_period` | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import {EnvStackProps} from "./env-stack-props"; | ||
import {aws_ssm} from "aws-cdk-lib"; | ||
|
||
export interface ShieldStackProps extends EnvStackProps{ | ||
bannedIpsRequestSamplingEnabled: boolean, | ||
requestSampleAllTrafficEnabled: boolean, | ||
highPriorityRequestSamplingEnabled: boolean, | ||
rateLimitRequestSamplingEnabled: boolean | ||
rateLimitRequestSamplingEnabled: boolean, | ||
cloudfrontDistributionArn: aws_ssm.IStringParameter, | ||
bannedIpListParameterName: string, | ||
whitelistedIpListParameterName: string, | ||
highPriorityCountryCodeListParameterName: string, | ||
highPriorityRateLimit: aws_ssm.IStringParameter, | ||
rateLimit: aws_ssm.IStringParameter, | ||
managedRulesParameterName: string, | ||
wafAutomationArn: aws_ssm.IStringParameter, | ||
snsTopicArn: aws_ssm.IStringParameter, | ||
evaluationPeriod: aws_ssm.IStringParameter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.