lix_fortinet.fortios.fortios_dnsfilter_profile (102.2.120) — module

Configure DNS domain filter profile in Fortinet's FortiOS and FortiGate.

| "added in version" 2.0.0 of lix_fortinet.fortios"

Authors: Link Zheng (@chillancezen), Jie Xue (@JieX19), Hongbin Lu (@fgtdev-hblu), Frank Shen (@frankshen01), Miguel Angel Munoz (@mamunozgonzalez), Nicolas Thomas (@thomnico)

preview | supported by community

Install collection

Install with ansible-galaxy collection install lix_fortinet.fortios:==102.2.120


Add to requirements.yml

  collections:
    - name: lix_fortinet.fortios
      version: 102.2.120

Description

This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify dnsfilter 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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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 DNS domain filter profile.
    fortios_dnsfilter_profile:
      vdom:  "{{ vdom }}"
      state: "present"
      access_token: "<your_own_value>"
      dnsfilter_profile:
        block_action: "block"
        block_botnet: "disable"
        comment: "Comment."
        dns_translation:
         -
            addr_type: "ipv4"
            dst: "<your_own_value>"
            dst6: "<your_own_value>"
            id:  "10"
            netmask: "<your_own_value>"
            prefix: "128"
            src: "<your_own_value>"
            src6: "<your_own_value>"
            status: "enable"
        domain_filter:
            domain_filter_table: "0"
        external_ip_blocklist:
         -
            name: "default_name_19 (source system.external-resource.name)"
        ftgd_dns:
            filters:
             -
                action: "block"
                category: "0"
                id:  "24"
                log: "enable"
            options: "error-allow"
        log_all_domain: "enable"
        name: "default_name_28"
        redirect_portal: "<your_own_value>"
        redirect_portal6: "<your_own_value>"
        safe_search: "disable"
        sdns_domain_log: "enable"
        sdns_ftgd_err_log: "enable"
        youtube_restrict: "strict"

Inputs

    
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.
    type: str

state:
    choices:
    - present
    - absent
    description:
    - Indicates whether to create or remove the object.
    required: true
    type: str

enable_log:
    default: false
    description:
    - Enable/Disable logging for task.
    required: false
    type: bool

member_path:
    description:
    - 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.
    type: str

access_token:
    description:
    - Token-based authentication. Generated from GUI of Fortigate.
    required: false
    type: str

member_state:
    choices:
    - present
    - absent
    description:
    - Add or delete a member under specified attribute path.
    - When member_state is specified, the state option is ignored.
    type: str

dnsfilter_profile:
    default: null
    description:
    - Configure DNS domain filter profile.
    suboptions:
      block_action:
        choices:
        - block
        - redirect
        - block-sevrfail
        description:
        - Action to take for blocked domains.
        type: str
      block_botnet:
        choices:
        - disable
        - enable
        description:
        - Enable/disable blocking botnet C&C DNS lookups.
        type: str
      comment:
        description:
        - Comment.
        type: str
      dns_translation:
        description:
        - DNS translation settings.
        elements: dict
        suboptions:
          addr_type:
            choices:
            - ipv4
            - ipv6
            description:
            - DNS translation type (IPv4 or IPv6).
            type: str
          dst:
            description:
            - IPv4 address or subnet on the external network to substitute for the resolved
              address in DNS query replies. Can be single IP address or subnet on the
              external network, but number of addresses must equal number of mapped IP
              addresses in src.
            type: str
          dst6:
            description:
            - IPv6 address or subnet on the external network to substitute for the resolved
              address in DNS query replies. Can be single IP address or subnet on the
              external network, but number of addresses must equal number of mapped IP
              addresses in src6.
            type: str
          id:
            description:
            - ID.
            type: int
          netmask:
            description:
            - If src and dst are subnets rather than single IP addresses, enter the netmask
              for both src and dst.
            type: str
          prefix:
            description:
            - If src6 and dst6 are subnets rather than single IP addresses, enter the
              prefix for both src6 and dst6 (1 - 128).
            type: int
          src:
            description:
            - IPv4 address or subnet on the internal network to compare with the resolved
              address in DNS query replies. If the resolved address matches, the resolved
              address is substituted with dst.
            type: str
          src6:
            description:
            - IPv6 address or subnet on the internal network to compare with the resolved
              address in DNS query replies. If the resolved address matches, the resolved
              address is substituted with dst6.
            type: str
          status:
            choices:
            - enable
            - disable
            description:
            - Enable/disable this DNS translation entry.
            type: str
        type: list
      domain_filter:
        description:
        - Domain filter settings.
        suboptions:
          domain_filter_table:
            description:
            - DNS domain filter table ID. Source dnsfilter.domain-filter.id.
            type: int
        type: dict
      external_ip_blocklist:
        description:
        - One or more external IP block lists.
        elements: dict
        suboptions:
          name:
            description:
            - External domain block list name. Source system.external-resource.name.
            type: str
        type: list
      ftgd_dns:
        description:
        - FortiGuard DNS Filter settings.
        suboptions:
          filters:
            description:
            - FortiGuard DNS domain filters.
            elements: dict
            suboptions:
              action:
                choices:
                - block
                - monitor
                description:
                - Action to take for DNS requests matching the category.
                type: str
              category:
                description:
                - Category number.
                type: int
              id:
                description:
                - ID number.
                type: int
              log:
                choices:
                - enable
                - disable
                description:
                - Enable/disable DNS filter logging for this DNS profile.
                type: str
            type: list
          options:
            choices:
            - error-allow
            - ftgd-disable
            description:
            - FortiGuard DNS filter options.
            elements: str
            type: list
        type: dict
      log_all_domain:
        choices:
        - enable
        - disable
        description:
        - Enable/disable logging of all domains visited (detailed DNS logging).
        type: str
      name:
        description:
        - Profile name.
        required: true
        type: str
      redirect_portal:
        description:
        - IPv4 address of the SDNS redirect portal.
        type: str
      redirect_portal6:
        description:
        - IPv6 address of the SDNS redirect portal.
        type: str
      safe_search:
        choices:
        - disable
        - enable
        description:
        - Enable/disable Google, Bing, YouTube, Qwant, DuckDuckGo safe search.
        type: str
      sdns_domain_log:
        choices:
        - enable
        - disable
        description:
        - Enable/disable domain filtering and botnet domain logging.
        type: str
      sdns_ftgd_err_log:
        choices:
        - enable
        - disable
        description:
        - Enable/disable FortiGuard SDNS rating error logging.
        type: str
      youtube_restrict:
        choices:
        - strict
        - moderate
        description:
        - Set safe search for YouTube restriction level.
        type: str
    type: dict

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