From alan@agora.rdrop.com  Mon Nov 11 12:14:33 2002
Return-Path: <alan@agora.rdrop.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5DD5137B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Nov 2002 12:14:33 -0800 (PST)
Received: from agora.rdrop.com (agora.rdrop.com [199.26.172.34])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 091A443E75
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Nov 2002 12:14:33 -0800 (PST)
	(envelope-from alan@agora.rdrop.com)
Received: from agora.rdrop.com (202@localhost [127.0.0.1])
	by agora.rdrop.com (8.12.5/8.12.2) with ESMTP id gABKERrQ017924
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 11 Nov 2002 12:14:27 -0800 (PST)
	(envelope-from alan@agora.rdrop.com)
Received: (from alan@localhost)
	by agora.rdrop.com (8.12.5/8.12.2/Submit) id gABKER3V017923;
	Mon, 11 Nov 2002 12:14:27 -0800 (PST)
Message-Id: <200211112014.gABKER3V017923@agora.rdrop.com>
Date: Mon, 11 Nov 2002 12:14:27 -0800 (PST)
From: Alan Batie <alan@agora.rdrop.com>
Reply-To: Alan Batie <alan@agora.rdrop.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: daily rejected mail hosts report too long
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45222
>Category:       conf
>Synopsis:       [patch] daily rejected mail hosts report too long
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 11 12:20:01 PST 2002
>Closed-Date:    
>Last-Modified:  Sat Jun 16 00:07:38 GMT 2007
>Originator:     Alan Batie
>Release:        FreeBSD 4.7-PRERELEASE i386
>Organization:
RainDrop Laboratories
>Environment:
System: FreeBSD agora.rdrop.com 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #0: Tue Sep 3 00:09:20 PDT 2002 root@agora.rdrop.com:/usr/src/freebsd/src/sys/compile/AGORA i386


	
>Description:
	The daily mail reject report runs around 300 lines on my system,
	which makes it a pain to get to the rest of the daily report.
>How-To-Repeat:
	Wait just a little too long to put in the anti-relay filter in
	sendmail way back before it was in by default, so your system
	gets listed in spam software as a relay, though I doubt that's
	a requirement these days.
>Fix:

	I added a variable to limit the length of the output the top N
	reportees.

*** 460.status-mail-rejects.org	Mon Nov 11 12:01:16 2002
--- 460.status-mail-rejects	Mon Nov 11 12:06:09 2002
***************
*** 32,37 ****
--- 32,42 ----
  	    echo
  	    echo Checking for rejected mail hosts:
  
+ 	    if [ "$daily_status_mail_rejects_limit" -le 0 ]
+ 	    then
+ 		daily_status_mail_rejects_limit=10
+ 	    fi
+ 
  	    start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
  	    n=$(($daily_status_mail_rejects_logs - 2))
  	    rc=$({
***************
*** 50,56 ****
  	    } |
  		perl -ne "print \"\$2\n\"
  		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
! 		sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
  	    [ $rc -gt 0 ] && rc=1
  	fi;;
  
--- 55,61 ----
  	    } |
  		perl -ne "print \"\$2\n\"
  		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
! 		sort -f | uniq -ic | sort -fnr | head -n $daily_status_mail_rejects_limit | tee /dev/stderr | wc -l)
  	    [ $rc -gt 0 ] && rc=1
  	fi;;
  


>Release-Note:
>Audit-Trail:

From: Gregory Shapiro <gshapiro@freebsd.org>

Unfortunately, your patch breaks a couple of things:

1. The count created by the `wc -l` at the end of the pipeline is now
simply the value of $daily_status_mail_rejects_limit instead of the true
count of rejected messages.

2. The patch method eliminates the ability to see all of the rejects for
those who wish to maintain the current behavior.

>Unformatted:
