Using postfix 2.9 on debian I have configured before-queue proxy filter for scanning of spam and viruses
smtpd_proxy_filter=127.0.0.1:27. I am using proxy filter and not content filter, so that I can directly reject the email (with after-queue content filter, I can only discard the email and optionally send backscatter to forged sender address).
I also want to use policy service to limit the number of sent emails per SASL username. This is configured in
smtpd_recipient_restrictions just before
permit_sasl_authenticated. The policy daemon works OK, but postfix complains that it cannot HOLD the email with this message:
warning: access table inet:127.0.0.1:10031: with smtpd_proxy_filter specified, action HOLD is unavailable
As per this thread, this is not directly possible:
To HOLD mail with smtpd_proxy_filter, specify the HOLD action with the smtpd proces AFTER the filter.
I have tried that, however when I put the policy service on the smtpd daemon after the proxy filter (smtpd on port 26 in my case), it doesn't get any SASL information (confirmed with tcpdump).
smtpd :25 ---> before-queue proxy localhost:27 ---> smtpd localhost:26
So how can I combine these two checks?
EDIT: Maybe nested before-queue filters would work? Then I would need to use different program for the SASL checks, or make some filter/policy protocol rewriting...