Add support to postfix/policyd-weight antispam. Thanks to Michael Seevogel for the feature request.

This commit is contained in:
Darold Gilles 2013-12-18 23:13:24 +01:00
parent 3227fd768c
commit 872b968106
6 changed files with 50 additions and 18 deletions

View file

@ -224,8 +224,8 @@ POSTGREY_VIEW 1
# List of antispam name separated by a comma used for Spam details view. You may
# want to custom this list to just show menu link on available reports. Default
# list is: spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd
SPAM_TOOLS spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd
# list is: spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd,policydweight
SPAM_TOOLS spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd,policydweight
# Enable/Disable messaging/spam/virus/dsn direction statistics. Default is show.
# On some mailhost this could show wrong information if the direction could

19
README
View file

@ -660,7 +660,7 @@ CONFIGURATION
view. You may want to custom this list to just show menu link on
available reports. Default list is:
spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd
spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd,policydweight
Feel free to remove those you're not using to not see link to empty
report in the menu.
@ -747,10 +747,11 @@ CONFIGURATION
LOCAL_HOST_DOMAIN sysloghost2 domain3.com,domain4.com
MAIL_HUB
FQDN comma separated list of internal mail hubs, aka: where email are
redirected if the host is a gateway. For example: mailhost.mydom.dom
This directive is very important to help SendmailAnalyzer to find
the direction of incoming and outgoing message.
FQDN comma separated list of internal mail hubs, aka: where email
are redirected if the host is a gateway. For example:
mailhost.mydom.dom This directive is very important to help
SendmailAnalyzer to find the direction of incoming and outgoing
message.
MAIL_GW
FQDN comma separated list of MTA gateways where external mail comes
@ -803,10 +804,10 @@ CONFIGURATION
disable this feature.
ADMIN
List of admins username separated by comma that must have full access
to all report. The username is checked again the http REMOTE_USER
environment variable. Default is every one can access, in this case
you may want to add a .htaccess.
List of admins username separated by comma that must have full
access to all report. The username is checked again the http
REMOTE_USER environment variable. Default is every one can access,
in this case you may want to add a .htaccess.
DOMAIN_USER
List of per user domain access control. The first field is the

View file

@ -52,6 +52,7 @@ our %ANTISPAM_NAME = (
'mimedefang' => 'MIMEDefang',
'dnsblmilter' => 'DNSBL-Milter',
'spamd' => 'Spamd',
'policydweight' => 'Policyd-weight',
);
my $CGI = new CGI;

View file

@ -808,7 +808,7 @@ List of antispam name separated by a comma used for Spam details view. You may
want to custom this list to just show menu link on available reports. Default
list is:
spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd
spamdmilter,jchkmail,dnsbl,spamassassin,amavis,mimedefang,dnsblmilter,spamd,policydweight
Feel free to remove those you're not using to not see link to empty report in
the menu.

View file

@ -48,13 +48,15 @@ my $PID_FILE = 'sa_cache.pid';
$SIG{'INT'} = $SIG{'QUIT'} = $SIG{'TERM'} = 'terminate';
our %ANTISPAM_NAME = (
'spamdmilter' => 'Spamd-Milter',
'jchkmail' => 'J-ChkMail',
'dnsbl' => 'RBL Check',
'spamassassin' => 'SpamAssassin',
'amavis' => 'Amavis',
'mimedefang' => 'MIMEDefang',
'spamdmilter' => 'Spamd-Milter',
'jchkmail' => 'J-ChkMail',
'dnsbl' => 'RBL Check',
'spamassassin' => 'SpamAssassin',
'amavis' => 'Amavis',
'mimedefang' => 'MIMEDefang',
'dnsblmilter' => 'DNSBL-Milter',
'spamd' => 'Spamd',
'policydweight' => 'Policyd-weight',
);
# Collect command line arguments

View file

@ -537,6 +537,34 @@ sub parse_sendmail
}
$SPAMDETAIL{$host}{$id}{spam} =~ s/,nt//g;
}
# Parse spam found by postfix/policyd-weight
} elsif ($str =~ m#decided action=DUNNO\s+(.*); rate: ([^;]+); <client=([^>]+)> <helo=([^>]+)> <from=([^>]+)> <to=([^>]+)>; delay.*#) {
my $id = &get_uniqueid();
$SPAM{$host}{$id}{spam} = 'policydweight';
$SPAM{$host}{$id}{date} = $time_st;
$SPAM{$host}{$id}{relay} = &clean_relay($3);
$SPAM{$host}{$id}{from} = &edecode($5);
$SPAM{$host}{$id}{to} = &edecode($6);
if ($CONFIG{SPAM_DETAIL}) {
$SPAMDETAIL{$host}{$id}{date} = $time_st;
$SPAMDETAIL{$host}{$id}{type} = 'policydweight';
$SPAMDETAIL{$host}{$id}{spam} = $1;
$SPAMDETAIL{$host}{$id}{score} = $2;
}
# Parse spam found in cache by postfix/policyd-weight
} elsif ($str =~ m#decided action=DUNNO\s+(.*); rate: ([^;]+); <client=([^>]+)> <helo=([^>]+)> <from=([^>]+)> <to=([^>]+)>; delay.*#) {
my $id = &get_uniqueid();
$SPAM{$host}{$id}{spam} = 'policydweight';
$SPAM{$host}{$id}{date} = $time_st;
$SPAM{$host}{$id}{relay} = &clean_relay($3);
$SPAM{$host}{$id}{from} = &edecode($5);
$SPAM{$host}{$id}{to} = &edecode($6);
if ($CONFIG{SPAM_DETAIL}) {
$SPAMDETAIL{$host}{$id}{date} = $time_st;
$SPAMDETAIL{$host}{$id}{type} = 'policydweight';
$SPAMDETAIL{$host}{$id}{spam} = $1;
$SPAMDETAIL{$host}{$id}{score} = $2;
}
# Parse spam found by dnsbl-milter
} elsif ($str =~ m#^([^:\s]+): Milter: from=([^,]+), reject=(.*)#) {
my $id = $1;