【发布时间】:2020-12-08 12:50:07
【问题描述】:
我有点惊讶我遇到了这个问题。我创建了一个 aws_wafregional_regex_pattern_set 来阻止在其 URI 中包含 php 的传入请求。我希望所有带有 php 的请求都会被阻止。但是,请求仍在通过。也许,我误解了这个资源的实际作用?我在下面附上了一些示例代码。
resource "aws_wafregional_rule" "block_uris_containining_php" {
name = "BlockUrisContainingPhp"
metric_name = "BlockUrisContainingPhp"
predicate {
data_id = "${aws_wafregional_regex_match_set.block_uris_containing_php.id}"
negated = false
type = "RegexMatch"
}
}
resource "aws_wafregional_regex_match_set" "block_uris_containing_php" {
name = "BlockUrisContainingPhp"
regex_match_tuple {
field_to_match {
type = "URI"
}
regex_pattern_set_id = "${aws_wafregional_regex_pattern_set.block_uris_containing_php.id}"
text_transformation = "NONE"
}
}
resource "aws_wafregional_regex_pattern_set" "block_uris_containing_php" {
name = "BlockUrisContainingPhp"
regex_pattern_strings = [ "php$" ]
}
此代码在 AWS WAF 中创建一个 String and regex matching condition。所以,我知道它至少正在被创建。当我向负载均衡器发送包含 php 的请求时,我使用 cloudwatch 检查被阻止的请求,但每个请求都成功通过。对此的任何帮助将不胜感激。
【问题讨论】:
标签: terraform