Skip to main content
WisMail

Configure anti-spam and anti-virus

WisMail filters incoming mail with SpamAssassin (content scoring and a self-learning Bayes filter), greylisting, DNS blacklists, SPF checks, a ClamAV virus scanner and an attachment filter. All of it is configured in web administration under Configuration, Content Filter. This guide goes through each layer in the order we recommend turning them on. For the overview see Anti-spam and anti-virus. The Troubleshooting section at the end covers the usual tuning problems.

Before you start, make sure DNS is right and the server has been running real mail for a day, so there is something to measure.

Step 1. Turn on spam rating and set the scores

Web administration Content Filter, Spam Filter: tag score, block score, Bayes and blacklists
  1. Open Configuration, Content Filter, Spam Filter and the Spam Rating tab.
  2. Tick Enable spam rating.
  3. Set the two scores. A higher score means a higher probability of spam:
    • Tag score: at or above it the message is marked as spam. Choose what happens: add text to the start of the Subject (for example [SPAM]) so users can filter it, or forward the message to a quarantine address.
    • Block score: at or above it the message is blocked. You can send a bounce message to the sender, though this can produce many replies to forged addresses, so leave it off unless you need it. Setting the block score to 10 turns blocking off.
  4. Click Apply.

Start conservative: tag first, block only the very high scores. Watch the results for a week before lowering the block score.

Step 2. SpamAssassin and Bayes learning

Open the anti-spam engine tab of the same screen. Apache SpamAssassin adds a score for every rule a message triggers (suspicious headers, content, links). Tick Use spam learning Bayesian filter so the server learns what spam and legitimate mail look like in your own traffic. The filter status shows Disabled, Learning or Active, together with the number of messages learned as spam and as not spam. Bayes becomes useful only after it has seen enough of your mail, so expect better results after a few days of traffic. You can also tick the check against the SURBL list of spam links.

Step 3. Greylisting

On the Greylisting tab, tick Check incoming messages by the Greylisting service. Greylisting temporarily rejects mail from an unknown sender or IP address; real mail servers retry a few minutes later and are accepted, while most bulk spam tools never retry. The cost is that the first message from a new sender can arrive minutes late. Add trusted networks to Do not apply greylisting on connections from. Use Test Connection to confirm the greylisting service answers; it runs locally on the server.

Step 4. DNS blacklists and SPF

  • Blacklists tab: Internet blacklists (DNSBL) looks up the sending IP address in public blacklists. Add the lists you trust, each with its DNS suffix; the server checks the sending IP address against them.
  • SPF tab: Enable SPF check of every incoming message compares the sender's SPF record with the IP address that delivered the mail, and adds score or blocks messages that fail.
  • Under Configuration, Security, Sender Policy you find sender anti-spoofing protection and DKIM validation settings. Details on the records you publish yourself: DNS setup.

Step 5. Whitelist and blacklist your own IP addresses

On the Blacklists tab, a Custom whitelist (never checked) and a Custom blacklist of spammer IP addresses use IP address groups that you define under Configuration, Definitions, IP Address Groups. Do not use the same group in both lists. Addresses reserved for private networks are always in the whitelist. Use this for your own offices and for a partner server that keeps getting caught.

Step 6. Virus scanning with ClamAV

Web administration Content Filter, Antivirus: integrated ClamAV engine, update status and actions
  1. Open Configuration, Content Filter, Antivirus.
  2. Tick Use the integrated antivirus engine. It is ClamAV and the page shows the virus database version, the scanning engine version and the last update check.
  3. Keep Check for updates on, or run Update the integrated antivirus now.
  4. Choose the action If a virus is found in a message: Discard the message, Deliver the message with the malicious code removed, or Deliver the original message with a warning prefixed. Choose also what to do If a part of a message cannot be scanned.
  5. Click Apply.

Virus signature updates and anti-spam scoring need an active subscription: when the subscription expires they switch off (see license activation).

Step 7. Attachment filter

Open Attachment Filter, tick Enable attachment filter, and add Filter rules: choose File name (a file name pattern such as one for executable files) or MIME type and Block the attachment or Accept the attachment. Tick Send the sender a warning so people know a file was not delivered, and Discard zip archive containing files with dangerous extensions to catch executables hidden in archives.

Step 8. Global message rules

For organisation-wide policy beyond filters (for example discard or add a header to messages that match a condition), use Configuration, Message Filters. See administration.

Check that it works

Send yourself a message from an outside account and open its headers: the X-Spam-Status header shows the score and which tests matched. To check the antivirus path, send the standard harmless EICAR test file as an attachment: it must be handled by the action you chose in step 6. Read the Spam and Security logs under Logs.

Troubleshooting

Too much spam gets through. Lower the tag score a little, make sure Bayes is Active, turn on greylisting and add DNSBL entries. Keep tagging before blocking.

Good mail is tagged or blocked. Raise the scores or add the sender's IP address to the custom whitelist. Check the headers to see which test scored it.

Antivirus shows it cannot update. The server must reach the update source over outbound HTTPS, and the subscription must be active.

A new sender's first message is late. That is greylisting; it is delivered after the sender retries.

Next steps