]> git.proxmox.com Git - pmg-api.git/commit
add support for before queue filtering
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 14 Nov 2019 16:35:07 +0000 (17:35 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 15 Nov 2019 07:58:26 +0000 (08:58 +0100)
commite0cbdf9fc98178f97223922f305cc19d6d29262d
tree81de6633fc092d4c00ffa0f9b2368b66de76634f
parent88a5150331354c0b80cd6340a83c40a26aff4226
add support for before queue filtering

Support for rejecting mails during the SMTP-dialog with 550 (permanent failure)
instead of seemingly accepting the mail (250 OK) and dropping it if it is
rejected by the rule-system is also known as 'before queue filtering' [0].

This patch adds minimal support for before queue filtering to pmg-smtp-filter.

Since pmg-smtp-filter is currently called via LMTP (and the 'scan' service in
'master.cf') we can adapt the already existing branch dealing with SMTP to
send a 550 selectively.

We can reply with 554 (permfail) if all recepients are blocked.

In the case that some accept the mail, we reply with 250 OK.
Depending on the setting of 'ndr_on_block' we generate ndrs
for all blocking recepients. (This is also the behavior that postfix
has when not enabling receiver verification and the downstream server rejects
recepients).

Configuration of before-queue filtering is done via the
'before_queue_filtering' boolean in the 'mail' section of 'pmg.conf':

the before_queue_filtering flag is used when rendering '/etc/postfix/master.cf'
to adapt the needed config-options for both, inbound and outbound, smtpd
servers. The settings were adapted from [0].

[0] http://www.postfix.org/SMTPD_PROXY_README.html

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/Config.pm
src/PMG/SMTP.pm
src/templates/master.cf.in