An open API service indexing awesome lists of open source software.

https://github.com/koki-develop/aws-waf-managed-rule-group-exception-example

AWS WAF ACL でマネージドルールの特定のルールを特定の条件下で無効にする Terraform のサンプルコード。
https://github.com/koki-develop/aws-waf-managed-rule-group-exception-example

Last synced: 13 days ago
JSON representation

AWS WAF ACL でマネージドルールの特定のルールを特定の条件下で無効にする Terraform のサンプルコード。

Awesome Lists containing this project

README

          

# 概要

AWS WAF ACL でマネージドルールの特定のルールを特定の条件下で無効にする Terraform のサンプルコード。
当該プロジェクトでは `/hello.txt` というパスに対して `AWSManagedRulesCommonRuleSet` ルールセットの `NoUserAgent_HEADER` ルールが適用されないように設定している。

# 検証手順

## リソースの作成

```
$ cd terraform
$ terraform init
$ terraform apply
```

## WAF の動作確認

```sh
$ curl 'https:///hello.txt' -H 'User-Agent: curl'
Hello, World

# /hello.txt ではNoUserAgent_HEADER ルールによってブロックされない
$ curl 'https:///hello.txt' -H 'User-Agent:'
Hello, World
```

```sh
$ curl 'https:///goodbye.txt' -H 'User-Agent: curl'
Goodbye, World

# 他のパスでは NoUserAgent_HEADER ルールによってブロックされる
$ curl 'https:///goodbye.txt' -H 'User-Agent:'

ERROR: The request could not be satisfied

403 ERROR


The request could not be satisfied.




Request blocked.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.


If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.





Generated by cloudfront (CloudFront)
Request ID: ********************************************************


```

# 参考

- [[AWS WAF] マネージドルールグループに対して例外条件を設定する | DevelopersIO](https://dev.classmethod.jp/articles/aws-waf-managed-rule-group-exception-conditions/)
- [AWS WAF によってブロックされたファイルのアップロード | AWS re:Post](https://repost.aws/ja/knowledge-center/waf-upload-blocked-files)