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:
- 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).
- Login with root permissions (su or login as root).
- cd into the directory containing the php file.
- Open the file in your favorite editor and alter the two variables mentioned above.
- Type
php qmail-queue-cleaner.phpand 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




