Amavis :: Custom - Color Yourself
It all started with the fact that it took me to skip all the checks in amavisd. This is easy to do with a known sender or receiver, or by port-based bank separation. The task becomes less trivial if the signal is any header already accepted for checking the electronic message. This is where (and in a host of other cases) Amavis :: Custom comes into play
Judging by the documentation from the example file, custom clothespins (?) Are available from version amavisd-new-2.5.0 and allow implementation at the following steps:
Message Processing Sequence
# received a letter, disassembled, collected basic information
# * custom hook: new () - you can view the initial data, load banks, set some parameters
# message check, assign ratings
# custom hook: checks () - called after spam checks and viruses, but until the decision on the fate of the letter. Here you can play with ratings
# decision about the fate of the letter (searches in * _lovers, thresholds, ...)
# quarantine
# sending notifications (to administrators, recipients)
# * custom hook: before_send () - you can send your own notifications, organize quarantine, modify the message modify mail
# forwarding (if not blocked)
# * custom hook: after_send () - you can suppress DSN, send reports
# sending DSN (when necessary)
# logging, statistics
# * custom hook: mail_done () - may inspect results (did not catch the point)
The complete example provides a significant piece of code to expand consciousness. The author, on the other hand, was completely silent. As a result of some thought, the following letters fell into amavisd-custom.conf:
# try to skip checks if already marked as spam
package Amavis :: Custom;
use strict;
sub new {
my ($ class, $ conn, $ msginfo) = @_;
my ($ self) = bless {}, $ class;
for my $ curr_head (@ {$ msginfo-> orig_header}) {
if ($ curr_head = ~ / ^ X-SpamTest-Status: spam / i) {
for my $ r (@ {$ msginfo-> per_recip_data}) {
$ r-> bypass_spam_checks (1);
$ r-> bypass_banned_checks (1);
}
}
}
$ self;
}