Sunday, June 11, 2006

exim and qmail

A month or so back, I installed logwatch on our main server and from the very beginning I was seeing some weird stuff. The strangest thing being that apparently exim was holding onto a huge queue of mail but we don't use exim on the server. Initially, I assumed that this was mail from when we first started up the server and before qmail was installed, and so I ignored it. Of course, checking the logwatch output a little closer, I noticed that the queue kept growing! So I sat down determined to figure out what was happening. It turns out that a lot of applications by default use sendmail as their mailer and /usr/sbin/sendmail turned out to be a symbolic link to /usr/sbin/exim. Some of these applications where trying to send mail locally to lists.evolt.org or evolt.org and exim was puking on the fact that this was supposed to be delivered locally but exim wasn't setup to handle local delivery. What we needed was for exim to send the mail to qmail for processing.

In /etc/exim/exim.conf, I added the following to the "routers" section:

passToQmail:
driver = domainlist
transport = local_smtp
route_list = *evolt.org lists.evolt.org byname
self = send

and since order matters in this section, it needs to come before the "lookuphost" router. Anything addressed to *evolt.org will use the local_smtp transport. So we need to add the following to the "transports" section:

local_smtp:
driver = smtp
port = 25

to convince exim to re-send local mail to port 25 where qmail is waiting for it.

Once that was done, I flushed the queue and some 3000+ messages flooded the content list and the root user account dating back to Oct 2005 when we switched platforms. Of course, then it was up to me to sift out the spam and reply to the real mail from users. I only got one hate mail back because of the late replies.