Package: pflogsumm
Version: 1.1.5-1

the pflogsumm does not count postscreen rejects.

I made a patch for pflogsumm and tested it on wheezy and jessie systems, and
put it on: http://test.fantomas.sk/pflogsumm-postscreen.patch

I'm attaching the patch as well...

--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I wonder how much deeper the ocean would be without sponges.
--- /usr/sbin/pflogsumm	2012-02-06 10:30:42.000000000 +0100
+++ pflogsumm	2017-03-22 18:28:39.613007387 +0100
@@ -713,7 +713,7 @@
 			  \${$msgsPerDay{$revMsgDateStr}}[4]);
     } elsif($cmd eq 'master') {
 	++$masterMsgs{(split(/^.*master.*: /, $logRmdr))[1]};
-    } elsif($cmd eq 'smtpd') {
+    } elsif($cmd eq 'smtpd' || $cmd eq 'postscreen') {
 	if($logRmdr =~ /\[\d+\]: \w+: client=(.+?)(,|$)/) {
 	    #
 	    # Warning: this code in two places!
@@ -1536,14 +1536,14 @@
     # split domain/ipaddr into separates
     # newer versions of Postfix have them "dom.ain[i.p.add.ress]"
     # older versions of Postfix have them "dom.ain/i.p.add.ress"
-    unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2 ||
-           (($domain, $ipAddr) = /^([^\/]+)\/([0-9a-f.:]+)/i) == 2) {
+    unless((($domain, $ipAddr) = /^([^\[]*)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2||
+           (($domain, $ipAddr) = /^([^\/]*)\/([0-9a-f.:]+)/i) == 2) {
 	# more exhaustive method
         ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/;
     }
  
     # "mach.host.dom"/"mach.host.do.co" to "host.dom"/"host.do.co"
-    if($domain eq 'unknown') {
+    if($domain eq "" || $domain eq 'unknown') {
         $domain = $ipAddr;
 	# For identifying the host part on a Class C network (commonly
 	# seen with dial-ups) the following is handy.
@@ -1656,9 +1656,10 @@
 	    # those--incl. stuff that'll screw up subsequent parsing.  So just
 	    # get rid of it right off.
 	    $rejReas =~ s/^(\d{3} <).*?(>:)/$1$2/;
+	    $rejReas =~ s/^(?:\d{3} \d\.\d\.\d )(Protocol error);.*$/$1/;
 	    $rejReas =~ s/^(?:.*?[:;] )(?:\[[^\]]+\] )?([^;,]+)[;,].*$/$1/;
 	    $rejReas =~ s/^((?:Sender|Recipient) address rejected: [^:]+):.*$/$1/;
-	    $rejReas =~ s/(Client host|Sender address) .+? blocked/blocked/;
+	    $rejReas =~ s/(client|Client host|Sender address) .+? blocked/blocked/;
 	} elsif($rejTyp eq "MAIL") {	# *more* special treatment :-( grrrr...
 	    $rejReas =~ s/^\d{3} (?:<.+>: )?([^;:]+)[;:]?.*$/$1/;
 	} else {

Reply via email to