I found the problem. The script should listen like "while read line" ... conditions.
Thank you. Marius. -----Original Message----- From: Marius Gologan [mailto:marius.golo...@gmail.com] Sent: Tuesday, February 17, 2015 10:13 PM To: 'Postfix users' Subject: RE: transport_maps and tcp_table lookup Hi Wietse, This is a test machine. I was trying to capture the query in that /tmp/spawn file. I get empty lines. I don't think I get a correct query in 127.0.0.1:5555. It connects, gets the echo and closes. I will read more about tcp_table lookups since it appears I didn't understand it, probably not even the role of spawn. I'm trying to add a feature where IP pools can be used for outbound depending on the source domain (sender_dependent_default_transport_maps) and destination domains (transport_maps). I'm quite comfortable with bash and the queries should be forwarded to a local DNS where .localzones will alternate the IPs in each pool and outbound smtp. Is an idea I have to try. Thank you. Marius. -----Original Message----- From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] On Behalf Of Wietse Venema Sent: Tuesday, February 17, 2015 8:27 PM To: Postfix users Subject: Re: transport_maps and tcp_table lookup Marius Gologan: > I other words, I would like to query different tcp_tables per > recipient@domain{1..n}.com <mailto:recipient@domain%7b1..n%7d.com> or > @domain{1..n}.com. Postfix does not query different tables for different domains. This applies to all table types. > 2. I can't get this fixed: Feb 17 19:32:03 test > postfix/trivial-rewrite[2670]: warning: read TCP map reply from > [127.0.0.1]:5555: unexpected EOF (Connection reset by peer) You have a buggy tcp table server. I suggest that you test it by hand first. $ telnet 127.0.0.1 5555 Then send it a query. > #!/bin/bash > echo "$@" >> /tmp/spawn > printf "220 spawn_test:\n" # was echo "220 spawn_test:" > exit 0 First, it is not a good idea to pass random filth from the Internet into shell commands. What happens when the expansion of "$@" starts with a '-' character? Second, spawning bash every time there is a query will severely limit the amount of email you can handle. The tcp_table requires a persistent server. Why do you need TCP table, and why are MySQL, SQLite or LDAP not sufficient? Wietse