fortinet.fortios.fortios_waf_profile module – Configure Web application firewall configuration in Fortinet’s FortiOS and FortiGate.
Note
This module is part of the fortinet.fortios collection (version 2.1.6).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install fortinet.fortios
.
To use it in a playbook, specify: fortinet.fortios.fortios_waf_profile
.
New in version 2.0.0: of fortinet.fortios
Synopsis
This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify waf feature and profile category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.0
Requirements
The below requirements are needed on the host that executes this module.
ansible>=2.9.0
Parameters
Parameter |
Comments |
---|---|
Token-based authentication. Generated from GUI of Fortigate. |
|
Enable/Disable logging for task. Choices:
|
|
Member attribute path to operate on. Delimited by a slash character if there are more than one attribute. Parameter marked with member_path is legitimate for doing member operation. |
|
Add or delete a member under specified attribute path. When member_state is specified, the state option is ignored. Choices:
|
|
Indicates whether to create or remove the object. Choices:
|
|
Virtual domain, among those defined previously. A vdom is a virtual instance of the FortiGate that can be configured and used as a different unit. Default: “root” |
|
Configure Web application firewall configuration. |
|
Address block and allow lists. |
|
Blocked address. |
|
Address name. Source firewall.address.name firewall.addrgrp.name. |
|
Enable/disable logging on blocked addresses. Choices:
|
|
Severity. Choices:
|
|
Status. Choices:
|
|
Trusted address. |
|
Address name. Source firewall.address.name firewall.addrgrp.name. |
|
Comment. |
|
WAF HTTP protocol restrictions. |
|
HTTP content length in request. |
|
Action. Choices:
|
|
Length of HTTP content in bytes (0 to 2147483647). |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
HTTP constraint exception. |
|
Host address. Source firewall.address.name firewall.addrgrp.name. |
|
HTTP content length in request. Choices:
|
|
HTTP header length in request. Choices:
|
|
Enable/disable hostname check. Choices:
|
|
Exception ID. |
|
HTTP line length in request. Choices:
|
|
Enable/disable malformed HTTP request check. Choices:
|
|
Maximum number of cookies in HTTP request. Choices:
|
|
Maximum number of HTTP header line. Choices:
|
|
Maximum number of range segments in HTTP range line. Choices:
|
|
Maximum number of parameters in URL. Choices:
|
|
Enable/disable HTTP method check. Choices:
|
|
Maximum length of parameter in URL, HTTP POST request or HTTP body. Choices:
|
|
URL pattern. |
|
Enable/disable regular expression based pattern match. Choices:
|
|
Maximum length of parameter in URL. Choices:
|
|
Enable/disable HTTP version check. Choices:
|
|
HTTP header length in request. |
|
Action. Choices:
|
|
Length of HTTP header in bytes (0 to 2147483647). |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Enable/disable hostname check. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
HTTP line length in request. |
|
Action. Choices:
|
|
Length of HTTP line in bytes (0 to 2147483647). |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Enable/disable malformed HTTP request check. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum number of cookies in HTTP request. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Maximum number of cookies in HTTP request (0 to 2147483647). |
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum number of HTTP header line. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Maximum number HTTP header lines (0 to 2147483647). |
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum number of range segments in HTTP range line. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Maximum number of range segments in HTTP range line (0 to 2147483647). |
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum number of parameters in URL. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Maximum number of parameters in URL (0 to 2147483647). |
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Enable/disable HTTP method check. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum length of parameter in URL, HTTP POST request or HTTP body. |
|
Action. Choices:
|
|
Maximum length of parameter in URL, HTTP POST request or HTTP body in bytes (0 to 2147483647). |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Maximum length of parameter in URL. |
|
Action. Choices:
|
|
Maximum length of URL parameter in bytes (0 to 2147483647). |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Enable/disable HTTP version check. |
|
Action. Choices:
|
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Enable/disable the constraint. Choices:
|
|
Enable/disable extended logging. Choices:
|
|
Disable/Enable external HTTP Inspection. Choices:
|
|
Method restriction. |
|
Methods. Choices:
|
|
Enable/disable logging. Choices:
|
|
HTTP method policy. |
|
Host address. Source firewall.address.name firewall.addrgrp.name. |
|
Allowed Methods. Choices:
|
|
HTTP method policy ID. |
|
URL pattern. |
|
Enable/disable regular expression based pattern match. Choices:
|
|
Severity. Choices:
|
|
Status. Choices:
|
|
WAF Profile name. |
|
WAF signatures. |
|
The minimum number of Credit cards to detect violation. |
|
Custom signature. |
|
Action. Choices:
|
|
Case sensitivity in pattern. Choices:
|
|
Traffic direction. Choices:
|
|
Enable/disable logging. Choices:
|
|
Signature name. |
|
Match pattern. |
|
Severity. Choices:
|
|
Status. Choices:
|
|
Match HTTP target. Choices:
|
|
Disabled signatures. |
|
Signature ID. Source waf.signature.id. |
|
Disabled signature subclasses. |
|
Signature subclass ID. Source waf.sub-class.id. |
|
Main signature class. |
|
Action. Choices:
|
|
Main signature class ID. Source waf.main-class.id. |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
|
Status. Choices:
|
|
URL access list. |
|
URL access pattern. |
|
URL access pattern ID. |
|
Enable/disable match negation. Choices:
|
|
URL pattern. |
|
Enable/disable regular expression based pattern match. Choices:
|
|
Source address. Source firewall.address.name firewall.addrgrp.name. |
|
Action. Choices:
|
|
Host address. Source firewall.address.name firewall.addrgrp.name. |
|
URL access ID. |
|
Enable/disable logging. Choices:
|
|
Severity. Choices:
|
Examples
- hosts: fortigates
collections:
- fortinet.fortios
connection: httpapi
vars:
vdom: "root"
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 443
tasks:
- name: Configure Web application firewall configuration.
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: "15"
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: "39"
log: "enable"
severity: "high"
status: "enable"
hostname:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
line_length:
action: "allow"
length: "50"
log: "enable"
severity: "high"
status: "enable"
malformed:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
max_cookie:
action: "allow"
log: "enable"
max_cookie: "62"
severity: "high"
status: "enable"
max_header_line:
action: "allow"
log: "enable"
max_header_line: "68"
severity: "high"
status: "enable"
max_range_segment:
action: "allow"
log: "enable"
max_range_segment: "74"
severity: "high"
status: "enable"
max_url_param:
action: "allow"
log: "enable"
max_url_param: "80"
severity: "high"
status: "enable"
method:
action: "allow"
log: "enable"
severity: "high"
status: "enable"
param_length:
action: "allow"
length: "90"
log: "enable"
severity: "high"
status: "enable"
url_param_length:
action: "allow"
length: "96"
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: "120"
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"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Build number of the fortigate image Returned: always Sample: “1547” |
|
Last method used to provision the content into FortiGate Returned: always Sample: “PUT” |
|
Last result given by FortiGate on last operation applied Returned: always Sample: “200” |
|
Master key (id) used in the last call to FortiGate Returned: success Sample: “id” |
|
Name of the table used to fulfill the request Returned: always Sample: “urlfilter” |
|
Path of the table used to fulfill the request Returned: always Sample: “webfilter” |
|
Internal revision number Returned: always Sample: “17.0.2.10658” |
|
Serial number of the unit Returned: always Sample: “FGVMEVYYQT3AB5352” |
|
Indication of the operation’s result Returned: always Sample: “success” |
|
Virtual domain used Returned: always Sample: “root” |
|
Version of the FortiGate Returned: always Sample: “v5.6.3” |
Authors
Link Zheng (@chillancezen)
Jie Xue (@JieX19)
Hongbin Lu (@fgtdev-hblu)
Frank Shen (@frankshen01)
Miguel Angel Munoz (@mamunozgonzalez)
Nicolas Thomas (@thomnico)