Chris Johnson
Chris Johnson

Reputation: 2701

postfix tcp_table lookup format

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 ?

Upvotes: 0

Views: 894

Answers (1)

clement
clement

Reputation: 3375

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 [email protected] 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.[email protected] REJECT You are blacklisted

Upvotes: 1

Related Questions