September 4, 2010

How to delete spam comments from wordpress

wordpress | Comments (0) admin @ 12:34 pm

Once you put a blog up you will be the target of many link spammers looking for link juice. You can add a series of plugins to prevent them from clogging your database
but if you’re lazy like me you can delete them once in a while using a simple sql query:

DELETE FROM wp_comments WHERE comment_approved=0;

This deletes all unapproved comments, not necessarily all of them being spam.

February 28, 2010

maildrop whitelists and blacklists

Sysadmin | Comments (0) admin @ 7:50 am

SpamAssassin and greylisting are great tools for reducing the amount of spam thats cluttering our mailboxes, however theres always those false positives that in a business environment can become quite critical.
One of the ways to improve the delivery of important emails is to create whitelists, respectively blacklists, to make sure we are not missing anything vital.
Maildrop has some very nice filtering capabilities, but as with any complex software its easy to make mistakes.
It took me some time to play around, trying to create a whitelist, till I found the lookup function which seems the perfect fit for this.
Heres my new mailfilter config which now has a white/black - list.

SHELL=/bin/sh
SPAM="/path/to/spam/Maildir/"
MAILBOX="/path/to/user/Maildir/"

/^From:.*/
getaddr($MATCH) =~ /^.*/;
MATCH=tolower($MATCH)

if ( lookup($MATCH, "geek.ro-blacklist") )
         to "$SPAM"
if( lookup($MATCH, "geek.ro-whitelist") )
         to "$MAILBOX"
if (/^X-Spam-Status:  *Yes*/)
         to "$SPAM"
to "$MAILBOX"

the geek.ro-whitelist, geek.ro-blacklist files are just regexes to match against the sender’ email address, (e.g. .*@domain\.com), one per line.