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

Added Support for FMS Advanced Shield policies #418

Closed
wants to merge 87 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
70def44
shield draft
Jun 20, 2024
03ae4ab
update the shield stack
memehadi Jun 20, 2024
5c1ade0
temp app added for shield advanced stack
Jun 20, 2024
3a8e5b1
adding props to resource type, stack deployed successfully
memehadi Jun 21, 2024
20f7caa
adding the rest of the props
memehadi Jun 23, 2024
5465876
moved securityServicePolicyData to the shield stack. add comments to …
memehadi Jun 24, 2024
a9c8252
updated shield stack to be deployed from the firewall factory app, ad…
memehadi Jun 25, 2024
bd10c7e
adding switch statement, stadard naming for shield policy in the example
memehadi Jun 25, 2024
48c4c10
options prompt script
Jun 25, 2024
2517e1c
finish options prompt
memehadi Jun 25, 2024
69eedbc
update deployment guide
memehadi Jun 26, 2024
a10ca43
move defaultActionType and OverrideCustomerWebACLAssociation to props
memehadi Jun 26, 2024
fbd721d
beautify output for advanced shield stack
daknhh Jun 26, 2024
2cbcf52
need to do doc changes
daknhh Jun 26, 2024
c8d2b36
adjust bashscript
daknhh Jun 26, 2024
4fd045f
add first guidance and cost calculation
daknhh Jun 26, 2024
1b0e7b3
examplte 2
daknhh Jun 26, 2024
3b1753d
fix text in guidance
daknhh Jun 27, 2024
6d575ae
update documentation files
memehadi Jun 28, 2024
1ad0259
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
daknhh Jun 30, 2024
e74caad
update packages and improve changelog
daknhh Jun 30, 2024
d0a392f
update dependencies
daknhh Jun 30, 2024
7ac98da
improve changelog
daknhh Jun 30, 2024
60b2efe
Grafana Dashboard WIP
daknhh Jun 30, 2024
0a2b1d0
add kms key iam policy for GlueCrwalerRole
daknhh Jun 30, 2024
a359e27
WIP Testing
daknhh Jun 30, 2024
eddc188
add kms key and bin fix
daknhh Jul 1, 2024
5a02971
fix path to FMS logs
daknhh Jul 1, 2024
94d83ed
removed duplicate construct name on prerequisite stack, add slack we…
memehadi Jul 1, 2024
0549b6a
subscribe lambda ot SNS
memehadi Jul 1, 2024
55064fc
add comment to deploy of grafana
daknhh Jul 2, 2024
a65fa94
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
daknhh Jul 2, 2024
94aca00
add sns from merge conflict
daknhh Jul 2, 2024
d5c8f64
add parameters for athena view
daknhh Jul 2, 2024
2b78e53
adapt changelog
daknhh Jul 2, 2024
f9559e2
add check if STACK_NAME is already set, update documentation
memehadi Jul 2, 2024
0b660dd
Merge branch 'dev' of https://github.com/globaldatanet/audi-aws-firew…
memehadi Jul 2, 2024
af068c4
update changelog from merge conflict
memehadi Jul 2, 2024
1306fb0
add example for dashboardung
daknhh Jul 2, 2024
e712095
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
daknhh Jul 2, 2024
c6c6e2f
fix title of dashboard
daknhh Jul 2, 2024
08c6762
update changelog
daknhh Jul 2, 2024
a353b8f
fix changelog
daknhh Jul 2, 2024
4c3fa61
limit to top 10 endpoints
daknhh Jul 2, 2024
12d0519
adjust changelog
daknhh Jul 2, 2024
1248662
adjust title for dashbiard
daknhh Jul 2, 2024
743f52b
set env variable for cicd
daknhh Jul 2, 2024
065317f
add example role
daknhh Jul 2, 2024
2b60243
add new feature
daknhh Jul 2, 2024
3b121f4
cdn-load-test WIP
memehadi Jul 2, 2024
49a0484
adjust grafana dashboard
daknhh Jul 3, 2024
5b1f31d
remove duplicate construct name on prerequisite stack
memehadi Jul 3, 2024
79ce0a2
improved waf dashboard
daknhh Jul 3, 2024
d9e32ee
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
daknhh Jul 3, 2024
79b36b1
shield metrics dashboard
Jul 3, 2024
ee81678
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
Jul 3, 2024
3345e68
metrics dashboard; esbuild
Jul 4, 2024
5061033
beautify slack notification
memehadi Jul 5, 2024
c58bc49
add CW alarm for DDOS
memehadi Jul 5, 2024
24c9788
cloudwatch cross account template; removed false metrics from cw dash…
jovancusic Jul 5, 2024
73a0158
Merge branch 'dev' of https://github.com/globaldatanet/audi-aws-firew…
jovancusic Jul 5, 2024
1c79f0f
moved sink to cf template
jovancusic Jul 5, 2024
635ff6a
adjust diagram
daknhh Jul 5, 2024
96c4b68
adjust diagram
daknhh Jul 5, 2024
1ed90bc
Add permission for CloudWatch to publish to the SNS topic
memehadi Jul 6, 2024
5884eba
put CW and FMS permissions to teh same policy statement
memehadi Jul 6, 2024
597d8b2
add skeletons and add shield stack to autogenerated docs
daknhh Jul 7, 2024
3c92352
adjust deployment md
daknhh Jul 7, 2024
f526e82
update devdeps
daknhh Jul 7, 2024
d448224
cloudwatch docs
jovancusic Jul 7, 2024
507cd8e
Merge branch 'dev' of https://github.com/globaldatanet/audi-aws-firew…
jovancusic Jul 7, 2024
c58c48e
comments cleanup
jovancusic Jul 7, 2024
55c3298
fix typo, add shield dashboard to changelog and hide account info in …
daknhh Jul 8, 2024
3da17b9
removed org id from shield config
jovancusic Jul 8, 2024
e0d2993
Merge branch 'dev' of https://github.com/globaldatanet/audi-aws-firew…
jovancusic Jul 8, 2024
ebb0697
fix missing link
daknhh Jul 8, 2024
dd836f6
Merge branch 'dev' of github.com:globaldatanet/audi-aws-firewall-fact…
daknhh Jul 8, 2024
d28206c
format lambda
memehadi Jul 8, 2024
2c25c5a
update documentation
memehadi Jul 8, 2024
70144c8
remove company specific data from values.
memehadi Jul 8, 2024
6aada69
reverted esbuild
jovancusic Jul 8, 2024
1f8c728
fix linting errors
memehadi Jul 8, 2024
9803f90
Delete values/examples/shield-advanced-test2.ts
daknhh Jul 8, 2024
84ebe70
Delete values/examples/shield-advanced-parameters.ts
daknhh Jul 8, 2024
93dcdb7
update examples
daknhh Jul 8, 2024
dfbeb24
fix linting
daknhh Jul 8, 2024
6f2f6d3
fix export
daknhh Jul 8, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/waf_test_ipSets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ jobs:
uses: docker/[email protected]
- name: 🔥 Deploy Firewall to AWS
run: |
export STACK_NAME=WAFStack
task deploy config=ipSetsTests
- name: 🗑️ Remove Firewall from AWS
run: |
export STACK_NAME=WAFStack
task destroy config=ipSetsTests
2 changes: 2 additions & 0 deletions .github/workflows/waf_test_onlymanagedrulegroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ jobs:
uses: docker/[email protected]
- name: 🔥 Deploy Firewall to AWS
run: |
export STACK_NAME=WAFStack
task deploy config=onlyManagedRuleGroupsTests
- name: 🗑️ Remove Firewall from AWS
run: |
export STACK_NAME=WAFStack
task destroy config=onlyManagedRuleGroupsTests
2 changes: 2 additions & 0 deletions .github/workflows/waf_test_rateBasedwithScopeDown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ jobs:
uses: docker/[email protected]
- name: 🔥 Deploy Firewall to AWS
run: |
export STACK_NAME=WAFStack
task deploy config=rateBasedwithScopeDownTests
- name: 🗑️ Remove Firewall from AWS
run: |
export STACK_NAME=WAFStack
task destroy config=rateBasedwithScopeDownTests
2 changes: 2 additions & 0 deletions .github/workflows/waf_test_regexPatternSets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ jobs:
uses: docker/[email protected]
- name: 🔥 Deploy Firewall to AWS
run: |
export STACK_NAME=WAFStack
task deploy config=regexPatternSetsTests
- name: 🗑️ Remove Firewall from AWS
run: |
export STACK_NAME=WAFStack
task destroy config=regexPatternSetsTests
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"yaml.schemas": {
"https://www.artillery.io/schema.json": [
"file:///Users/musabyusuf/audi-aws-firewall-factory/values/examples/asciiart-load-test.yml",
"file:///Users/musabyusuf/audi-aws-firewall-factory/values/examples/cdn-load-test.yml"
]
}
}
56 changes: 55 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,65 @@
# Change Log

## Released
## 4.5.0
### Added
- Added support for deploying Shield Advanced policies, including the ability to calculate pricing. AWS Shield Advanced provides customized detection based on traffic patterns to your protected resources, detects and alerts on smaller DDoS attacks, and identifies application layer attacks by baselining traffic and spotting anomalies.
For Shield Advanced policies, we have introduced an Advanced Shield stack with [sample configurations](./values/examples/shield-advanced.ts).
__Note__: If you are deploying WAF in a CI/CD environment, make sure you set your environment variable STACK_NAME for the resource you want to deploy.
- `export STACK_NAME=PreRequisiteStack` => _prerequisites-stack.ts
- `export STACK_NAME=WAFStack` => _web-application-firewall-stack.ts
- `export STACK_NAME=ShieldAdvancedStack` => _shield-advanced-stack.ts
- Add Shield Cloudwatch Dashboard - [Example Shield Dashboard](./static/shield-dashboard.png)- The Firewall Factory is able to provision a centralized CloudWatch Dashboard.
- Add Cloudwatch Alarms: Cloudwatch Alarms are now part of the prerequisite stack and can be used to triger the SNS topics incase of DDoS.
The Dashboard shows the ammount of DDoS attacks detected
- Add Grafana Dashbording - [Example Grafana Dashboard](./static/grafana-dashboard.jpg)- AWS Glue crawler job, an Amazon Athena table and an Amazon Athena view to build a Managed Grafana dashboard to visualize the events in near real time - This is an optional component in the Prequisite Stack.
Example Grafana Dashboard can be found [here](./static/grafana/waf-dashboard.json)
__Note__:
- Your need to configure [Amazon Athena Data Source](https://docs.aws.amazon.com/athena/latest/ug/work-with-data-stores.html) in Amazon Managed Grafana
- Example Role template for Cross Account Access can be found [here](./static/cf-templates/grafana-role.yaml)
- ⚠️ You need to adjust the json and replace the uid of your grafana-athena-datasource - while importing into your Grafana.


### Fixed
- Bump @aws-sdk/client-cloudformation to 3.606.0
- Bump @aws-sdk/client-cloudfront to 3.606.0
- Bump @aws-sdk/client-cloudwatch to 3.606.0
- Bump @aws-sdk/client-config-service to 3.606.0
- Bump @aws-sdk/client-ec2 to 3.606.0
- Bump @aws-sdk/client-fms to 3.606.0
- Bump @aws-sdk/client-pricing to 3.606.0
- Bump @aws-sdk/client-s3 to 3.606.0
- Bump @aws-sdk/client-iam to 3.606.0
- Bump @aws-sdk/client-secrets-manager to 3.606.0
- Bump @aws-sdk/client-service-quotas to 3.606.0
- Bump @aws-sdk/client-shield to 3.606.0
- Bump @aws-sdk/client-ssm to 3.606.0
- Bump @aws-sdk/client-wafv2 to 3.606.0
- Bump @aws-solutions-constructs/aws-eventbridge-stepfunctions to 2.60.0
- Bump @babel/traverse to 7.24.7
- Bump @mhlabs/cfn-diagram to 1.1.40
- Bump @slack/types to 2.12.0
- Bump @types/aws-lambda to 8.10.140
- Bump @types/lodash to 4.17.6
- Bump @types/uuid to 10.0.0
- Bump adaptivecards to 3.0.4
- Bump aws-cdk-lib to 2.148.0
- Bump axios to 1.7.2
- Bump cdk-sops-secrets to 1.12.0
- Bump cfonts to 3.3.0
- Bump npm to 10.8.1
- Bump table to 6.8.2
- Bump uuid to 10.0.0
- Bump @types/node to 20.14.9
- Bump @typescript-eslint/eslint-plugin to 7.14.1
- Bump @typescript-eslint/parser to 7.14.1
- Bump aws-cdk to 2.147.2
- Bump ts-jest to 29.1.5

## 4.3.1
### Added
- [Issue#365](https://github.com/globaldatanet/aws-firewall-factory/issues/365) UnutilizedWafs - Implemented automated identification and notification system in Firewall Factory to manage unused WAFs, leveraging Lambda and notification services to streamline infrastructure, optimize costs, and enhance security by addressing WAF sprawl proactively and ensuring efficient resource utilization.
- Added example IAM Role which can be used for [ci-cd](./static/roles/ci-cd-role.yaml) deployments
- Added example IAM Role which can be used for [ci-cd](./static/cf-templates/ci-cd-role.yaml) deployments

### Fixed
- [Issue#380](https://github.com/globaldatanet/aws-firewall-factory/issues/380) Fixes on the CloudWatch dashboard.
Expand Down
30 changes: 23 additions & 7 deletions Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
6. Invoke `npm i` to install dependencies
7. ⚠️ Before installing a stack to your aws account using aws cdk you need to prepare the account using a [cdk bootstrap](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html)

8. (Optional) If you want to use CloudWatch Dashboards - You need to enable your target accounts to share CloudWatch data with the central security account follow [this](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region) to see how to do it.
9. (Optional) If you want to use the UnutilizedWafs Feature - You need to enable your target accounts with a Cross Account Role - You can find an example CfnTemplate you can use [here](static/roles/cross_account_roles_unutilized_wafs.yaml).
8. (Optional) If you want to use CloudWatch Dashboards (both Shield or Firewall) - You need to enable your target accounts to share CloudWatch data with the central security account follow [this](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html#enable-cross-account-cross-Region) to see how to do it, or use the templates from here:
- [Monitoring account template](./static/cf-templates/monitoring-account-sink.template.yml)
- [Source account template](./static/cf-templates/cross_account_cw_stack.template.yml)

9. (Optional) If you want to use the UnutilizedWafs Feature - You need to enable your target accounts with a Cross Account Role - You can find an example CfnTemplate you can use [here](static/cf-templates/cross_account_roles_unutilized_wafs.yaml).
10. Assume AWS Profile `awsume PROFILENAME`
11. (Optional) Enter `task generateprerequisitesconfig`

Expand All @@ -24,13 +27,26 @@
| FireHoseKey - KeyAlias [^1] | Alias for Key |
| CrossAccountIdforPermissions [^1] | Id of AWS Account for CrossAccount Permission for Bucket and KMS Key(s)|

10. Enter `task deploy config=NAMEOFYOURCONFIGFILE prerequisite=true`


12. When Deploying from a CI/CD pipeline, set an environment variable STACK_NAME to specify which resources to deploy.
- `export STACK_NAME=PreRequisiteStack` => _prerequisites-stack.ts
- `export STACK_NAME=WAFStack` => _web-application-firewall-stack.ts
- `export STACK_NAME=ShieldAdvancedStack` => _shield-advanced-stack.ts
13. Enter `task deploy config=NAMEOFYOURCONFIGFILE`
14. If STACK_NAME isn't set yet, select the type of resource to be deployed (Pre-requisite Stacks, WAF or Shield Advanced)
![List of Resources](./static/options.jpg "Stacks")
### 🏁 Deployment via Taskfile

1. Create new ts file for you WAF and configure Rules in the Configuration (see [owasptopten.ts](values/examples/owasptop10.ts) to see structure) or use enter `task generate-waf-skeleton`

2. Assume AWS Profile `awsume / assume PROFILENAME`
3. (Optional) Enter `task generate-waf-skeleton`
4. Enter `task deploy config=NAMEOFYOURCONFIGFILE`
3. (Optional)
1. Enter `task generate-waf-skeleton`
2. Enter `task generate-shield-skeleton`
4. When Deploying from a CI/CD pipeline, set an environment variable STACK_NAME to specify which resources to deploy.
- `export STACK_NAME=PreRequisiteStack` => _prerequisites-stack.ts
- `export STACK_NAME=WAFStack` => _web-application-firewall-stack.ts
- `export STACK_NAME=ShieldAdvancedStack` => _shield-advanced-stack.ts
5. Enter `task deploy config=NAMEOFYOURCONFIGFILE`
6. If STACK_NAME isn't set yet, select the type of resource to be deployed (Pre-requisite Stacks, WAF or Shield Advanced)
![List of Resources](./static/options.jpg "Stacks")

30 changes: 29 additions & 1 deletion Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,32 @@ See example:

22. Centralized management of RegexPatternSets - No longer will there be a need for manual updates of RegexPatternSets across multiple AWS accounts. These can now be defined in code and replicated for use by WAF rules wherever needed.

23. Automated identification and notification system in Firewall Factory to manage unused WAFs, leveraging Lambda and notification services to streamline infrastructure, optimize costs, and enhance security by addressing WAF sprawl proactively and ensuring efficient resource utilization.
23. Automated identification and notification system in Firewall Factory to manage unused WAFs, leveraging Lambda and notification services to streamline infrastructure, optimize costs, and enhance security by addressing WAF sprawl proactively and ensuring efficient resource utilization.
24. Support Advanced Shield policy deployment through AWS Firewall Manager. AWS Shield Advanced provides customized detection based on traffic patterns to your protected resources, detects and alerts on smaller DDoS attacks, and identifies application layer attacks by baselining traffic and spotting anomalies.

25. Add Grafana Dashbording - The Firewall Factory is able to provision prequsistes and a Central Grafana Dashboard.
The Dashboard shows:
- Request Map Across Countries
- Request Count by Action
- Request by Endpoint (TOP 10)
- Request Count by IP (TOP 10)
- Top HTTP Methods
- Top 10 URIs
- Top 10 Terminating Rule Groups
See example:
![GrafanaFirewallDashboard](./static/grafana-dashboard.jpg)

26. Shield Cloudwatch Dashboard - The Firewall Factory is able to provision a centralized CloudWatch Dashboard.
The Dashboard shows the ammount of DDoS attacks detected

See example:
![ShieldDashboard](./static/shield-dashboard.png)

27. Cloudwatch Cross-Account association - The Firewall Factory offers CloudFormation templates for associating the monitoring account with source accounts:
- [Monitoring account template](./static/cf-templates/monitoring-account-sink.template.yml)
- [Source account template](./static/cf-templates/cross_account_cw_stack.template.yml)

28. Add Cloudwatch Alarms - The prerequisite stack contains Cloudwatch Alarm resource that can be used to trigger the SNS topics incase of DDoS.



13 changes: 9 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tasks:
cdkdestroy:
desc: CDK Destroy
cmds:
- cdk destroy --force
- bash -c 'source options.sh && cdk destroy --force'
vars:
ACCOUNT:
sh: aws sts get-caller-identity |jq -r .Account
Expand All @@ -60,7 +60,7 @@ tasks:
cdkdeploy:
desc: CDK Deploy
cmds:
- cdk deploy --require-approval never {{.TAGS}} --toolkit-stack-name {{.TOOL_KIT_STACKNAME}}
- bash -c 'source options.sh && cdk deploy --require-approval never {{.TAGS}} --toolkit-stack-name {{.TOOL_KIT_STACKNAME}}'
vars:
ACCOUNT:
sh: aws sts get-caller-identity |jq -r .Account
Expand Down Expand Up @@ -96,7 +96,12 @@ tasks:
- sh: "[ '{{.WAF_TEST}}' != 'true' ]"
msg: ⏭ Skipping WAF Testing 🧪
generate-waf-skeleton:
desc: Generate Skeleton
desc: Generate WAF Skeleton
silent: true
cmds:
- ts-node ./lib/tools/generate-skeleton.ts
- ts-node ./lib/tools/generate-waf-skeleton.ts
generate-shield-skeleton:
desc: Generate Shield Skeleton
silent: true
cmds:
- ts-node ./lib/tools/generate-shield-skeleton.ts
Loading