[Mimedefang] Greylisting questions..

Gordon Henderson gordon at drogon.net
Fri Feb 2 06:03:57 EST 2007


I've implemented Greylisting on a test server. I had a look and
initially found this:

   http://www.mimedefang.org/kwiki/index.cgi?GreyListiningSQLite

Which got me off to a great start, but then I had a look at what it was 
doing and was somewhat confused... This code seems to delete the entry 
from the database right after a successful email transaction (ie. one that 
got 451'd, waitied then was sent successfully).

I'm not sure this is right... If so, it would seem that when someone sent 
a second email from/to the same addresses then it would get blocked again 
for 10 minutes.

And I couldn't work out what it was doing with the messageid - but (feel 
free to correct me on this!) maybe it's not a message id, as that's not 
actually been transmitted into the system by the point...

So I changed it round a bit...

The first thing I did was to store the timestamp as an unsigned integer. I 
guess this might make it go a bit faster. I hate textual timestamp 
handling, give me a time_t every time... Maybe I'm missing something here, 
but it seems to make arithmetic and comparisons easier too...

Now, I just store the triple and a timestamp (of now + 10 miuntes), then 
when I see the triple again, I continue to 451 it until now >= stored 
timestamp.

At that point, I set the timestamp to 0 which efectively whitelists it 
forever and let it through. (Although I'm considering keeping a count)

Is this a good thing to do?

I still have a reaper process which purges entries from the database if 
it hasn't been "used" for over a day.

And well, so-far so good, but I'd appreciate any comments about my 
methods...

My code is at: http://www.drogon.net/greylisting/ for anyone who cares!

Thanks,

Gordon

Ps. It's quite depressing looking at the stats - I'm seeing over 96% of 
messages through the test server as greylist failures - ie. spam )-:



More information about the MIMEDefang mailing list