Mail::...Action(3pm)

๐Ÿ’– Mail::MtPolicyd::Plugin::SaAwlAction ๐Ÿ’–

okay bestie, so this page is Mail::MtPolicyd::Plugin::SaAwlAction(3pm) from the User Contributed Perl Documentation, and it's literally the glow-up you need for your mail server's reputation era. it's giving "mtpolicyd plugin for checking spamassassin AWL reputation" and honestly? we're obsessed. ๐ŸŽ€


โœจ VERSION โœจ

version 2.05 โ€” yeah she's v2.05 and she's thriving ๐Ÿ’…


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so basically this plugin will execute an action or score based on a previous lookup done with SaAwlLookup plugin. that's the whole vibe. the SaAwlLookup does the detective work, and SaAwlAction shows up to do something about it. main character energy fr fr. ๐Ÿ‘‘


๐Ÿฆ‹ PARAMETERS ๐Ÿฆ‹

every single knob you can turn, no gatekeeping:

  • result_from (required) โ€” Take the AWL information from the result of this plugin.

The plugin in must be executed before this plugin. (yes that's exactly how it's written in the original and yes it's a little cursed, but it's our little cursed ๐Ÿฅฐ)

  • (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. (pick a lane, bestie, the plugin is NOT gonna do both ๐Ÿ˜ญ)

  • 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. (every system is a little unique, no cap ๐Ÿ’…)

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. (math ate, honestly ๐Ÿงฎโœจ)

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>

bye bye... iconic behavior, honestly. ๐Ÿ’€


๐Ÿงš 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 ๐Ÿ‘‘


๐Ÿซถ AUTHOR ๐Ÿซถ

Markus Benning <ich@markusbenning.de> โ€” shoutout to the legend who wrote this ๐Ÿ’œ


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

and that's the whole page, bestie!! this was Mail::...Action(3pm) from perl v5.38.2, dated 2024-05-26, and you absolutely slayed reading all of it. go configure something. periodt. ๐Ÿ’…โœจ๐ŸŒธ

๐Ÿ“ฆ where this page comes from