Anti-spam filter
This section describes how to configure FortiGate email filtering for IMAP, POP3, and SMTP email. Email filtering includes both spam filtering and filtering for any words or files you want to disallow in email messages. If your FortiGate unit supports SSL content scanning and inspection, you can also configure spam filtering for IMAPS, POP3S, and SMTPS email traffic.
The Anti-Spam security profile is only available when operating the FortiGate in proxy-based inspection.
The following topics are included in this section:
Anti-spam concepts
Anti-spam techniques
Configuring Anti-spam
Order of spam filtering
Spam actions
Anti-spam examples
Anti-spam concepts
You can configure the FortiGate unit to manage unsolicited commercial email by detecting and identifying spam messages from known or suspected spam servers.
The FortiGuard Anti-Spam service uses both a sender IP reputation database and a spam signature database, along with sophisticated spam filtering tools, to detect and block a wide range of spam messages. Using FortiGuard Anti-Spam profile settings, you can opt to filter with IP address checking, URL checking, email checksum checking, detection of phishing URLs in email, and spam submission. Updates to the IP reputation and spam signature databases are provided continuously via the global FortiGuard Distribution Network.
At the FortiGuard Anti-Spam service page on the FortiGuard Labs website, you can find out whether an IP address is blacklisted in the FortiGuard Anti-Spam IP reputation database, or whether a URL or email address is in the signature database.
Anti-spam techniques
The FortiGate unit has a number of techniques available to help detect spam. Some use the FortiGuard AntiSpam service and require a subscription. The remainder use your DNS servers or use lists that you must maintain.
Black white list
These are the types of black white lists available. They include:
- IP/Netmask
The FortiGate unit compares the IP address of the client delivering the email to the addresses in the IP address techniques
black / white list specified in the email filter profile. If a match is found, the FortiGate unit will take the action configured for the matching black / white list entry against all delivered email.
The default setting of the smtp-spamhdrip CLI command is disable. If enabled, the FortiGate unit will check all the IP addresses in the header of SMTP email against the specified IP address black / white list.
- Email Wildcard
The FortiGate unit compares the sender email address, as shown in the message header and envelope MAIL FROM, to the pattern in the patterned field. The wildcard symbol is used in the place of characters in the address that may vary from the pattern. If a match is found, the FortiGate unit will take the action configured for the matching black / white list entry. l Email Regular Expression
The FortiGate unit compares the sender email address, as shown in the message envelope MAIL FROM, to the pattern in the patterned field. The regular expression that can be used is much more sophisticated than a simple wildcard variable. If a match is found, the FortiGate unit will take the action configured for the matching black/white list entry.
Pattern
The pattern field is for entering the identifying information that will enable the filter to correctly identify the email messages.
- If the type is IP/Netmask the filter will be an IP address with a subnet mask.
- If the type is Email Wildcard the filter will be an email address with a wildcard symbol in place of the variable characters. For example *.example.com or fred@*.com.
- If the type is Email Regular Expression, regular expression can be used to create a more granular filter for email addresses. For example, ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@(example|xmple|examp).(com|org|net) could be used filter based on a number of combinations of email domain names. Action
- Tag
If this is the selected action, the email will be allowed through but it will be tagged with an indicator that clearly marks the email as spam. l Pass
If this is the selected action, the email will be allowed to go through to its destination on the assumption that the message is not spam.
- Discard
If this is the selected action, the email will be dropped at the before reaching its destination. Status
Indicates whether this particular list is enabled or disabled.
Banned word check
When you enable banned word checking, your FortiGate unit will examine the email message for words appearing in the banned word list specified in the Anti-Spam profile. If the total score of the banned word discovered in the email message exceeds the threshold value set in the Anti-Spam profile, your FortiGate unit will treat the message as spam.
When determining the banned word score total for an email message, each banned word score is added once no matter how many times the word appears in the message. Use the command config spamfilter bword to Anti-spam techniques
add an email banned word list. Use the command config spamfilter profile to add a banned word list to an Anti-Spam profile.
How content is evaluated
Every time the banned word filter detects a pattern in an email message, it adds the pattern score to the sum of scores for the message. You set this score when you create a new pattern to block content. The score can be any number from zero to 99999. Higher scores indicate more offensive content. When the total score equals or exceeds the threshold, the email message is considered as spam and treated according to the spam action configured in the email filter profile. The score for each pattern is counted only once, even if that pattern appears many times in the email message. The default score for banned word patterns is 10 and the default threshold is 10. This means that by default, an email message is blocked by a single match.
A pattern can be part of a word, a whole word, or a phrase. Multiple words entered as a pattern are treated as a phrase. The phrase must appear as entered to match. You can also use wildcards or regular expressions to have a pattern match multiple words or phrases.
For example, the FortiGate unit scans an email message that contains only this sentence: “The score for each word or phrase is counted only once, even if that word or phrase appears many times in the email message.”
Banned word pattern | Pattern type | Assigned score | Score added to the sum for the entire page | Comment |
word | Wildcard | 20 | 20 | The pattern appears twice but multiple occurrences are only counted once. |
word phrase | Wildcard | 20 | 0 | Although each word in the phrase appears in the message, the words do not appear together as they do in the pattern. There are no matches. |
word*phrase | Wildcard | 20 | 20 | The wildcard represents any number of any character. A match occurs as long as “word” appears before “phrase” regardless of what is in between them. |
mail*age | Wildcard | 20 | 20 | Since the wildcard character can represent any characters, this pattern is a match because “email message” appears in the message. |
In this example, the message is treated as spam if the banned word threshold is set to 60 or less.
Adding words to a banned word list
When you enter a word, set the Pattern-type to wildcards or regular expressions.
Wildcard uses an asterisk (“*”) to match any number of any character. For example, re* will match all words starting with “re”.
Regular expression uses Perl regular expression syntax. See http://perldoc.perl.org/perlretut.html for detailed information about using Perl regular expressions.
techniques