fortios_spamfilter_profile – Configure AntiSpam profiles in Fortinet’s FortiOS and FortiGate

New in version 2.8.

Synopsis

  • This module is able to configure a FortiGate or FortiOS by allowing the user to set and modify spamfilter feature and profile category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.2

Requirements

The below requirements are needed on the host that executes this module.

  • fortiosapi>=0.9.8

Parameters

Parameter Choices/Defaults Comments
host
- / required
FortiOS or FortiGate ip address.
https
boolean
    Choices:
  • no
  • yes ←
Indicates if the requests towards FortiGate must use HTTPS protocol
password
-
Default:
""
FortiOS or FortiGate password.
spamfilter_profile
-
Default:
null
Configure AntiSpam profiles.
comment
-
Comment.
external
-
    Choices:
  • enable
  • disable
Enable/disable external Email inspection.
flow-based
-
    Choices:
  • enable
  • disable
Enable/disable flow-based spam filtering.
gmail
-
Gmail.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
imap
-
IMAP.
action
-
    Choices:
  • pass
  • tag
Action for spam email.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
tag-msg
-
Subject text or header added to spam email.
tag-type
-
    Choices:
  • subject
  • header
  • spaminfo
Tag subject or header for spam email.
mapi
-
MAPI.
action
-
    Choices:
  • pass
  • discard
Action for spam email.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
msn-hotmail
-
MSN Hotmail.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
name
- / required
Profile name.
options
-
    Choices:
  • bannedword
  • spambwl
  • spamfsip
  • spamfssubmit
  • spamfschksum
  • spamfsurl
  • spamhelodns
  • spamraddrdns
  • spamrbl
  • spamhdrcheck
  • spamfsphish
Options.
pop3
-
POP3.
action
-
    Choices:
  • pass
  • tag
Action for spam email.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
tag-msg
-
Subject text or header added to spam email.
tag-type
-
    Choices:
  • subject
  • header
  • spaminfo
Tag subject or header for spam email.
replacemsg-group
-
Replacement message group. Source system.replacemsg-group.name.
smtp
-
SMTP.
action
-
    Choices:
  • pass
  • tag
  • discard
Action for spam email.
hdrip
-
    Choices:
  • disable
  • enable
Enable/disable SMTP email header IP checks for spamfsip, spamrbl and spambwl filters.
local-override
-
    Choices:
  • disable
  • enable
Enable/disable local filter to override SMTP remote check result.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
tag-msg
-
Subject text or header added to spam email.
tag-type
-
    Choices:
  • subject
  • header
  • spaminfo
Tag subject or header for spam email.
spam-bwl-table
-
Anti-spam black/white list table ID. Source spamfilter.bwl.id.
spam-bword-table
-
Anti-spam banned word table ID. Source spamfilter.bword.id.
spam-bword-threshold
-
Spam banned word threshold.
spam-filtering
-
    Choices:
  • enable
  • disable
Enable/disable spam filtering.
spam-iptrust-table
-
Anti-spam IP trust table ID. Source spamfilter.iptrust.id.
spam-log
-
    Choices:
  • disable
  • enable
Enable/disable spam logging for email filtering.
spam-log-fortiguard-response
-
    Choices:
  • disable
  • enable
Enable/disable logging FortiGuard spam response.
spam-mheader-table
-
Anti-spam MIME header table ID. Source spamfilter.mheader.id.
spam-rbl-table
-
Anti-spam DNSBL table ID. Source spamfilter.dnsbl.id.
state
-
    Choices:
  • present
  • absent
Indicates whether to create or remove the object
yahoo-mail
-
Yahoo! Mail.
log
-
    Choices:
  • enable
  • disable
Enable/disable logging.
username
- / required
FortiOS or FortiGate username.
vdom
-
Default:
"root"
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.

Notes

Note

  • Requires fortiosapi library developed by Fortinet

  • Run as a local_action in your playbook

Examples

- hosts: localhost
  vars:
   host: "192.168.122.40"
   username: "admin"
   password: ""
   vdom: "root"
  tasks:
  - name: Configure AntiSpam profiles.
    fortios_spamfilter_profile:
      host:  "{{ host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      vdom:  "{{ vdom }}"
      https: "False"
      spamfilter_profile:
        state: "present"
        comment: "Comment."
        external: "enable"
        flow-based: "enable"
        gmail:
            log: "enable"
        imap:
            action: "pass"
            log: "enable"
            tag-msg: "<your_own_value>"
            tag-type: "subject"
        mapi:
            action: "pass"
            log: "enable"
        msn-hotmail:
            log: "enable"
        name: "default_name_18"
        options: "bannedword"
        pop3:
            action: "pass"
            log: "enable"
            tag-msg: "<your_own_value>"
            tag-type: "subject"
        replacemsg-group: "<your_own_value> (source system.replacemsg-group.name)"
        smtp:
            action: "pass"
            hdrip: "disable"
            local-override: "disable"
            log: "enable"
            tag-msg: "<your_own_value>"
            tag-type: "subject"
        spam-bwl-table: "33 (source spamfilter.bwl.id)"
        spam-bword-table: "34 (source spamfilter.bword.id)"
        spam-bword-threshold: "35"
        spam-filtering: "enable"
        spam-iptrust-table: "37 (source spamfilter.iptrust.id)"
        spam-log: "disable"
        spam-log-fortiguard-response: "disable"
        spam-mheader-table: "40 (source spamfilter.mheader.id)"
        spam-rbl-table: "41 (source spamfilter.dnsbl.id)"
        yahoo-mail:
            log: "enable"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
build
string
always
Build number of the fortigate image

Sample:
1547
http_method
string
always
Last method used to provision the content into FortiGate

Sample:
PUT
http_status
string
always
Last result given by FortiGate on last operation applied

Sample:
200
mkey
string
success
Master key (id) used in the last call to FortiGate

Sample:
id
name
string
always
Name of the table used to fulfill the request

Sample:
urlfilter
path
string
always
Path of the table used to fulfill the request

Sample:
webfilter
revision
string
always
Internal revision number

Sample:
17.0.2.10658
serial
string
always
Serial number of the unit

Sample:
FGVMEVYYQT3AB5352
status
string
always
Indication of the operation's result

Sample:
success
vdom
string
always
Virtual domain used

Sample:
root
version
string
always
Version of the FortiGate

Sample:
v5.6.3


Status

Authors

  • Miguel Angel Munoz (@mamunozgonzalez)

  • Nicolas Thomas (@thomnico)

Hint

If you notice any issues in this documentation you can edit this document to improve it.