Feed on Posts or Comments 07 January 2009

Linux mwilliams on 05 Jun 2006 10:24 pm

PHP Based Qmail Queue Spam Cleaner

I used to use qmHandle to delete spam from the Qmail queue. Then it just stopped working…for no apparent reason!

So, I have written a simple PHP program to execute via SSH that takes care of clearing spam out of the remote queue. This is particularly useful if you are hit with a spam injection attack.

This software is offered “as-is” and I am not responsible if you destroy qmail or any other part of your server. Use at your own risk.

***IMPORTANT***
Stop qmail prior to running this program. (i.e. /etc/rc.d/init.d/qmail stop OR service qmail stop)

Only two variables need to be altered, $spamLine (the text you are looking for in spam messages) and $messDir (the location of your qmail queue’s mess dir).

To use, simply:

  1. Upload the file (ftp, sftp, etc) / Download the file (wget, etc) / Create file (pico, vi, etc) in your root user directory (or wherever you want it to be).
  2. Login with root permissions (su or login as root).
  3. cd into the directory containing the php file.
  4. Open the file in your favorite editor and alter the two variables mentioned above.
  5. Type php qmail-queue-cleaner.php and hit [ENTER]

I am offering this for you to use, but I am not supporting it. However, if you have a problem, please post a comment below and I will try to help you as I have time.

Here is the code: http://pastebin.com/761449

If you like this, please share it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Reddit
  • del.icio.us
  • blogmarks
  • Technorati

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply