I’m working on implementing some new, custom features in Postgrey, and needed to test it manually via telnet instead of sending an email every time that I wanted to try it out. Evidently Postfix has a custom protocol for communicating via it’s check_policy_service command (and probably others). By doing a tcpdump, I was able to capture this, which makes it simple to test postgrey, and presumably other similar postfix-compatible programs.
[root@mail1 tmp]# telnet postgrey 10023 Trying 10.20.30.40 ... Connected to postgrey.mydomain.tld (10.20.30.40). Escape character is '^]'. request=smtpd_access_policy protocol_state=RCPT protocol_name=ESMTP client_address=126.96.36.199 client_name=imaspammer.brasiltelecom.net.br helo_name=imaspammerl.brasiltelecom.net.br firstname.lastname@example.org email@example.com queue_id= instance=66cf.46d5964c.0 size=0 sasl_method= sasl_username= sasl_sender= ccert_subject= ccert_issuer= ccert_fingerprint= action=DEFER_IF_PERMIT Temporary Failure - Recipient address rejected - \ Try back in 180 seconds: See http://www.webpipe.net/failedmail.php?domain=somedomain.com ^] telnet> quit Connection closed.
Just telnet to the machine on the port its listening on (you have to be running postgrey with the inet option, not unix sockets). Then copy paste everything between the ‘request=’ line and the first blank line’. Then hit enter and postgrey should reply with an appropriate response.