ansible.builtin.fortios_ips_sensor (v2.8.20) — module

Configure IPS sensor.

| "added in version" 2.8 of ansible.builtin"

Authors: Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.8.20

Description

This module is able to configure a FortiGate or FortiOS by allowing the user to configure ips feature and sensor category. Examples includes all options and need to be adjusted to datasources before usage. Tested with FOS v6.0.2


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
  tasks:
  - name: Configure IPS sensor.
    fortios_ips_sensor:
      host:  "{{  host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{  vdom }}"
      ips_sensor:
        state: "present"
        block-malicious-url: "disable"
        comment: "Comment."
        entries:
         -
            action: "pass"
            application: "<your_own_value>"
            exempt-ip:
             -
                dst-ip: "<your_own_value>"
                id:  "10"
                src-ip: "<your_own_value>"
            id:  "12"
            location: "<your_own_value>"
            log: "disable"
            log-attack-context: "disable"
            log-packet: "disable"
            os: "<your_own_value>"
            protocol: "<your_own_value>"
            quarantine: "none"
            quarantine-expiry: "<your_own_value>"
            quarantine-log: "disable"
            rate-count: "22"
            rate-duration: "23"
            rate-mode: "periodical"
            rate-track: "none"
            rule:
             -
                id:  "27"
            severity: "<your_own_value>"
            status: "disable"
        extended-log: "enable"
        filter:
         -
            action: "pass"
            application: "<your_own_value>"
            location: "<your_own_value>"
            log: "disable"
            log-packet: "disable"
            name: "default_name_37"
            os: "<your_own_value>"
            protocol: "<your_own_value>"
            quarantine: "none"
            quarantine-expiry: "41"
            quarantine-log: "disable"
            severity: "<your_own_value>"
            status: "disable"
        name: "default_name_45"
        override:
         -
            action: "pass"
            exempt-ip:
             -
                dst-ip: "<your_own_value>"
                id:  "50"
                src-ip: "<your_own_value>"
            log: "disable"
            log-packet: "disable"
            quarantine: "none"
            quarantine-expiry: "55"
            quarantine-log: "disable"
            rule-id: "57"
            status: "disable"
        replacemsg-group: "<your_own_value> (source system.replacemsg-group.name)"

Inputs

    
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: false
    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

ips_sensor:
    default: null
    description:
    - Configure IPS sensor.
    suboptions:
      block-malicious-url:
        choices:
        - disable
        - enable
        description:
        - Enable/disable malicious URL blocking.
      comment:
        description:
        - Comment.
      entries:
        description:
        - IPS sensor filter.
        suboptions:
          action:
            choices:
            - pass
            - block
            - reset
            - default
            description:
            - Action taken with traffic in which signatures are detected.
          application:
            description:
            - Applications to be protected. set application ? lists available applications.
              all includes all applications. other includes all unlisted applications.
          exempt-ip:
            description:
            - Traffic from selected source or destination IP addresses is exempt from
              this signature.
            suboptions:
              dst-ip:
                description:
                - Destination IP address and netmask.
              id:
                description:
                - Exempt IP ID.
                required: true
              src-ip:
                description:
                - Source IP address and netmask.
          id:
            description:
            - Rule ID in IPS database (0 - 4294967295).
            required: true
          location:
            description:
            - Protect client or server traffic.
          log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable logging of signatures included in filter.
          log-attack-context:
            choices:
            - disable
            - enable
            description:
            - 'Enable/disable logging of attack context: URL buffer, header buffer, body
              buffer, packet buffer.'
          log-packet:
            choices:
            - disable
            - enable
            description:
            - Enable/disable packet logging. Enable to save the packet that triggers the
              filter. You can download the packets in pcap format for diagnostic use.
          os:
            description:
            - Operating systems to be protected.  all includes all operating systems.
              other includes all unlisted operating systems.
          protocol:
            description:
            - Protocols to be examined. set protocol ? lists available protocols. all
              includes all protocols. other includes all unlisted protocols.
          quarantine:
            choices:
            - none
            - attacker
            description:
            - Quarantine method.
          quarantine-expiry:
            description:
            - Duration of quarantine. (Format
          quarantine-log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable quarantine logging.
          rate-count:
            description:
            - Count of the rate.
          rate-duration:
            description:
            - Duration (sec) of the rate.
          rate-mode:
            choices:
            - periodical
            - continuous
            description:
            - Rate limit mode.
          rate-track:
            choices:
            - none
            - src-ip
            - dest-ip
            - dhcp-client-mac
            - dns-domain
            description:
            - Track the packet protocol field.
          rule:
            description:
            - Identifies the predefined or custom IPS signatures to add to the sensor.
            suboptions:
              id:
                description:
                - Rule IPS.
                required: true
          severity:
            description:
            - Relative severity of the signature, from info to critical. Log messages
              generated by the signature include the severity.
          status:
            choices:
            - disable
            - enable
            - default
            description:
            - Status of the signatures included in filter. default enables the filter
              and only use filters with default status of enable. Filters with default
              status of disable will not be used.
      extended-log:
        choices:
        - enable
        - disable
        description:
        - Enable/disable extended logging.
      filter:
        description:
        - IPS sensor filter.
        suboptions:
          action:
            choices:
            - pass
            - block
            - reset
            - default
            description:
            - Action of selected rules.
          application:
            description:
            - Vulnerable application filter.
          location:
            description:
            - Vulnerability location filter.
          log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable logging of selected rules.
          log-packet:
            choices:
            - disable
            - enable
            description:
            - Enable/disable packet logging of selected rules.
          name:
            description:
            - Filter name.
            required: true
          os:
            description:
            - Vulnerable OS filter.
          protocol:
            description:
            - Vulnerable protocol filter.
          quarantine:
            choices:
            - none
            - attacker
            description:
            - Quarantine IP or interface.
          quarantine-expiry:
            description:
            - Duration of quarantine in minute.
          quarantine-log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable logging of selected quarantine.
          severity:
            description:
            - Vulnerability severity filter.
          status:
            choices:
            - disable
            - enable
            - default
            description:
            - Selected rules status.
      name:
        description:
        - Sensor name.
        required: true
      override:
        description:
        - IPS override rule.
        suboptions:
          action:
            choices:
            - pass
            - block
            - reset
            description:
            - Action of override rule.
          exempt-ip:
            description:
            - Exempted IP.
            suboptions:
              dst-ip:
                description:
                - Destination IP address and netmask.
              id:
                description:
                - Exempt IP ID.
                required: true
              src-ip:
                description:
                - Source IP address and netmask.
          log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable logging.
          log-packet:
            choices:
            - disable
            - enable
            description:
            - Enable/disable packet logging.
          quarantine:
            choices:
            - none
            - attacker
            description:
            - Quarantine IP or interface.
          quarantine-expiry:
            description:
            - Duration of quarantine in minute.
          quarantine-log:
            choices:
            - disable
            - enable
            description:
            - Enable/disable logging of selected quarantine.
          rule-id:
            description:
            - Override rule ID.
            required: true
          status:
            choices:
            - disable
            - enable
            description:
            - Enable/disable status of override rule.
      replacemsg-group:
        description:
        - Replacement message group. Source system.replacemsg-group.name.
      state:
        choices:
        - present
        - absent
        description:
        - Indicates whether to create or remove the object

Outputs

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: key1
  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