[Logwatch-Devel] sendmail updates

mark@winksmith.com mark@winksmith.com
Sat, 10 May 2003 00:12:54 -0400


--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

i'm using the professional sendmail version of sendmail.
i added some changes to the scripts/services/sendmail
script.

i've added fields for:

	unknown users
	user unknown returns
	save mail panic's
	remote protocol error
	return receipt requests
	mail rejections due to access database

diff -c is attached.

-- 
Mark Smith
mark at winksmith dot com
mark at tux dot org

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=ddd

*** sendmail-4.3.2	Fri May  9 22:23:59 2003
--- sendmail-new	Fri May  9 23:16:24 2003
***************
*** 15,25 ****
--- 15,32 ----
  $BytesTransferred = 0;
  $HourReturns = 0;
  $DaysReturns = 0;
+ $UserUnknown = 0;
+ $ReturnUserUnknown = 0;
+ $TLSAcceptFailed = 0;
+ $SaveMailPanic = 0;
+ $RemoteProtocolError = 0;
+ $ReturnReceipt = 0;
  
  my %relay;
  my %abuse;
  my %largeHdrs;
  my %notLocal;
+ my %MailRejected;
  
  while (defined($ThisLine = <STDIN>)) {
     ($QueueID) = ($ThisLine =~ m/^([a-zA-Z0-9]+): / );
***************
*** 132,137 ****
--- 139,159 ----
        $ETRNs{$ETRN}++;
     } elsif ( $ThisLine =~ /rejecting connections on daemon MTA: load average: ([0-9]+)/ ) {
        $LoadAvg{$1}++;
+    } elsif ($ThisLine=~ /reject=.*MESSAGE NOT ACCEPTED - (.+)/) {
+       chomp($host=$1);
+       $MailRejected{$host}++;
+    } elsif ($ThisLine=~ /DSN: User unknown/) {
+       $UserUnknown++;
+    } elsif ($ThisLine=~ /return to sender: User unknown/) {
+       $ReturnUserUnknown++;
+    } elsif ($ThisLine=~ /TLS: error: accept failed/) {
+       $TLSAcceptFailed++;
+    } elsif ($ThisLine=~ /savemail panic/) {
+       $SaveMailPanic++;
+    } elsif ($ThisLine=~ /DSN: Return receipt/) {
+       $ReturnReceipt++;
+    } elsif ($ThisLine=~ /Remote protocol error/) {
+       $RemoteProtocolError++;
     } else {
        $ThisLine =~ s/.*\: (DSN\: .*)/$1/;   
        $ThisLine =~ s/.*\: (postmaster notify\: .*)/$1/;
***************
*** 162,169 ****
     print "\n\n" . $DaysReturns . " messages returned after " . $NumDays . " days";
  }
  
! if ($UserUnknown > 0) {
!    print "\n\n" . $UserUnknown . " unidentified unknown users";
  }
  
  if (keys %ETRNs) {
--- 184,211 ----
     print "\n\n" . $DaysReturns . " messages returned after " . $NumDays . " days";
  }
  
! if($TLSAcceptFailed > 0) {
!    print "\n\n" . $TLSAcceptFailed . " TLS Accept Fail(s)";
! }
! 
! if($UserUnknown > 0) {
!    print "\n\n" . $UserUnknown . " DSN User Unknown notifications";
! }
! 
! if($ReturnUserUnknown > 0) {
!    print "\n\n" . $ReturnUserUnknown . " Returned messages due to unknown user";
! }
! 
! if($SaveMailPanic > 0) {
!    print "\n\n" . $SaveMailPanic . " Save Mail Panic's";
! }
! 
! if($RemoteProtocolError > 0) {
!    print "\n\n" . $RemoteProtocolError . " Remote Protocol Errors's";
! }
! 
! if($ReturnReceipt > 0) {
!    print "\n\n" . $ReturnReceipt . " Return Receipt's";
  }
  
  if (keys %ETRNs) {
***************
*** 268,273 ****
--- 310,322 ----
     }
  }
  
+ if (keys %MailRejected) {
+   print "\n\nMail was rejected because of the following entries in the access database:\n";
+   foreach $ThisOne (sort keys %MailRejected) {
+       printf "    %-50s : %3i Time(s)\n" , $ThisOne , $MailRejected{$ThisOne};
+    }
+ }
+ 
  if (keys %relay) {
     print "\n\nWe do not relay for these (host,ruser,luser):\n";
     foreach $host (sort keys %relay) {

--qMm9M+Fa2AknHoGS--