Yet more notes on a Greylist implementation

It was bad enough getting up early this morning to cover the phones (Smirk and P were heading out of the area for several meetings) but to wake up to a customer (who had gotten my cell phone number when I called him yesterday) complaining about bandwidth issues (and yes, their 100Mbps (Megabites per second) connection is slower than a 56Kbps (Kilobits per second) modem) made it all the worse.

After dealing with that issue (turned out to be a problem with The Monopolistic Phone Company, but it took several hours to diagnose that problem) I turned to what I had originally planned on doing today, working on the greylist daemon [1].

I managed to fix the problem with fork() [2]. The code I used for this daemon I borrowed from a previous daemon, which set each open file to be closed when calling exec(). I removed that code, it worked on the server. I'm not calling exec() (I am calling fork(), but I don't know why marking files to be closed on exec() would have an ill effect, but it did, so it went).

Go figure.

I also wrote an interesting frontend to the daemon, which is called gld_mcp (short for “Graylist Daemon Master Control Program”). Prior to this, I had to send a variety of signals (as root—otherwise I don't have the appropriate permissions), and check the system log files to get any information out of the daemon. Now, I can do:

>
```
gld-mcp>show stats
Start: Fri Sep 14 20:58:16 2007
End: Fri Sep 14 21:10:37 2007
Running time: 12m 21s
Tuples: 33
IPs: 46
Graylisted: 14
Whitelisted: 19
Graylist-Expired: 0
Whitelist-Expired: 0
gld-mcp>
```

without having to be root or grovelling through system log files. (By the way, the IPs: field is the number of entries in the IP (Internet Protocol) whitelist; any email coming from an IP address that matches an entry in this table is automatically let through)

Since I changed the program to check the creation time instead of the last access time [3], only a few more spams have gotten through, but the issue of maybe never getting a legitimate email has gone away, which is good.

And it wasn't a totally bad day—at least the phones were quiet.

[1] /boston/2007/09/11.1

[2] /boston/2007/09/06.1

[3] /boston/2007/09/11.1

Gemini Mention this post

Contact the author