Re: [exim] How to list the queue with FROM, TO and IP of the…

Top Page
Delete this message
Reply to this message
Author: Daniel Bendersky
Date:  
To: John Jetmore
CC: Exim-users
Subject: Re: [exim] How to list the queue with FROM, TO and IP of the sender?
Hi, thanks for the fast reply, and I liked your sugestions. Will be
useful the way you suggest because it can work also to display the helo.

BTW, here is a simple script that I use, that maybe can be implemented
in your scripts:

Of course it need some improvements but is only the revision number 2. ;-)

#!/bin/sh
#
#############################################################################
# exim_mailq_top_senders.sh
#
# Ultimo Cambio : $Author: dbenders $
# Fecha Cambio  : $Date: 2005/06/03 20:09:54 $
# Version       : $Revision: 1.2 $
# Description   : Script para obtener abusadores del Exim según la Cola
# Autor         : Danny Bendersky <dbenders@???>
# Fecha         : 16/05/2005
#
#############################################################################
# Global variables
#############################################################################        



MAX=10

#----------------------------------------------------------------------------
# Main
#----------------------------------------------------------------------------

echo
"============================================================================"
echo "Server:" `hostname`
echo
"----------------------------------------------------------------------------"
echo "Top From's address:"
echo
"----------------------------------------------------------------------------"

/usr/sbin/exiqgrep -b |awk -F'From:' '{print $2}'|awk -F'To:' '{print
$1}'|awk -F'<' '{print $2}'|awk -F'>' '{print $1}'|grep ^.|sort|uniq
--count|sort -nr|head -n$MAX

echo
"----------------------------------------------------------------------------"
echo "Top From's IP's:"
echo
"----------------------------------------------------------------------------"
/usr/sbin/exiqgrep -i |awk '{print "/usr/sbin/exim -Mvh " $1}' | sh|grep
'Received:'|grep -v 'lc-1.netline.cl'|grep -v 'app'|grep -v 'by
mail.netline.cl'|awk -F'[' '{print $2}'|awk -F']' '{print $1}'|grep
^.|sort|uniq --count|sort -nr|head -n$MAX
echo
"============================================================================"
#
#############################################################################
# END OF FILE
#############################################################################

John Jetmore wrote:

>There's an undocumented option in expick called --show-vars. It accepts a
>comma delimited list of internal variables to incorporate in the output
>for each message. Try running this to see what I'm talking about:
>
>exipick --show-vars sender_host_address '$sender_address =~ /adsl.tie.cl/'
>
>(This option is undocumented because it's primarily a debugging aid for
>me, so little things may be out of whack. For instance, I'm not sure what
>happens if you pass it a variable w/ a dollar prefix).
>
>This is clearly near the functionality you want, but it doesn't mix with
>the -b option. If you can suggest a format for using these two options
>together that makes sense I will make it work in exipick. Here's what I
>see as criteria for the format:
>
>1) all on one line (otherwise you ruin the point of -b)
>2) easily parseable w/ cmdline tools (awk, etc) (again, because of -b)
>3) able to handle multiple args to --show-vars
>
>The reason I'm asking for format recommendations is that I never use -b
>(it was inherited from exiqgrep - my site tools are all designed around
>the (DOH! again undocumented!) --flatq output style). I'd like to extend
>the format in a manner that's still useful and usable by ppl who commonly
>use it.
>
>Having played around with -b for a few minutes, I think I would extend it
>like this:
>
>exipick --show-vars sender_host_port,sender_host_address -b
>
>1DeEhT-0006Fm-JO From: <sender@???> To: addr@???;addr@??? Vars: sender_host_port='12345';sender_host_address='127.0.0.1'
>
>That seems to be in keeping with the spirit of -b. Comments?
>
>--John
>
>On Fri, 3 Jun 2005, Daniel Bendersky wrote:
>
>
>
>>Hi, I will like to get from the queue the same information than using:
>>
>>exipick '$sender_address =~ /adsl.tie.cl/' -b
>>
>>but also get the IP's
>>
>>Any suggestion?
>>
>>--
>>Saludos....
>>
>>Daniel Bendersky.
>>
>>------------------------------------------------------------------
>>Daniel Bendersky              Director de Operaciones y Tecnologia
>>dbenders@???                          http://www.netline.cl
>>NETLINE                                  Los Conquistadores # 2426
>>Oficina   : +56 2 410 2600           Providencia, Santiago - CHILE
>>Celular   : +56 9 998 9122               Fax2mail : +56 2 410 2651
>>Voice2mail: +56 2 410 2618
>>           "Success is a journey, not a destination"
>>------------------------------------------------------------------

>>
>>
>>-- ## List details at http://www.exim.org/mailman/listinfo/exim-users ## Exim
>>details at http://www.exim.org/
>>## Please use the Wiki with this list - http://www.exim.org/eximwiki/
>>
>>
>>
>>
>
>
>


--
Saludos....

Daniel Bendersky.

------------------------------------------------------------------
Daniel Bendersky              Director de Operaciones y Tecnologia
dbenders@???                          http://www.netline.cl
NETLINE                                  Los Conquistadores # 2426
Oficina   : +56 2 410 2600           Providencia, Santiago - CHILE
Celular   : +56 9 998 9122               Fax2mail : +56 2 410 2651
Voice2mail: +56 2 410 2618
            "Success is a journey, not a destination"
------------------------------------------------------------------