amazon-web-services - 使用 Troposphere 在 cloudformation 模板中配置 WAF(Web 应用程序防火墙)
问题描述
我想创建 WAF 并将其附加到我的负载均衡器。
我需要附加哪些资源和参数来创建 WAF,有什么例子吗,你可以建议我吗?
我尝试过这种方式,但每个规则集都使用 cloudformation 模板失败。
MyWebACL = t.add_resource(
WebACL(
"MyWebACL",
Name=Ref(WebACLName),
DefaultAction=Action(
Type="ALLOW"
),
Rules=[
Rules(
Action=Action(
Type="BLOCK"
),
Priority=1,
RuleId=Ref(ManualIPBlockRule)
),
Rules(
Action=Action(
Type="COUNT"
),
Priority=2,
RuleId=Ref(SizeMatchRule)
),
Rules(
Action=Action(
Type="BLOCK"
),
Priority=3,
RuleId=Ref(SqliRule)
),
Rules(
Action=Action(
Type="BLOCK"
),
Priority=4,
RuleId=Ref(XssRule)
)
],
MetricName=(),
))
这是我的一个示例规则:
SizeMatchRule = t.add_resource(
Rule(
"SizeMatchRule",
Name=Join("", [Ref(WebACLName), "LargeBodyMatchRule"]),
MetricName=Join("", [Ref(WebACLName), "DetectLargeBody"]),
Predicates=[
Predicates(
DataId=Ref(SizeMatchSet),
Type="SizeConstraint",
Negated=False
)
]
))
有什么建议和参考让我知道吗?
解决方案
推荐阅读
- python - 如何以编程方式发送电子邮件并隐藏发件人地址?
- javascript - 如何在 React/Formik Select Component 上显示占位符值?
- wpf - 为什么 ComboBox 项目在被选中后会在 DropDownBorder 中缩小?
- gradle - Kotlin Gradle DSL - buildSrc 中的预编译脚本不起作用
- botframework - 如何将 Dispatch 用于具有不同文化的多个 Luis 模型
- dagger-2 - 如何使用 Dagger 2 测量/跟踪依赖图不同部分的创建时间?
- javascript - 在 d3 图表的 y 轴上正确显示所有月份
- ios - Swift Playgrounds 书架标题
- javascript - 克隆适用于所有点击的元素,而不是这个
- php - Yii2 - 返回空 API 响应