On Mon, Jan 30, 2023 at 08:49:02AM -0800, David Koski wrote:

> The email stays stuck in the queue.  I am using a pipe that should
> respond to port 10025.  It does respond to telnet:

It responds *incorrectly* on port 10025.

> Telnet response from 10025:
> 
> $ telnet 127.0.0.1 10025
> Trying 127.0.0.1...
> Connected to 127.0.0.1.
> Escape character is '^]'.
> status0

The "status0" response is not correct.  It must respond with the
verbatim banner seen on port 10026.

>    1 copy.sh
>    2 =======
>    3 #!/bin/bash
>    4 socat STDIO TCP4:127.0.0.1:10026
>    5
>    6 main.cf
>    7 =======
>    8 content_filter=myfilter:[127.0.0.1]:10025
>    9 myfilter_recipient_limit=1

This would not generally be a good idea if the filter worked.
A message with 1000 recipients would be scanned 1000 times.

>   20 localhost:10025 inet n  n       n       -       -       pipe
>   21     flags=Rq user=myfilter argv=/var/lib/myfilter/copy.sh -e -k 
> [email protected] [email protected]

There's your mistake, you can't use pipe(8) this way.  It is a delivery
agent that uses an internal protocol with the Postfix qmgr(8) process,
it is not a process launcher.

You can add instances of the spawn(8) service in master.cf to fork/exec
per-connection programs, it is only suitable in low-throughput
environments.  This is the analogue of pipe(8) you were looking for.

Generally, your filter should be a standalone network listener, launched
separately from and prior to Postfix (and shut down after).  It should
ideally not fork/exec per message, though at sufficiently low message
rates this may not matter.

-- 
    Viktor.

Reply via email to