Hi, I'm trying to set up a simple policy server described here:
http://www.postfix.org/SMTPD_POLICY_README.html#client_config
I've written a simple server in c++, and have also tried numerous
examples written in Perl, and still can't get it to work. My logs
suggest that the server is never being called.
Here's my setup in main.cf. The server I'm testing is the one with
inet:127.0.0.1:3001. The greylist server works already, but I want to
add another one.
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_rbl_client zen.spamhaus.org,
# reject_rbl_client xbl.spamhaus.org,
check_policy_service inet:127.0.0.1:3001,
check_recipient_access hash:/etc/postfix/greylist_optin
# check_policy_service unix:private/policy <--- Also tried private
Spawn configuration which didn't work
#policy_time_limit = 3600
smtpd_restriction_classes = greylist
My c++ code is roughly this. What I want to do is simply add a header
to all email messages, "Mypol: test123";
void Server1::doListen()
{
_serverSocket.setListener(this);
_serverSocket._address = "localhost";
_serverSocket._port = 3001;
_serverSocket.doListen1();
}
void Server1::addValue(StringMap &a,const std::string &line)
{
int i = line.find("=");
if(i < 0)
return;
std::string key = line.substr(0,i);
a[key] = line.substr(i + 1);
}
void Server1::acceptSocket(SocketHelper *sock)
{
StringMap a;
try
{
std::string line = sock->readLine();
while (line != "")
{
addValue(a, line);
line = sock->readLine();
}
sock->write("action=PREPEND Mypol: test123\n\n");
}
catch (OMException e)
{
}
}
Thanks,
Omar