From c6eee8fb7e2ba294afaae402177794247de1957d Mon Sep 17 00:00:00 2001
From: Julien Valroff
Date: Sun, 13 Mar 2011 08:44:39 +0100
Subject: Add greylisting support
---
debian/NEWS.Debian | 12 +
debian/changelog | 4 +-
debian/mailgraph.8 | 10 +-
debian/patches/050_greylist.diff | 261 ++++++++++++++++++++++
debian/patches/051_postgrey.diff | 256 ---------------------
debian/patches/101_dspam-virus-notifications.diff | 2 +-
debian/patches/102_clamav-milter.diff | 2 +-
debian/patches/series | 1 +
8 files changed, 285 insertions(+), 263 deletions(-)
create mode 100644 debian/NEWS.Debian
create mode 100644 debian/patches/050_greylist.diff
delete mode 100644 debian/patches/051_postgrey.diff
diff --git a/debian/NEWS.Debian b/debian/NEWS.Debian
new file mode 100644
index 0000000..9a7bcc7
--- /dev/null
+++ b/debian/NEWS.Debian
@@ -0,0 +1,12 @@
+mailgraph (1.14-9) unstable; urgency=low
+
+ * mailgraph now allows the creation of both RRD and graph for greylisting,
+ supporting postgrey and grossd (contributions to support more greylisting
+ servers are welcome).
+ If you used the --only-mail-rrd and/or --only-virus-rrd options, please make
+ sure you update your configuration for the following new options:
+ --no-mail-rrd Do not update the mail rrd.
+ --no-virus-rrd Do not update the virus rrd.
+ --no-greylist-rrd Do not update the greylist rrd.
+
+ -- Julien Valroff Sun, 13 Mar 2011 08:40:00 +0100
diff --git a/debian/changelog b/debian/changelog
index de6d117..36a9d2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
mailgraph (1.14-9) unstable; urgency=low
* Fix patch to set default location of rrd files (Closes: #617411)
+ * Add patch to create greylisting RRD and graph (supports postgrey and
+ grossd)
- -- Julien Valroff Tue, 08 Mar 2011 21:00:23 +0100
+ -- Julien Valroff Sun, 13 Mar 2011 08:33:07 +0100
mailgraph (1.14-8) unstable; urgency=low
diff --git a/debian/mailgraph.8 b/debian/mailgraph.8
index 9d3c099..3d55ff6 100644
--- a/debian/mailgraph.8
+++ b/debian/mailgraph.8
@@ -42,10 +42,12 @@ Write verbose-log to \fIFILE\fR instead of /var/log/mailgraph.log.
Ignore mail to/from localhost (used for virus scanner).
.IP "\fB--ignore-host=\fIHOST\fR"
Ignore mail to/from \fIHOST\fR (used for virus scanner).
-.IP "\fB--only-mail-rrd\fR"
-Update only the mail rrd.
-.IP "\fB--only-virus-rrd\fR"
-Update only the virus rrd.
+.IP "\fB--no-mail-rrd\fR"
+Do not update the mail rrd.
+.IP "\fB--no-virus-rrd\fR"
+Do not update the virus rrd.
+.IP "\fB--no-greylist-rrd\fR"
+Do not update the greylist rrd.
.IP "\fB--rrd-name=\fINAME\fR"
Use \fINAME\fR.rrd and \fINAME\fR_virus.rrd for the rrd files.
.IP "\fB--rbl-is-spam\fR"
diff --git a/debian/patches/050_greylist.diff b/debian/patches/050_greylist.diff
new file mode 100644
index 0000000..598deb8
--- /dev/null
+++ b/debian/patches/050_greylist.diff
@@ -0,0 +1,261 @@
+Description: Add postgrey and greylisting support to mailgraph
+Author: Alexander Bech
+Origin: http://www.bakarasse.de/pages/en/linux/mailgraph.php
+
+--- a/mailgraph.cgi
++++ b/mailgraph.cgi
+@@ -16,6 +16,7 @@
+ my $points_per_sample = 3;
+ my $ypoints = 160;
+ my $ypoints_err = 96;
++my $ypoints_grey = 96;
+ my $rrd = '/var/lib/mailgraph/mailgraph.rrd'; # path to where the RRD database is
+ my $rrd_virus = '/var/lib/mailgraph/mailgraph_virus.rrd'; # path to where the Virus RRD database is
+ my $tmp_dir = '/var/lib/mailgraph'; # temporary directory where to store the images
+@@ -28,12 +29,14 @@
+ );
+
+ my %color = (
+- sent => '000099', # rrggbb in hex
+- received => '009900',
+- rejected => 'AA0000',
+- bounced => '000000',
+- virus => 'DDBB00',
+- spam => '999999',
++ sent => '000099', # rrggbb in hex
++ received => '009900',
++ rejected => 'AA0000',
++ bounced => '000000',
++ virus => 'DDBB00',
++ spam => '999999',
++ greylisted => '999999',
++ delayed => '006400',
+ );
+
+ sub rrd_graph(@)
+@@ -151,6 +154,36 @@
+ );
+ }
+
++sub graph_grey($$)
++{
++ my ($range, $file) = @_;
++ my $step = $range*$points_per_sample/$xpoints;
++ rrd_graph($range, $file, $ypoints_grey,
++ "DEF:greylisted=$rrd_greylist:greylisted:AVERAGE",
++ "DEF:mgreylisted=$rrd_greylist:greylisted:MAX",
++ "CDEF:rgreylisted=greylisted,60,*",
++ "CDEF:dgreylisted=greylisted,UN,0,greylisted,IF,$step,*",
++ "CDEF:sgreylisted=PREV,UN,dgreylisted,PREV,IF,dgreylisted,+",
++ "CDEF:rmgreylisted=mgreylisted,60,*",
++ "AREA:rgreylisted#$color{greylisted}:Greylisted",
++ 'GPRINT:sgreylisted:MAX:total\: %8.0lf msgs',
++ 'GPRINT:rgreylisted:AVERAGE:avg\: %5.2lf msgs/min',
++ 'GPRINT:rmgreylisted:MAX:max\: %4.0lf msgs/min\l',
++
++ "DEF:delayed=$rrd_greylist:delayed:AVERAGE",
++ "DEF:mdelayed=$rrd_greylist:delayed:MAX",
++ "CDEF:rdelayed=delayed,60,*",
++ "CDEF:ddelayed=delayed,UN,0,delayed,IF,$step,*",
++ "CDEF:sdelayed=PREV,UN,ddelayed,PREV,IF,ddelayed,+",
++ "CDEF:rmdelayed=mdelayed,60,*",
++ "LINE2:rdelayed#$color{delayed}:Delayed ",
++ 'GPRINT:sdelayed:MAX:total\: %8.0lf msgs',
++ 'GPRINT:rdelayed:AVERAGE:avg\: %5.2lf msgs/min',
++ 'GPRINT:rmdelayed:MAX:max\: %4.0lf msgs/min\l',
++ );
++}
++
++
+ sub print_html()
+ {
+ print "Content-Type: text/html\n\n";
+@@ -180,6 +213,7 @@
+ print "$graphs[$n]{title}
\n";
+ print "
\n";
+ print "
\n";
++ print "
\n";
+ }
+
+ print <