ansible / ansible.builtin / v2.8.15 / module / fortios_waf_profile Web application firewall configuration in Fortinet's FortiOS and FortiGate. | "added in version" 2.8 of ansible.builtin" Authors: Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico) preview | supported by communityansible.builtin.fortios_waf_profile (v2.8.15) — module
pip
Install with pip install ansible==2.8.15
This module is able to configure a FortiGate or FortiOS 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.2
- hosts: localhost vars: host: "192.168.122.40" username: "admin" password: "" vdom: "root" tasks: - name: Web application firewall configuration. fortios_waf_profile: host: "{{ host }}" username: "{{ username }}" password: "{{ password }}" vdom: "{{ vdom }}" https: "False" waf_profile: state: "present" 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"
host: description: - FortiOS or FortiGate ip address. required: true vdom: default: root description: - 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. https: default: true description: - Indicates if the requests towards FortiGate must use HTTPS protocol type: bool password: default: '' description: - FortiOS or FortiGate password. username: description: - FortiOS or FortiGate username. required: true waf_profile: default: null description: - Web application firewall configuration. suboptions: address-list: description: - Black address list and white address list. suboptions: blocked-address: description: - Blocked address. suboptions: name: description: - Address name. Source firewall.address.name firewall.addrgrp.name. required: true blocked-log: choices: - enable - disable description: - Enable/disable logging on blocked addresses. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Status. trusted-address: description: - Trusted address. suboptions: name: description: - Address name. Source firewall.address.name firewall.addrgrp.name. required: true comment: description: - Comment. constraint: description: - WAF HTTP protocol restrictions. suboptions: content-length: description: - HTTP content length in request. suboptions: action: choices: - allow - block description: - Action. length: description: - Length of HTTP content in bytes (0 to 2147483647). log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. exception: description: - HTTP constraint exception. suboptions: address: description: - Host address. Source firewall.address.name firewall.addrgrp.name. content-length: choices: - enable - disable description: - HTTP content length in request. header-length: choices: - enable - disable description: - HTTP header length in request. hostname: choices: - enable - disable description: - Enable/disable hostname check. id: description: - Exception ID. required: true line-length: choices: - enable - disable description: - HTTP line length in request. malformed: choices: - enable - disable description: - Enable/disable malformed HTTP request check. max-cookie: choices: - enable - disable description: - Maximum number of cookies in HTTP request. max-header-line: choices: - enable - disable description: - Maximum number of HTTP header line. max-range-segment: choices: - enable - disable description: - Maximum number of range segments in HTTP range line. max-url-param: choices: - enable - disable description: - Maximum number of parameters in URL. method: choices: - enable - disable description: - Enable/disable HTTP method check. param-length: choices: - enable - disable description: - Maximum length of parameter in URL, HTTP POST request or HTTP body. pattern: description: - URL pattern. regex: choices: - enable - disable description: - Enable/disable regular expression based pattern match. url-param-length: choices: - enable - disable description: - Maximum length of parameter in URL. version: choices: - enable - disable description: - Enable/disable HTTP version check. header-length: description: - HTTP header length in request. suboptions: action: choices: - allow - block description: - Action. length: description: - Length of HTTP header in bytes (0 to 2147483647). log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. hostname: description: - Enable/disable hostname check. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. line-length: description: - HTTP line length in request. suboptions: action: choices: - allow - block description: - Action. length: description: - Length of HTTP line in bytes (0 to 2147483647). log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. malformed: description: - Enable/disable malformed HTTP request check. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. max-cookie: description: - Maximum number of cookies in HTTP request. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. max-cookie: description: - Maximum number of cookies in HTTP request (0 to 2147483647). severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. max-header-line: description: - Maximum number of HTTP header line. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. max-header-line: description: - Maximum number HTTP header lines (0 to 2147483647). severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. max-range-segment: description: - Maximum number of range segments in HTTP range line. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. max-range-segment: description: - Maximum number of range segments in HTTP range line (0 to 2147483647). severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. max-url-param: description: - Maximum number of parameters in URL. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. max-url-param: description: - Maximum number of parameters in URL (0 to 2147483647). severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. method: description: - Enable/disable HTTP method check. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. param-length: description: - Maximum length of parameter in URL, HTTP POST request or HTTP body. suboptions: action: choices: - allow - block description: - Action. length: description: - Maximum length of parameter in URL, HTTP POST request or HTTP body in bytes (0 to 2147483647). log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. url-param-length: description: - Maximum length of parameter in URL. suboptions: action: choices: - allow - block description: - Action. length: description: - Maximum length of URL parameter in bytes (0 to 2147483647). log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. version: description: - Enable/disable HTTP version check. suboptions: action: choices: - allow - block description: - Action. log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Enable/disable the constraint. extended-log: choices: - enable - disable description: - Enable/disable extended logging. external: choices: - disable - enable description: - Disable/Enable external HTTP Inspection. method: description: - Method restriction. suboptions: default-allowed-methods: choices: - get - post - put - head - connect - trace - options - delete - others description: - Methods. log: choices: - enable - disable description: - Enable/disable logging. method-policy: description: - HTTP method policy. suboptions: address: description: - Host address. Source firewall.address.name firewall.addrgrp.name. allowed-methods: choices: - get - post - put - head - connect - trace - options - delete - others description: - Allowed Methods. id: description: - HTTP method policy ID. required: true pattern: description: - URL pattern. regex: choices: - enable - disable description: - Enable/disable regular expression based pattern match. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Status. name: description: - WAF Profile name. required: true signature: description: - WAF signatures. suboptions: credit-card-detection-threshold: description: - The minimum number of Credit cards to detect violation. custom-signature: description: - Custom signature. suboptions: action: choices: - allow - block - erase description: - Action. case-sensitivity: choices: - disable - enable description: - Case sensitivity in pattern. direction: choices: - request - response description: - Traffic direction. log: choices: - enable - disable description: - Enable/disable logging. name: description: - Signature name. required: true pattern: description: - Match pattern. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Status. target: choices: - arg - arg-name - req-body - req-cookie - req-cookie-name - req-filename - req-header - req-header-name - req-raw-uri - req-uri - resp-body - resp-hdr - resp-status description: - Match HTTP target. disabled-signature: description: - Disabled signatures suboptions: id: description: - Signature ID. Source waf.signature.id. required: true disabled-sub-class: description: - Disabled signature subclasses. suboptions: id: description: - Signature subclass ID. Source waf.sub-class.id. required: true main-class: description: - Main signature class. suboptions: action: choices: - allow - block - erase description: - Action. id: description: - Main signature class ID. Source waf.main-class.id. required: true log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity. status: choices: - enable - disable description: - Status. state: choices: - present - absent description: - Indicates whether to create or remove the object url-access: description: - URL access list suboptions: access-pattern: description: - URL access pattern. suboptions: id: description: - URL access pattern ID. required: true negate: choices: - enable - disable description: - Enable/disable match negation. pattern: description: - URL pattern. regex: choices: - enable - disable description: - Enable/disable regular expression based pattern match. srcaddr: description: - Source address. Source firewall.address.name firewall.addrgrp.name. action: choices: - bypass - permit - block description: - Action. address: description: - Host address. Source firewall.address.name firewall.addrgrp.name. id: description: - URL access ID. required: true log: choices: - enable - disable description: - Enable/disable logging. severity: choices: - high - medium - low description: - Severity.
build: description: Build number of the fortigate image returned: always sample: '1547' type: str http_method: description: Last method used to provision the content into FortiGate returned: always sample: PUT type: str http_status: description: Last result given by FortiGate on last operation applied returned: always sample: '200' type: str mkey: description: Master key (id) used in the last call to FortiGate returned: success sample: id type: str name: description: Name of the table used to fulfill the request returned: always sample: urlfilter type: str path: description: Path of the table used to fulfill the request returned: always sample: webfilter type: str revision: description: Internal revision number returned: always sample: 17.0.2.10658 type: str serial: description: Serial number of the unit returned: always sample: FGVMEVYYQT3AB5352 type: str status: description: Indication of the operation's result returned: always sample: success type: str vdom: description: Virtual domain used returned: always sample: root type: str version: description: Version of the FortiGate returned: always sample: v5.6.3 type: str