【发布时间】:2020-10-01 14:24:18
【问题描述】:
我正在尝试使用 WAFv2 在我们的 Web ACL 上设置日志记录。
我可以使用一个“RedactedField”成功运行put-logging-configuration 命令,但是在第一个之后添加更多标题时遇到问题。
这是有问题的documentation——我无法完全理解它:
您希望 AWS WAF 检查的 Web 请求部分。根据类型,包括您要检查的单个 FieldToMatch 类型,并根据需要提供其他规范。您在 FieldToMatch 中为每个需要它的规则语句指定一个请求组件。要检查 Web 请求的多个组件,请为每个组件创建单独的规则语句。
这是我的有效命令:
aws --region="us-west-2" wafv2 put-logging-configuration \
--logging-configuration ResourceArn=${MY_WEB_ACL_ARN},LogDestinationConfigs=${MY_FIREHOSE_DELIVERY_STREAM_ARN},RedactedFields={SingleHeader={Name="cookie"}}
这给出了以下结果:
{
"LoggingConfiguration": {
"ResourceArn": "{My arn}",
"LogDestinationConfigs": [
"{My firehose log stream arn}"
],
"RedactedFields": [
{
"SingleHeader": {
"Name": "cookie"
}
}
]
}
}
我还希望编辑“授权”标题。
我在--logging-configuration 的“RedactedFields”部分尝试了以下内容:
1) Two SingleHeader statements within brackets
RedactedFields={SingleHeader={Name="cookie"},SingleHeader={Name="cookie"}}
(Results in 'Unknown options' error.)
2) Two sets of brackets with comma
RedactedFields={SingleHeader={Name="cookie"}},{SingleHeader={Name="authorization"}}
Error parsing parameter '--logging-configuration': Expected: '=', received: '{' for input:
3) Two sets of brackets, no comma
RedactedFields={SingleHeader={Name="cookie"}}{SingleHeader={Name="authorization"}}
Error parsing parameter '--logging-configuration': Expected: ',', received: '{' for input:
4) Two SingleHeader statements within brackets, no comma
RedactedFields={SingleHeader={Name="cookie"}{SingleHeader={Name="authorization"}}
Error parsing parameter '--logging-configuration': Expected: ',', received: '{' for input:
5) One SingleHeader statement, two headers (Isn't really a SingleHeader anymore, is it?)
RedactedFields={SingleHeader={Name="cookie", "authorization"}}
Unknown options: authorization}}
我在这里做错了什么?我尝试了许多其他方法,包括[] 方括号、“名称”的多个实例、“RedactedFields”的多个实例——完全没有用。
【问题讨论】:
标签: amazon-web-services amazon-waf