On 4/16/2019 3:56 PM, MK wrote:
My current setup is this:
* Mail is received by postscreen (which filters RBLs and basic
checks)
* Passed to smtpd
* applies content_filter which passes the mail to amavis-new port
10024
* Amavis-new passes the mail back on 10025
* LOCAL mail is sent to the virtual_transport (dovecot LMTP) via
socket
* dovecot LMTP uses sieve to sort the mail into a Junk folder
if "X-Spam-Status: yes", among other sorting which can include other
thresholds
* ALIAS (possibly remote forwarded) mail is sent out to the
Internet (remote: gmail, yahoo, hotmail, etc) or reinserted to the
queue (for local domains).
postscreen is doing RBL checks which cuts down on most of the spam
significantly.
No I don't want to have amavis-new reject all mail it suspects is
Spam. Obvious spam was rejected by postscreen.
There are some policy reasons for this. Some folks have different
thresholds based on their dovecot preferences.
For local delivery, I have no issues. Mail is sorted out of sight
and cleaned up after a period of time.
For ALIAS mapped delivery, I want to discard the messages which have
a header "X-Spam-Status: yes" silently (or maybe redirect them to a
local user where they could be deleted after the fact).
I've explored "smtp_header_checks = regexp:...", however this does
not allow DISCARD at all (recommending this to be a good addition
I've explored "header_checks = regexp:...", however this will
discard local mail going to the LDA and not just that going to the
outside world
I'd be open to having them delivered to a local mailbox as well for
later releasing or purging.
As I'm certain this isn't an uncommon problem (I see much discussion
about it on the Internet but no true answers to how to solve or
achieve the same result), can anyone provide some guidance on how to
implement this? Effectively "don't alias mail if it has a header,
but do allow the header for local delivery".
Is there a way for me to create this as a header_check in a cleanup
for the post-filter content which only runs if it's an aliased delivery?
Is there a way to integrate some sort of test whether I want to
evaluate the alias in this workflow?
As the alias table comes by way of SQL, I could also provide an
extra field that way if the goto isn't local, if that helps at all.
I could also hard-code a hash table of all such forwards if it helps
in some way.
Any help is appreciated.
So basically you want to selectively discard mail during external
delivery.
Postfix can't do that by itself. When postfix is delivering mail,
it's too late to discard it.
You could do this with multiple postfix instances. You'll probably
need three postfix instances; one for incoming mail, one for local
delivery, and one for outgoing mail. The outgoing mail instance can
then decide what to discard as it enters.
http://www.postfix.org/MULTI_INSTANCE_README.html
-- Noel Jones