2

I am using virtual_alias_maps to forward mail to remote mail servers (GMail, icloud). I have spam prevention in place myself (SPF checks, Before-Queue Content Filter etc), but often enough spam will be accepted by Postfix, gets enqueued and then the upstream mail server might reject it, which then causes Postfix to send a bounce message. I would rather reject the mail in the first place, similar to when the Before-Queue Content Filter detects that it is spam.

In https://stackoverflow.com/a/30175673/15690 it was suggested to use discard for the bounce service (possibly narrowing it down with header_checks), but this would still discard the bounce (i.e. silently dropping mail), instead of rejecting it in the first place. Also it is not clear to me how this could be applied to only certain cases, e.g. when virtual_alias_maps was used in general and/or for specific return codes (to not discard legitimate bounces, e.g. if the account is closed etc).

Is it possible for Postfix to not enqueue mails that will be forwarded via virtual_alias_maps (or some domains from there), but act as a proxy instead (i.e. similar to smtpd_proxy_filter but to a remote server).

This is for a small mail server, so it is OK to block one receiving smtpd server for this. It would be good if those messages were never queued locally in any way.

The log looks like this:

postfix/smtpd[5364]: connect from source.com[X.X.X.X]
…
postfix/smtpd[5364]: NOQUEUE: client=source.com[X.X.X.X]
postfix/smtpd[5372]: connect from amavis[internal24]
postfix/smtpd[5372]: D6749620E2: client=amavis[internal24], orig_client=source.com[X.X.X.X]
postfix/cleanup[5373]: D6749620E2: message-id=<o73vp3cKZBsxE85eDO@rbh.source.com>
postfix/qmgr[12066]: D6749620E2: from=<sender@source.com>, size=5076, nrcpt=1 (queue active)
postfix/smtpd[5372]: disconnect from amavis[internal24]
postfix/smtpd[5364]: proxy-accept: END-OF-MESSAGE: 250 2.0.0 from MTA(smtp:[internal25]:10025): 250 2.0.0 Ok: queued as D6749620E2; from=<sender@source.com> to=<recipient@postfix> proto=ESMTP helo=<source.com>
postfix/smtpd[5364]: disconnect from source.com[X.X.X.X]
postfix/smtp[5374]: D6749620E2: to=<forwarded@me.com>, orig_to=<recipient@postfix>, relay=mx4.mail.icloud.com[17.178.97.73]:25, delay=3.1, delays=0.07/0.01/1.7/1.3, dsn=5.7.1, status=bounced (host mx4.mail.icloud.com[17.178.97.73] said: 550 5.7.1 [CS01] Message rejected due to local policy. Please visit https://support.apple.com/en-us/HT204137 (in reply to end of DATA command))
postfix/cleanup[5373]: 198966214E: message-id=<20181003055857.198966214E@host.postfix>
postfix/qmgr[12066]: 198966214E: from=<>, size=7279, nrcpt=1 (queue active)
postfix/bounce[5375]: D6749620E2: sender non-delivery notification: 198966214E
postfix/cleanup[5373]: 2E1286214F: message-id=<20181003055857.2E1286214F@host.postfix>
postfix/qmgr[12066]: 2E1286214F: from=<double-bounce@host.postfix>, size=4880, nrcpt=1 (queue active)
postfix/bounce[5375]: D6749620E2: postmaster non-delivery notification: 2E1286214F
postfix/qmgr[12066]: D6749620E2: removed
postfix/smtp[5374]: 198966214E: to=<sender@source.com>, relay=source.com[185.207.8.246]:25, delay=0.14, delays=0.08/0/0.05/0, dsn=4.0.0, status=deferred (host source.com[185.207.8.246] refused to talk to me: 421 Too many concurrent SMTP connections; please try again later.)
blueyed
  • 723
  • 8
  • 13

0 Answers0