Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using a custom filter via script to reject inbound email

29 views
Skip to first unread message

drvp...@googlemail.com

unread,
Nov 25, 2016, 9:47:15 AM11/25/16
to
Hi -

I'm trying to find my way around postfix config & customisation and am stuck.

Is there any way in postfix to execute a script and capture the result (0 or 1), then based on that result accept or reject inbound email?

I'd already asked the question here on stack exchange which has more detail about the scenario:
https://unix.stackexchange.com/questions/325407/using-a-custom-filter-via-script-to-reject-inbound-email

I was looking at before queue filtering but can't see a way of capturing the result of a script exec.

Thanks

Rex

d.agosti...@gmail.com

unread,
Jan 21, 2017, 8:01:12 AM1/21/17
to
Hi

Yes there is a way.

A before queue filtering is when the smtp client is still connected so you could send SMTP code but if you want an external script you have to do a "Postfix After-Queue Content Filter "

You can find more information here :
http://www.postfix.org/FILTER_README.html

This is the idea :

incoming mail -> postfix:25 -> external script -> postfix:10025 -> outgoing mail

The external script do not answer 0 or 1 but a normalised exit code like theses :
EX_OK 0 /* successful termination : transmit */
EX_UNAVAILABLE 69 /* service unavailable : bounce */
EX_SOFTWARE 70 /* internal software error : bounce */
EX_TEMPFAIL 75 /* temp failure. postfix will retry. */
EX_NOPERM 77 /* permission denied : bounce */


Regards

Victor d'Agostino
0 new messages