How can I configure Warden to not forward mail classified as spam in order to protect the mail servers reputation?

If you want to configure Warden to reject and not forward mail classified as spam or spammy you can use the instructions below.

1. Enable the header checks file in the postfix config:

postconf -e "header_checks = regexp:/etc/postfix/header_checks"

2. Run the command below to add the entry to header_checks. This entry will tell postfix to check if the mail was previously flagged as spam and if so add an additional X-Already-Spam header:

echo '/^X-Spam-Flag:\s+YES/ PREPEND X-Already-Spam: YES' >> /etc/postfix/header_checks

3. Reload postfix:

postfix reload

4. Reset the server wide policy to enable the spam kill level if it is not already enabled:

/usr/local/psa/admin/sbin/modules/warden/minion --task=contentfilter:policy --default=yes

5. Add a header rule to check if the message was already classified as spam:

/usr/local/psa/admin/sbin/modules/warden/minion --task=antispam:rules --oper=rule_add --name='__IS_ALREADY_SPAM' --description='Mail is already classified as spam' --type=header --value='X-Already-Spam =~ /YES/i'

6. Add a header rule to check if the message is a redirect (Plesk applies Sender Rewriting Scheme (SRS) to redirects):

/usr/local/psa/admin/sbin/modules/warden/minion --task=antispam:rules --oper=rule_add --name='__IS_REDIRECT' --description='Mail is a redirect' --type=header --value='Return-Path =~ /^<SRS0=/i'

7. Add a meta rule to check if both rules from above match then apply a higher score so that the message is rejected:

/usr/local/psa/admin/sbin/modules/warden/minion --task=antispam:rules --oper=rule_add --name='REDIRECT_SPAM' --description='Mail is redirect spam' --type=meta --value='(__IS_REDIRECT && __IS_ALREADY_SPAM)' --score=20

8. Enable the shortcircuit plugin:

/usr/local/psa/admin/sbin/modules/warden/minion --task=antispam:plugins --Shortcircuit=1

9. Shortcircuit the REDIRECT_SPAM rule we added so that we do not process any other rules once it is matched. This will save on CPU usage and should disable autolearning for the redirects.:

/usr/local/psa/admin/sbin/modules/warden/minion --task=antispam:plugin:shortcircuit --shortcircuit='REDIRECT_SPAM spam' --reload=yes

Now any incoming mail that is classified as spam or spammy will trigger the REDIRECT_SPAM rule and for their forwards so they will be rejected and not leave the server.

Reject spam redirects

  • redirect, reputation, forward
  • 0 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

How can I change the interface language of the extension?

You can change the interface language under Settings -> Application Settings -> Locale...

How can I disable admin email notifications in Amavis?

Amavis has different default options for controlling where virus, spam, banned file attachments,...

How can I whitelist or blacklist a mail server from greylisting?

To Whitelist a Mail Server From Greylisting Navigate to Warden -> Settings ->...

How can I enable third party anti-virus signatures within Warden to improve the ClamAV detection rate?

Warden supports enabling third party anti-virus signatures to improve the detection rate. These...

How can I setup a local caching DNS resolver to speed up DNS queries used by Amavis?

Run the following command to check if local DNS caching is enabled: host -tTXT...