Apache::Qpsmtpd to the rescue

Phred on 2005-12-08T07:33:48

I use Qpsmtpd as my MTA, and it's done a great job over the past couple of years. I've been using tcpserver to handle the connections which has worked out pretty well. I had to up the concurrency limit a few months ago to 50 because spammer bots were hogging up too many connections and slowing the service down.

So today it slowed down again, the bots had used up all 50 connections. Bah. I reached for Apache::Qpsmtpd, Matt Sergeant's module which uses mod_perl2 running under Apache 2.0 to do the connection handling. I added the following virtual host as a config file in my apache config dir to test it out on port 2525 first:

  Listen 0.0.0.0:2525
  
    use lib qw( /home/smtpd/qpsmtpd/lib );
    use Apache::Qpsmtpd;
  
  
    ErrorLog logs/qp.error_log
    CustomLog logs/qp.access_log combined
    PerlSetVar QpsmtpdDir /home/smtpd/qpsmtpd
    PerlModule Apache::Qpsmtpd
    PerlProcessConnectionHandler Apache::Qpsmtpd
  

I telneted to port 2525 on the server, did a quick run through, then double checked by reconfiguring my Thunderbird SMTP setting to use port 2525, and sent a couple of emails through. The emails came through fine so I changed the config to port 25, removed the qpsmtpd daemontools symlink, sent a kill signal to all smtpd processes, and restarted apache. Apache took over the connection handling and there was a noticable performance increase. No delay sending email while the bots were getting bounced by Apache. Gotta love it :)