From m.seaman@infracaninophile.co.uk  Sat Oct 18 07:04:20 2003
Return-Path: <m.seaman@infracaninophile.co.uk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6737216A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2003 07:04:20 -0700 (PDT)
Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 863EF43FDD
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2003 07:04:17 -0700 (PDT)
	(envelope-from m.seaman@infracaninophile.co.uk)
Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1])
	by smtp.infracaninophile.co.uk (8.12.9p2/8.12.9) with ESMTP id h9IE3cHR066447
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Oct 2003 15:04:08 +0100 (BST)
	(envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk)
Received: (from matthew@localhost)
	by happy-idiot-talk.infracaninophile.co.uk (8.12.9p2/8.12.9/Submit) id h9IE3cO3066446;
	Sat, 18 Oct 2003 15:03:38 +0100 (BST)
	(envelope-from matthew)
Message-Id: <200310181403.h9IE3cO3066446@happy-idiot-talk.infracaninophile.co.uk>
Date: Sat, 18 Oct 2003 15:03:38 +0100 (BST)
From: Matthew Seaman <m.seaman@infracaninophile.co.uk>
Reply-To: Matthew Seaman <m.seaman@infracaninophile.co.uk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [Patch] 460.status-mail-rejects incompatible with FEATURE(delay_checks)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58206
>Category:       conf
>Synopsis:       [Patch] 460.status-mail-rejects incompatible with FEATURE(delay_checks)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 18 07:10:14 PDT 2003
>Closed-Date:    Mon Aug 14 20:00:14 GMT 2006
>Last-Modified:  Mon Aug 14 20:00:14 GMT 2006
>Originator:     Matthew Seaman
>Release:        FreeBSD 4.9-RC i386
>Organization:
Infracaninophile
>Environment:
System: FreeBSD happy-idiot-talk.infracaninophile.co.uk 4.9-RC FreeBSD 4.9-RC #34: Sat Oct 11 18:13:40 BST 2003 root@happy-idiot-talk.infracaninophile.co.uk:/usr/obj/usr/src/sys/HAPPY-IDIOT-TALK i386


>Description:

Adding FEATURE(delay_checks) to the sendmail configuration to permit
that more flexible style of anti-relaying, anti-spam checking has the
unintended consequence that it makes the output of the daily periodic
script 460.status-mail-rejects pretty much meaningless.  Eg. I see
this result with the unmodified script:

Checking for rejected mail hosts:
  35 infracaninophile.co.uk
   1 happy-idiot-talk.infracaninophile.co.uk

whereas I'd expect to see something more like this:

Checking for rejected mail hosts:
   4 [207.62.90.3]
   4 200-221-148-37.internetturboadsl.speeduol.com.br
   2 user-0ccehb8.cable.mindspring.com
   2 node-c-77d2.a2000.nl
   1 x1.namehistory.com
   1 pcp05657719pcs.madsnh01.mi.comcast.net
   1 pcp04168201pcs.macmb101.mi.comcast.net
   1 hx2.netscapw.com
   1 host31.27q.com
   1 hnllhi1-ar7-4-7-215-134.hnllhi1.dsl-verizon.net
   1 h68-144-35-115.cg.shawcable.net
   1 fl-hob-u1-c6a-1-148.pbc.adelphia.net
   1 evrtwa1-ar19-4-41-130-210.evrtwa1.dsl-verizon.net
   1 d235-141-196.home1.cgocable.net
   1 cr2006815553.cable.net.co
   1 c-67-160-208-93.client.comcast.net
   1 c-66-176-46-140.se.client2.attbi.com
   1 adsl-61-66-59-205.KH.sparqnet.net
   1 [64.245.209.18]
   1 [218.7.144.189]
   1 [208.48.233.31]
   1 [168.126.72.243]
   1 CL210-201-162-109.adsl.fx.apol.com.tw
   1 66-108-56-164.nyc.rr.com
   1 218-162-123-184.HINET-IP.hinet.net
   1 200-161-4-30.dsl.telesp.net.br
   1 200-161-21-14.dsl.telesp.net.br
   1 180-210.leased.cust.tie.cl

This ultimately comes down to 'delay_checks' causing all of the
anti-spam checks to be run as part of the check_rcpt ruleset, rather
than the more usual check_mail or check_relay rulesets.  This results
in maillog lines similar to these:

Oct 18 09:45:54 happy-idiot-talk sm-mta[85697]: h9I8jsHQ085697: ruleset=check_rcpt, arg1=<m.seaman@infracaninophile.co.uk>, relay=cpc1-bsfd2-6-0-cust122.cmbg.cable.ntl.com [81.96.158.122], reject=553 5.1.8 <m.seaman@infracaninophile.co.uk>... Domain of sender address mirande_nl@tunese.com does not exist
Oct 18 09:46:26 happy-idiot-talk sm-mta[86389]: h9I8jtHQ086389: ruleset=check_rcpt, arg1=<m.seaman@infracaninophile.co.uk>, relay=cpc1-bsfd2-6-0-cust122.cmbg.cable.ntl.com [81.96.158.122], reject=550 5.7.1 <m.seaman@infracaninophile.co.uk>... Mail from 81.96.158.122 rejected using spamcop.net DNSBL. See http://spamcop.net/w3m?action=checkblock&ip=81.96.158.122
Oct 18 11:11:49 happy-idiot-talk sm-mta[31464]: h9IAAIHQ031464: ruleset=check_rcpt, arg1=<m.seaman@infracaninophile.co.uk>, relay=[207.62.90.3], reject=451 4.1.8 Domain of sender address slabrucherie@cuhsd.k12.ca.us does not resolve

For check_rcpt the 'arg1' value is always the recipient address rather
than the envelope sender address.  In the case of the 'check_rcpt' rule
it would be more worthwhile to print out the 'relay' value.

>How-To-Repeat:

On a machine that handles internet mail traffic, edit
/etc/mail/`hostname`.mc and add:

    FEATURE(delay_checks)dnl

Then rebuild the sendmail.cf and restart sendmail:

    # cd /etc/mail
    # make install
    # make restart-mta

Leave system running for a few days and inspect daily periodic output.

>Fix:

--- 460.status-mail-rejects.diff begins here ---
--- 460.status-mail-rejects.orig	Sat Oct 18 14:30:41 2003
+++ 460.status-mail-rejects	Sat Oct 18 14:35:17 2003
@@ -51,8 +51,8 @@
 		done
 		cat /var/log/maillog
 	    } |
-		perl -ne "print \"\$2\n\"
-		    if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
+		perl -ne "print \$1 eq 'rcpt' ? \"\$4\n\" : \"\$3\n\"
+		    if (/reject=/ and /^$start.*ruleset=check_(\S+),\s+arg1=(<[^@]+@)?([^>,]+).*relay=([^ ,]+)[ ,].*reject=/o);" |
 		sort -f | uniq -ic | sort -fnr | tee /dev/stderr | wc -l)
 	    [ $rc -gt 0 ] && rc=1
 	fi;;
--- 460.status-mail-rejects.diff ends here ---


>Release-Note:
>Audit-Trail:

From: Matthew Seaman <m.seaman@infracaninophile.co.uk>
To: bug-followup@FreeBSD.org, m.seaman@infracaninophile.co.uk
Cc:  
Subject: Re: conf/58206: [Patch] 460.status-mail-rejects incompatible with
 FEATURE(delay_checks)
Date: Mon, 14 Aug 2006 20:42:45 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enigEB4143CE58FB23FF40B914E9
 Content-Type: text/plain; charset=ISO-8859-15
 Content-Transfer-Encoding: quoted-printable
 
 
 Noticed this PR was still open from 2003.  As perl has now been removed
 from the base system, this patch no longer applies.  Please close.
 
 
 --=20
 Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                       Flat 3
 PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                       Kent, CT11 9PW
 
 
 --------------enigEB4143CE58FB23FF40B914E9
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.5 (FreeBSD)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iD8DBQFE4NI78Mjk52CukIwRCFM4AJ9hoMy+1oM6GN7NFj+zga/EbH/qewCfY/dc
 5s2Qo2/WJqJByTnllRn5V1k=
 =oEOM
 -----END PGP SIGNATURE-----
 
 --------------enigEB4143CE58FB23FF40B914E9--
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Aug 14 19:59:55 UTC 2006 
State-Changed-Why:  
Obsoleted by subsequent events. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58206 
>Unformatted:
