I'm interested in implementing the advanced content filter example for postfix.

socat tcp-listen:10026,reuseaddr,fork tcp:localhost:10025

This is a simple "passthru" that works, but obviously doesn't do any filtering or responding.

My goal is to have this socat command work exactly as it does (two-way forwarding between the two connections), but also one-way forward its input to a PHP script.

How would I do that?

Possible duplicate question (unanswered as of today)

For more background... I would like to avoid the limitations of the "simple" content filter via pipe but I don't want to implement a full SMTP client and server to handle the postfix <--> filter <--> postfix transaction.

I do not need to filter the mail, but I do need to track it. My thought is that I could forward the network traffic per usual, but have a PHP script that tracks the data passing over the wire.

  • 1
    another way might be to use a milter in postfix – thrig Feb 12 '18 at 3:05

You could simply add -v to socat and it will copy all i/o to stderr, prefixed by > or < to indicate the direction.

| improve this answer | |
  • I ended up using xinetd and PHP sockets, but this was very helpful in helping me move toward that solution. Thank you! – jchook Feb 15 '18 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.