Re: [exim] Need a little unix help

Top Page
Delete this message
Reply to this message
Author: W B Hacker
Date:  
To: exim users
Subject: Re: [exim] Need a little unix help
Marc Perkel wrote:
> Some of you I'm srue are experts at this. I can probably get something
> to work but I want to do it right. And it's fairly simple.
>
> What I want to do is create a simple client/server application where
> clients running Exim can easily report IP addresses to the server.
> The server will accept the IP addresses and execute a command to add the IP
> address to a MySQL database and increment a counter. What I'm
> specifically doing is counting spam/ham based on IP address. But - if I
> can just receive the IP address I'll figure put how to process it.
>
> I have xinentd if that maes things easy.
>
> On the client side I want to in an efficient way be able to pass a
> string containing the IP address to the server. Maybe talk to an open port?
>
> So - what's the simplest way to accomplish this?
>
>


It seems you would want near-real-time posting of those IP.

Since you said that your 'target' is a MySQL DB, you might want to simply use
SQL to write them directly into the DB from within an acl.

There are examples available in SQL greylisting code - not cut-and-paste usable,
but which you should be able to readily adapt to your needs.

An Exim MACRO from Toleff Fog Heen is illustrative of the 'INSERT' code concept:

GRAYLIST_ADD  = INSERT INTO relaytofrom (relay_ip, from_domain) \
                  VALUES ( '${quote_mysql:$sender_host_address}', \
                  '${quote_mysql:$sender_address_domain}')


One might add timestamps and an autoincrementing 'serial' field, then a trigger
on the count if MySQL has triggers Else PostgreSQL sells for the same price, and
does have.

Note that 'read' privileges are not enough, so make sure that any other SQL code
is resistant to exploits that could modify the DB improperly.

I suspect this would run faster if you used something simpler than an SQL DB.

HTH,

Bill