The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::MtPolicyd::Plugin::SaAwlAction - mtpolicyd plugin for checking spamassassin AWL reputation

VERSION

version 2.05

DESCRIPTION

This plugin will execute an action or score based on a previous lookup done with SaAwlLookup plugin.

PARAMETERS

result_from (required)

Take the AWL information from the result of this plugin.

The plugin in must be executed before this plugin.

(uc_)enabled (default: on)

Enable/disable this plugin.

(uc_)mode (default: reject)

If set to 'passive' no action will be returned.

reject_message (default: 'sender address/ip has bad reputation')

Could be used to specify an custom reject message.

score (default: empty)

A score to apply to the message.

score_factor (default: empty)

A factor to apply the SA score to the message.

Do not configure a score if you want to use the factor.

min_count (default: 10)

The minimum count of mails/scores spamassassin must have done on this sender/ip before the AWL entry is used.

If the count in AWLs auto-whitelist table is below this count the test will be skipped.

threshold (default: 5)

At this threshold the action or score will be applied.

match (default: gt)

The default is to match values greater("gt") than the threshold.

When configured with 'lt' AWL scores less than the threshold will be matched.

EXAMPLE

Check that AWL is active in your SA/amavis configuration:

loadplugin Mail::SpamAssassin::Plugin::AWL
use_auto_whitelist 1

Make sure that mtpolicyd has permissions to read the auto-whitelist db:

$ usermod -G amavis mtpolicyd
$ chmod g+rx /var/lib/amavis/.spamassassin
$ chmod g+r /var/lib/amavis/.spamassassin/auto-whitelist

Make sure it stays like this when its recreated in your SA local.cf:

auto_whitelist_file_mode 0770

Net::Server does not automatically set supplementary groups. You have to do that in mtpolicyd.conf:

group="mtpolicyd amavis"

Permissions may be different on your system.

To check that mtpolicyd can access the file try:

$ sudo -u mtpolicyd -- head -n0 /var/lib/amavis/.spamassassin/auto-whitelist

Now use it in mtpolicyd.conf:

<Plugin amavis-reputation>
  module = "SaAwlLookup"
  db_file = "/var/lib/amavis/.spamassassin/auto-whitelist"
</Plugin>

For whitelisting you may configure it like:

<Plugin awl-whitelist>
  module = "SaAwlAction"
  result_from = "amavis-reputation"
  mode = "accept"
  match = "lt"
  threshold = "0"
</Plugin>

Or apply a score based for bad AWL reputation (score > 5):

<Plugin awl-score-bad>
  module = "SaAwlAction"
  result_from = "amavis-reputation"
  mode = "passive"
  match = "gt"
  threshold = 6
  score = 5
</Plugin>

Or apply the score value from AWL with an factor:

<Plugin awl-score-bad>
  module = "SaAwlAction"
  result_from = "amavis-reputation"
  mode = "passive"
  match = "gt"
  threshold = 5
  score_factor = 0.5
</Plugin>

If the score in AWL is >5 it will apply the score with an factor of 0.5. When the score in AWL is 8 it will apply a score of 4.

Or just reject all mail with a bad reputation:

<Plugin awl-reject>
  module = "SaAwlAction"
  result_from = "amavis-reputation"
  mode = "reject"
  match = "gt"
  threshold = 5
  reject_message = "bye bye..."
</Plugin>

Troubleshooting

Check content of spamassassin AWL auto-whitelist

To check the content of the auto-whitelist database use the sa-awl command:

$ sa-awl /var/lib/amavis/.spamassassin/auto-whitelist | grep <user>

SEE ALSO

Spamassassin AutoWhitelist manual

http://wiki.apache.org/spamassassin/AutoWhitelist

Spamassassin AWL plugin reference

http://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Plugin_AWL.html

AUTHOR

Markus Benning <ich@markusbenning.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.

This is free software, licensed under:

The GNU General Public License, Version 2, June 1991