postfix-mailgraph/postfix-mailgraph.patch

Wed, 08 Feb 2012 20:07:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:07:00 +0200
changeset 588
300d43423c2e
parent 201
3be96a4c8c18
permissions
-rw-r--r--

Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.

     1 Index: mailgraph.cgi
     2 --- mailgraph.cgi.orig	2007-08-29 11:06:01 +0200
     3 +++ mailgraph.cgi	2007-08-29 19:05:41 +0200
     4 @@ -183,13 +183,6 @@
     5  	}
     7  	print <<FOOTER;
     8 -<hr/>
     9 -<table><tr><td>
    10 -<a href="http://mailgraph.schweikert.ch/">Mailgraph</a> $VERSION
    11 -by <a href="http://david.schweikert.ch/">David Schweikert</a></td>
    12 -<td align="right">
    13 -<a href="http://oss.oetiker.ch/rrdtool/"><img src="http://oss.oetiker.ch/rrdtool/.pics/rrdtool.gif" alt="" width="120" height="34"/></a>
    14 -</td></tr></table>
    15  </body></html>
    16  FOOTER
    17  }
    18 Index: mailgraph.cgi
    19 --- mailgraph.pl.orig	2007-08-29 11:06:01.000000000 +0200
    20 +++ mailgraph.pl	2009-04-26 18:06:13.313712038 +0200
    21 @@ -211,6 +211,8 @@
    22              \s
    23              ([-\w\.\@:]+)        # host  -- 6
    24              \s+
    25 +            <[^>]+>              # OSSP fsl log level
    26 +            \s+
    27              (?:\[LOG_[A-Z]+\]\s+)?  # FreeBSD
    28              (.*)                 # text  -- 7
    29              $/x or do
    30 @@ -420,6 +422,7 @@
    31  	print "  --rrd-name=NAME    use NAME.rrd and NAME_virus.rrd for the rrd files\n";
    32  	print "  --rbl-is-spam      count rbl rejects as spam\n";
    33  	print "  --virbl-is-virus   count virbl rejects as viruses\n";
    34 +	print "  --multi-rule-spam  count several typical reject messages as spam\n";
    36  	exit;
    37  }
    38 @@ -432,7 +435,7 @@
    39  		'daemon_pid|daemon-pid=s', 'daemon_rrd|daemon-rrd=s',
    40  		'daemon_log|daemon-log=s', 'ignore-localhost!', 'ignore-host=s@',
    41  		'only-mail-rrd', 'only-virus-rrd', 'rrd_name|rrd-name=s',
    42 -		'rbl-is-spam', 'virbl-is-virus'
    43 +		'rbl-is-spam', 'virbl-is-virus', 'multi-rule-spam'
    44  		) or exit(1);
    45  	usage if $opt{help};
    47 @@ -610,6 +613,18 @@
    48  			elsif($opt{'rbl-is-spam'} and $text    =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 554.* blocked using/) {
    49  				event($time, 'spam');
    50  			}
    51 +			elsif($opt{'multi-rule-spam'} and $text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 554.* Client host rejected: Access denied/) {
    52 +				event($time, 'spam');
    53 +			}
    54 +			elsif($opt{'multi-rule-spam'} and $text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 450.* Helo command rejected: Host not found/) {
    55 +				event($time, 'spam');
    56 +			}
    57 +			elsif($opt{'multi-rule-spam'} and $text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 450.* Sender address rejected: Domain not found/) {
    58 +				event($time, 'spam');
    59 +			}
    60 +			elsif($opt{'multi-rule-spam'} and $text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 450.* Client host rejected: cannot find your hostname/) {
    61 +				event($time, 'spam');
    62 +			}
    63  			elsif($text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: /) {
    64  				event($time, 'rejected');
    65  			}
    66 @@ -628,7 +643,12 @@
    67  			}
    68  		}
    69  		elsif($prog eq 'cleanup') {
    70 -			if($text =~ /^[0-9A-Z]+: (?:reject|discard): /) {
    71 +			if($text =~ /^(?:[0-9A-Z]+: )?milter-reject: /) {
    72 +				if($text =~ /Intercepted/) {
    73 +					event($time, 'virus');
    74 +				}
    75 +			}
    76 +			elsif($text =~ /^[0-9A-Z]+: (?:reject|discard): /) {
    77  				event($time, 'rejected');
    78  			}
    79  		}
    80 @@ -924,6 +944,7 @@
    81   --rrd-name=NAME    use NAME.rrd and NAME_virus.rrd for the rrd files
    82   --rbl-is-spam      count rbl rejects as spam
    83   --virbl-is-virus   count virbl rejects as viruses
    84 + --multi-rule-spam  count several typical reject messages as spam
    86  =head1 DESCRIPTION

mercurial