Question

I'm trying to learn / understand more about postfix tcp_table lookup interface and I'm having a difficult time understanding exactly what the reply format should be.

There is clear documentation that the request/ return format is

XXX SPACE *text* NEWLINE 

but it's really unclear to me what the text is or could be. Could someone point me to something more with a little more detail ?

Was it helpful?

Solution

The following python script(simple tcp server)just returns REJECT User is blacklisted for any data it receive.

import SocketServer

class MyTCPHandler(SocketServer.BaseRequestHandler):
  def handle(self):
    self.data = self.request.recv(1024).strip()
    print "{} wrote:".format(self.client_address[0])
    print self.data
    # reply data
    data = '200 REJECT%20User%20is%20blacklisted\n'
    self.request.send(data)

if __name__ == "__main__":
  HOST, PORT = "localhost", 9999
  server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
  server.serve_forever()

After starting the server, You can query this as

[clement@myhost ~]$ postmap -q user@domain.com tcp:localhost:9999
REJECT User is blacklisted

So the text is the string that returns some human readable description.It is the same text you sepcify in your access table. Eg.user@domain.tld REJECT You are blacklisted

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top