post Category: Code — Chris @ 2:32 pm — post Comments (0)

Yesterday a mail-server I am responsible for suffered an unintentional DoS from an (unwitting) third-party. Here’s a quick script for Exim4 to clear out a specific domain/user from your mailqueue.

#!/bin/sh

if [ $1 ]; then
                echo "`exim4 -bpru | tr '\n' + | sed -e "s/++/=/g" | tr -d + |
                          tr = '\n' |
                grep "$1" | awk {'print $3'} | xargs exim4 -Mrm |
                         wc -l` E-Mails deleted"
        else
            echo "If you want to delete ALL the `exim4 -bpc` E-Mails on mail queue, give this command:"
            echo "exim4 -bpru | awk {'print $3'} | xargs exim4 -Mrm"
            echo ""
            echo "If you want to delete only mails with an specific sender/recipient, use:"
            echo "$0 [sender/recipient]"
fi

Sorry, no comments yet.

Write Your Comment

Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs will be generated automatically.

You should have a name, right? 
Your email address, I promised I won't tell it to anyone. 
If you have a web site or blog, you can type the URL right here. 
This is where you type your comments. 
Remember my information for the next time I visit.
 

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 4 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a