fortinet.fortios.fortios_waf_profile 模块 – 在 Fortinet 的 FortiOS 和 FortiGate 中配置 Web 应用程序防火墙。
注意
此模块是 fortinet.fortios 集合(版本 2.3.8)的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install fortinet.fortios
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:fortinet.fortios.fortios_waf_profile
。
fortinet.fortios 2.0.0 中的新增功能
概要
此模块能够通过允许用户设置和修改 waf 功能和配置文件类别来配置 FortiGate 或 FortiOS (FOS) 设备。示例包括在使用前需要调整到数据源的所有参数和值。使用 FOS v6.0.0 进行测试
要求
执行此模块的主机需要满足以下要求。
ansible>=2.15
参数
参数 |
注释 |
---|---|
基于令牌的身份验证。从 Fortigate 的 GUI 生成。 |
|
启用/禁用任务的日志记录。 选择
|
|
要操作的成员属性路径。 如果存在多个属性,则用斜杠字符分隔。 标有 member_path 的参数对于执行成员操作是合法的。 |
|
在指定的属性路径下添加或删除成员。 指定 member_state 时,将忽略 state 选项。 选择
|
|
指示是创建还是删除对象。 选择
|
|
虚拟域,在先前定义的那些之中。vdom 是 FortiGate 的一个虚拟实例,可以配置并用作不同的单元。 默认值: |
|
配置 Web 应用程序防火墙配置。 |
|
地址阻止列表和允许列表。 |
|
阻止的地址。 |
|
地址名称。源 firewall.address.name firewall.addrgrp.name。 |
|
启用/禁用对阻止地址的日志记录。 选择
|
|
严重性。 选择
|
|
状态。 选择
|
|
可信地址。 |
|
地址名称。源 firewall.address.name firewall.addrgrp.name。 |
|
注释。 |
|
WAF HTTP 协议限制。 |
|
请求中的 HTTP 内容长度。 |
|
操作。 选择
|
|
HTTP 内容的长度,以字节为单位(0 到 2147483647)。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
HTTP 约束异常。 |
|
主机地址。源 firewall.address.name firewall.addrgrp.name。 |
|
请求中的 HTTP 内容长度。 选择
|
|
请求中的 HTTP 标头长度。 选择
|
|
启用/禁用主机名检查。 选择
|
|
异常 ID。请参阅 <a href=’#notes’>Notes</a>。 |
|
请求中的 HTTP 行长度。 选择
|
|
启用/禁用格式错误的 HTTP 请求检查。 选择
|
|
HTTP 请求中的最大 Cookie 数。 选择
|
|
HTTP 标头行的最大数目。 选择
|
|
HTTP 范围行中的最大范围段数。 选择
|
|
URL 中的最大参数数。 选择
|
|
启用/禁用 HTTP 方法检查。 选择
|
|
URL、HTTP POST 请求或 HTTP 主体中参数的最大长度。 选择
|
|
URL 模式。 |
|
启用/禁用基于正则表达式的模式匹配。 选择
|
|
URL 中参数的最大长度。 选择
|
|
启用/禁用 HTTP 版本检查。 选择
|
|
请求中的 HTTP 标头长度。 |
|
操作。 选择
|
|
HTTP 标头的长度,以字节为单位(0 到 2147483647)。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
启用/禁用主机名检查。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
请求中的 HTTP 行长度。 |
|
操作。 选择
|
|
HTTP 行的长度,以字节为单位(0 到 2147483647)。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
启用/禁用格式错误的 HTTP 请求检查。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
HTTP 请求中的最大 Cookie 数。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
HTTP 请求中的最大 Cookie 数(0 到 2147483647)。 |
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
HTTP 标头行的最大数目。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
HTTP 标头行的最大数目(0 到 2147483647)。 |
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
HTTP 范围行中的最大范围段数。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
HTTP 范围行中的最大范围段数(0 到 2147483647)。 |
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
URL 中的最大参数数。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
URL 中的最大参数数(0 到 2147483647)。 |
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
启用/禁用 HTTP 方法检查。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
URL、HTTP POST 请求或 HTTP 主体中参数的最大长度。 |
|
操作。 选择
|
|
URL、HTTP POST 请求或 HTTP 主体中参数的最大长度,以字节为单位(0 到 2147483647)。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
URL 中参数的最大长度。 |
|
操作。 选择
|
|
URL 参数的最大长度,以字节为单位(0 到 2147483647)。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
启用/禁用 HTTP 版本检查。 |
|
操作。 选择
|
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
启用/禁用约束。 选择
|
|
启用/禁用扩展日志记录。 选择
|
|
禁用/启用外部 HTTP 检查。 选择
|
|
方法限制。 |
|
方法。 选择
|
|
启用/禁用日志记录。 选择
|
|
HTTP 方法策略。 |
|
主机地址。源 firewall.address.name firewall.addrgrp.name。 |
|
允许的方法。 选择
|
|
HTTP 方法策略 ID。请参阅 <a href=’#notes’>注释</a>。 |
|
URL 模式。 |
|
启用/禁用基于正则表达式的模式匹配。 选择
|
|
严重性。 选择
|
|
状态。 选择
|
|
WAF 配置文件名称。 |
|
WAF 签名。 |
|
检测到违规行为的最小信用卡数量。 |
|
自定义签名。 |
|
操作。 选择
|
|
模式中的大小写敏感性。 选择
|
|
流量方向。 选择
|
|
启用/禁用日志记录。 选择
|
|
签名名称。 |
|
匹配模式。 |
|
严重性。 选择
|
|
状态。 选择
|
|
匹配的 HTTP 目标。 选择
|
|
禁用的签名。 |
|
签名 ID。请参阅 <a href=’#notes’>注释</a>。源 waf.signature.id。 |
|
禁用的签名子类。 |
|
签名子类 ID。请参阅 <a href=’#notes’>注释</a>。源 waf.sub-class.id。 |
|
主签名类。 |
|
操作。 选择
|
|
主签名类 ID。请参阅 <a href=’#notes’>注释</a>。源 waf.main-class.id。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
|
状态。 选择
|
|
URL 访问列表。 |
|
URL 访问模式。 |
|
URL 访问模式 ID。请参阅 <a href=’#notes’>注释</a>。 |
|
启用/禁用匹配否定。 选择
|
|
URL 模式。 |
|
启用/禁用基于正则表达式的模式匹配。 选择
|
|
源地址。源 firewall.address.name firewall.addrgrp.name。 |
|
操作。 选择
|
|
主机地址。源 firewall.address.name firewall.addrgrp.name。 |
|
URL 访问 ID。请参阅 <a href=’#notes’>注释</a>。 |
|
启用/禁用日志记录。 选择
|
|
严重性。 选择
|
注释
注意
旧版 fortiosapi 已被弃用,httpapi 是运行 playbook 的首选方式
该模块支持 check_mode。
示例
- name: Configure Web application firewall configuration.
fortinet.fortios.fortios_waf_profile:
vdom: "{{ vdom }}"
state: "present"
access_token: "<your_own_value>"
waf_profile:
address_list:
blocked_address:
-
name: "default_name_5 (source firewall.address.name firewall.addrgrp.name)"
blocked_log: "enable"
severity: "high"
status: "enable"
trusted_address:
-
name: "default_name_10 (source firewall.address.name firewall.addrgrp.name)"
comment: "Comment."
constraint:
content_length:
action: "allow"
length: "67108864"
log: "enable"
severity: "high"
status: "enable"
exception:
-
address: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
content_length: "enable"
header_length: "enable"
hostname: "enable"
id: "24"
line_length: "enable"
malformed: "enable"
max_cookie: "enable"
max_header_line: "enable"
max_range_segment: "enable"
max_url_param: "enable"
method: "enable"
param_length: "enable"
pattern: "<your_own_value>"
regex: "enable"
url_param_length: "enable"
version: "enable"
header_length:
action: "allow"
length: "8192"
log: "enable"
severity: "high"
status: "enable"
hostname:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
line_length:
action: "allow"
length: "1024"
log: "enable"
severity: "high"
status: "enable"
malformed:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
max_cookie:
action: "allow"
log: "enable"
max_cookie: "16"
severity: "high"
status: "enable"
max_header_line:
action: "allow"
log: "enable"
max_header_line: "32"
severity: "high"
status: "enable"
max_range_segment:
action: "allow"
log: "enable"
max_range_segment: "5"
severity: "high"
status: "enable"
max_url_param:
action: "allow"
log: "enable"
max_url_param: "16"
severity: "high"
status: "enable"
method:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
param_length:
action: "allow"
length: "8192"
log: "enable"
severity: "high"
status: "enable"
url_param_length:
action: "allow"
length: "8192"
log: "enable"
severity: "high"
status: "enable"
version:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
extended_log: "enable"
external: "disable"
method:
default_allowed_methods: "get"
log: "enable"
method_policy:
-
address: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
allowed_methods: "get"
id: "113"
pattern: "<your_own_value>"
regex: "enable"
severity: "high"
status: "enable"
name: "default_name_118"
signature:
credit_card_detection_threshold: "3"
custom_signature:
-
action: "allow"
case_sensitivity: "disable"
direction: "request"
log: "enable"
name: "default_name_126"
pattern: "<your_own_value>"
severity: "high"
status: "enable"
target: "arg"
disabled_signature:
-
id: "132 (source waf.signature.id)"
disabled_sub_class:
-
id: "134 (source waf.sub-class.id)"
main_class:
-
action: "allow"
id: "137 (source waf.main-class.id)"
log: "enable"
severity: "high"
status: "enable"
url_access:
-
access_pattern:
-
id: "143"
negate: "enable"
pattern: "<your_own_value>"
regex: "enable"
srcaddr: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
action: "bypass"
address: "<your_own_value> (source firewall.address.name firewall.addrgrp.name)"
id: "150"
log: "enable"
severity: "high"
返回值
常见的返回值记录在此处,以下是此模块特有的字段
键 |
描述 |
---|---|
飞塔镜像的版本号 返回:总是 示例: |
|
上次用于将内容配置到飞塔的方法 返回:总是 示例: |
|
飞塔在上次应用的操作中给出的最后结果 返回:总是 示例: |
|
上次调用飞塔时使用的主键 (id) 返回:成功 示例: |
|
用于满足请求的表名称 返回:总是 示例: |
|
用于满足请求的表的路径 返回:总是 示例: |
|
内部修订号 返回:总是 示例: |
|
设备的序列号 返回:总是 示例: |
|
操作结果的指示 返回:总是 示例: |
|
使用的虚拟域 返回:总是 示例: |
|
飞塔的版本 返回:总是 示例: |