diff --git a/cgi-bin/lang/bg_BG b/cgi-bin/lang/bg_BG
index 7346685..dd7b1a2 100644
--- a/cgi-bin/lang/bg_BG
+++ b/cgi-bin/lang/bg_BG
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Вътрешен -> Вътрешен',
'Internal -> Internet' => 'Вътрешен -> Външен',
'Internet -> Internet' => 'Външен -> Външен',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Отказани потоци',
'Viruses flows' => 'Вирус потоци',
'Virus Detection' => 'Вирус',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Външ -> Външ',
'Int -> Int' => 'Вътр -> Вътр',
'Int -> Ext' => 'Вътр -> Външ',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Потоки на получаване на съобщенията',
'Delivery Direction' => 'Получаване Направление',
'Direction' => 'Направление',
diff --git a/cgi-bin/lang/de_DE b/cgi-bin/lang/de_DE
index e2d5162..80cae19 100644
--- a/cgi-bin/lang/de_DE
+++ b/cgi-bin/lang/de_DE
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Intern -> Intern',
'Internal -> Internet' => 'Intern -> Extern',
'Internet -> Internet' => 'Extern -> Extern',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Ablehnungen durch Regeln',
'Viruses flows' => 'Viren',
'Virus Detection' => 'Viren-Erkennung',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Ext -> Ext',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Ext',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Zustellungs-Richtungen',
'Delivery Direction' => 'Zustellungs-Richtungen',
'Direction' => 'Richtung',
diff --git a/cgi-bin/lang/en_US b/cgi-bin/lang/en_US
index d6d4fbf..1ae965f 100644
--- a/cgi-bin/lang/en_US
+++ b/cgi-bin/lang/en_US
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Internal -> Internal',
'Internal -> Internet' => 'Internal -> External',
'Internet -> Internet' => 'External -> External',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Rejection flows',
'Viruses flows' => 'Viruses flows',
'Virus Detection' => 'Virus',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Ext -> Ext',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Ext',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Message delivery flows',
'Delivery Direction' => 'Delivery Direction',
'Direction' => 'Direction',
diff --git a/cgi-bin/lang/es_ES b/cgi-bin/lang/es_ES
index add11e4..a73a987 100644
--- a/cgi-bin/lang/es_ES
+++ b/cgi-bin/lang/es_ES
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Interno -> Interno',
'Internal -> Internet' => 'Interno -> Externo',
'Internet -> Internet' => 'Externo -> Externo',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Flujo de Rechazados',
'Viruses flows' => 'Flujo de Virus',
'Virus Detection' => 'Virus',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Int -> Int',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Ext',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Distribución de Mensajes',
'Delivery Direction' => 'Dirección de Entrega',
'Direction' => 'Dirección',
diff --git a/cgi-bin/lang/fr_FR b/cgi-bin/lang/fr_FR
index aa39b01..faa6ade 100644
--- a/cgi-bin/lang/fr_FR
+++ b/cgi-bin/lang/fr_FR
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Interne -> Interne',
'Internal -> Internet' => 'Interne -> Externe',
'Internet -> Internet' => 'Externe -> Externe',
+ 'Unknown -> Internal' => 'Inconnu -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Inconnu',
+ 'Unknown -> Internet' => 'Inconnu -> External',
+ 'Internet -> Unknown' => 'External -> Inconnu',
+ 'Unknown -> Unknown' => 'Inconnu -> Inconnu',
'Rejection flows' => 'Flux des Rejets',
'Viruses flows' => 'Flux des Virus',
'Virus Detection' => 'Virus',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Ext -> Ext',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Ext',
+ 'Unk -> Int' => 'Inc -> Int',
+ 'Unk -> Ext' => 'Inc -> Ext',
+ 'Int -> Unk' => 'Int -> Inc',
+ 'Ext -> Unk' => 'Ext -> Inc',
+ 'Unk -> Unk' => 'Inc -> Inc',
'Message delivery flows' => 'Distribution des messages',
'Delivery Direction' => 'Direction de Distribution',
'Direction' => 'Direction',
diff --git a/cgi-bin/lang/it_IT b/cgi-bin/lang/it_IT
index f5e7cf8..34da363 100644
--- a/cgi-bin/lang/it_IT
+++ b/cgi-bin/lang/it_IT
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Interno -> Interno',
'Internal -> Internet' => 'Interno -> Esterno',
'Internet -> Internet' => 'Esterno -> Esterno',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Flussi respinti',
'Viruses flows' => 'Flussi virus',
'Virus Detection' => 'Virus',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Est -> Est',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Est',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Flussi consegna messaggi',
'Delivery Direction' => 'Direzione consegna',
'Direction' => 'Direzione',
diff --git a/cgi-bin/lang/pt_BR b/cgi-bin/lang/pt_BR
index 73833c8..bb21d19 100644
--- a/cgi-bin/lang/pt_BR
+++ b/cgi-bin/lang/pt_BR
@@ -99,6 +99,11 @@
'Interno -> Interno' => 'Interno -> Interno',
'Interno -> Internet' => 'Interno -> Externo',
'Internet -> Internet' => 'Externo -> Externo',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Fluxos de Rejeição',
'Viruses flows' => 'Fluxos de Vírus',
'Virus Detection' => 'Vírus',
@@ -114,6 +119,11 @@
'Ext -> Ext' => 'Ext -> Ext',
'Int -> Int' => 'Int -> Int',
'Int -> Ext' => 'Int -> Ext',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Fluxos de entrega de mensagem',
'Delivery Direction' => 'Direção de Entrega',
'Direction' => 'Direção',
diff --git a/cgi-bin/lang/ru_RU b/cgi-bin/lang/ru_RU
index 9bfec76..31c2ca5 100644
--- a/cgi-bin/lang/ru_RU
+++ b/cgi-bin/lang/ru_RU
@@ -98,6 +98,11 @@
'Internal -> Internal' => 'Внутренее -> Внутренее',
'Internal -> Internet' => 'Внутренее -> Внешнее',
'Internet -> Internet' => 'Внешнее -> Внешнее',
+ 'Unknown -> Internal' => 'Unknown -> Internal',
+ 'Internal -> Unknown' => 'Internal -> Unknown',
+ 'Unknown -> Internet' => 'Unknown -> External',
+ 'Internet -> Unknown' => 'External -> Unknown',
+ 'Unknown -> Unknown' => 'Unknown -> Unknown',
'Rejection flows' => 'Отказано потокам',
'Viruses flows' => 'Вирус в потоке',
'Virus Detection' => 'Вирус',
@@ -113,6 +118,11 @@
'Ext -> Ext' => 'Внеш -> Внеш',
'Int -> Int' => 'Внут -> Внут',
'Int -> Ext' => 'Внут -> Внеш',
+ 'Unk -> Int' => 'Unk -> Int',
+ 'Unk -> Ext' => 'Unk -> Ext',
+ 'Int -> Unk' => 'Int -> Unk',
+ 'Ext -> Unk' => 'Ext -> Unk',
+ 'Unk -> Unk' => 'Unk -> Unk',
'Message delivery flows' => 'Потоки для доставки',
'Delivery Direction' => 'Направление доставки',
'Direction' => 'Направление',
diff --git a/cgi-bin/sa_report.cgi b/cgi-bin/sa_report.cgi
index c153549..85fc4c8 100755
--- a/cgi-bin/sa_report.cgi
+++ b/cgi-bin/sa_report.cgi
@@ -1293,7 +1293,7 @@ sub show_stats
if ($type eq 'messageflow') {
&summarize_messageflow($begin, $end, %period_stats);
- &display_messageflow($x_label);
+ &display_messageflow($hostname, $date, $hour, $x_label);
} elsif ($type eq 'spamflow') {
&summarize_spamflow($begin, $end, %period_stats);
&display_spamflow($x_label);
@@ -1877,37 +1877,37 @@ sub get_postgrey_stat
sub set_direction
{
- my ($id, $i, $hostname) = @_;
+ my ($sender_relay, $recipient_relay, $hostname) = @_;
# By default all mail are considered issued from local computer.
my $direction = 'Int_';
###### Check for sender origine
- if ($STATS{$id}{sender_relay}) {
+ if ($sender_relay) {
# This host is a gateway and it forward mails to an internal hub or outside
if (!$CONFIG{MAIL_GW} && $CONFIG{MAIL_HUB}) {
- if (!grep($STATS{$id}{sender_relay} =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_HUB}))) {
+ if (!grep($sender_relay =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_HUB}))) {
# if message doesn't come from localhost or user defined loca relay it comes from outside
if (exists $CONFIG{LOCAL_HOST_DOMAIN}{$hostname} && ($#{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}} > -1) ) {
- $direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
+ $direction = 'Ext_' if (!grep($sender_relay =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
} elsif (exists $CONFIG{LOCAL_DOMAIN} && ($#{$CONFIG{LOCAL_DOMAIN}} > -1)) {
- $direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
+ $direction = 'Ext_' if (!grep($sender_relay =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
}
}
# This host received all messages from a gateway
} elsif ($CONFIG{MAIL_GW} && !$CONFIG{MAIL_HUB}) {
# If sender relay is the gateway, it comes from outside
- $direction = 'Ext_' if (grep($STATS{$id}{sender_relay} =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW}) ));
+ $direction = 'Ext_' if (grep($sender_relay =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW}) ));
# This host is a hub, it received all messages from a gateway and forward them to other host
} elsif ($CONFIG{MAIL_GW} && $CONFIG{MAIL_HUB}) {
# If sender relay is the gateway, it comes from outside
- $direction = 'Ext_' if (grep($STATS{$id}{sender_relay} =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW})));
+ $direction = 'Ext_' if (grep($sender_relay =~ /$_/i, split(/[\s\t,;]/, $CONFIG{MAIL_GW})));
} else {
# if message doesn't come from localhost or user defined loca relay it comes from outside
if (exists $CONFIG{LOCAL_HOST_DOMAIN}{$hostname} && ($#{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}} > -1) ) {
- $direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
+ $direction = 'Ext_' if (!grep($sender_relay =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}}));
} elsif (exists $CONFIG{LOCAL_DOMAIN} && ($#{$CONFIG{LOCAL_DOMAIN}} > -1)) {
- $direction = 'Ext_' if (!grep($STATS{$id}{sender_relay} =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
+ $direction = 'Ext_' if (!grep($sender_relay =~ /\b$_$/, 'localhost', @{$CONFIG{LOCAL_DOMAIN}}));
}
}
} else {
@@ -1915,24 +1915,24 @@ sub set_direction
}
###### Now check for destination
- if ($STATS{$id}{rcpt_relay}[$i]) {
+ if ($recipient_relay) {
# If the recipient relay is localhost, it should be distributed internally
- if ($STATS{$id}{rcpt_relay}[$i] eq 'localhost') {
+ if ($recipient_relay eq 'localhost') {
$direction .= 'Int';
# If this host is a mail gateway and the recipient relay match one of
# our destination hub lets say it should be distributed internally
- } elsif ($CONFIG{MAIL_HUB} && (grep($STATS{$id}{rcpt_relay}[$i] =~ /$_/, split(/[\s\t,;]/, $CONFIG{MAIL_HUB}) )) ) {
+ } elsif ($CONFIG{MAIL_HUB} && (grep($recipient_relay =~ /$_/, split(/[\s\t,;]/, $CONFIG{MAIL_HUB}) )) ) {
$direction .= 'Int';
# If the recipient relay match any of our local domain
# lets say the mail should be distributed internally
} elsif (exists $CONFIG{LOCAL_HOST_DOMAIN}{$hostname} && ($#{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}} > -1) ){
- if (grep($STATS{$id}{rcpt_relay}[$i] =~ /\b$_$/i, @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}})) {
+ if (grep($recipient_relay =~ /\b$_$/i, @{$CONFIG{LOCAL_HOST_DOMAIN}{$hostname}})) {
$direction .= 'Int';
} else {
$direction .= 'Ext';
}
} elsif (exists $CONFIG{LOCAL_DOMAIN} && ($#{$CONFIG{LOCAL_DOMAIN}} > -1)) {
- if (grep($STATS{$id}{rcpt_relay}[$i] =~ /\b$_$/i, @{$CONFIG{LOCAL_DOMAIN}})) {
+ if (grep($recipient_relay =~ /\b$_$/i, @{$CONFIG{LOCAL_DOMAIN}})) {
$direction .= 'Int';
} else {
$direction .= 'Ext';
@@ -1978,7 +1978,7 @@ sub compute_messageflow
$messaging{nbsender}{"$STATS{$id}{sender}"} = '';
$messaging{nbrcpt}{"$STATS{$id}{rcpt}[$i]"} = '';
$delivery{'total'}++;
- my $direction = &set_direction($id, $i, $hostname);
+ my $direction = &set_direction($STATS{$id}{sender_relay}, $STATS{$id}{rcpt_relay}[$i], $hostname);
$delivery{$direction}++;
$direction .= '_bytes';
$delivery{$direction} += $STATS{$id}{size};
@@ -2073,15 +2073,25 @@ sub summarize_messageflow
$delivery{'Int_Ext'} ||= 0;
$delivery{'Ext_Ext'} ||= 0;
$delivery{'Ext_Int'} ||= 0;
+ $delivery{'Int_Unk'} ||= 0;
+ $delivery{'Unk_Int'} ||= 0;
+ $delivery{'Ext_Unk'} ||= 0;
+ $delivery{'Unk_Ext'} ||= 0;
+ $delivery{'Unk_Unk'} ||= 0;
$delivery{'Int_Int_bytes'} = sprintf("%.2f", $delivery{'Int_Int_bytes'}/$SIZE_UNIT);
$delivery{'Int_Ext_bytes'} = sprintf("%.2f", $delivery{'Int_Ext_bytes'}/$SIZE_UNIT);
$delivery{'Ext_Ext_bytes'} = sprintf("%.2f", $delivery{'Ext_Ext_bytes'}/$SIZE_UNIT);
$delivery{'Ext_Int_bytes'} = sprintf("%.2f", $delivery{'Ext_Int_bytes'}/$SIZE_UNIT);
+ $delivery{'Unk_Int_bytes'} = sprintf("%.2f", $delivery{'Unk_Int_bytes'}/$SIZE_UNIT);
+ $delivery{'Unk_Ext_bytes'} = sprintf("%.2f", $delivery{'Unk_Ext_bytes'}/$SIZE_UNIT);
+ $delivery{'Int_Unk_bytes'} = sprintf("%.2f", $delivery{'Int_Unk_bytes'}/$SIZE_UNIT);
+ $delivery{'Ext_Unk_bytes'} = sprintf("%.2f", $delivery{'Ext_Unk_bytes'}/$SIZE_UNIT);
+ $delivery{'Unk_Unk_bytes'} = sprintf("%.2f", $delivery{'Unk_Unk_bytes'}/$SIZE_UNIT);
}
sub display_messageflow
{
- my ($x_label) = @_;
+ my ($hostname, $date, $hour, $x_label) = @_;
$messaging{inbound_mean} = sprintf("%.2f", $messaging{inbound_bytes} / ($messaging{inbound} || 1));
$messaging{local_inbound_mean} = sprintf("%.2f", $messaging{local_inbound_bytes} / ($messaging{local_inbound} || 1));
@@ -2144,7 +2154,6 @@ sub display_messageflow
my %data = ();
$delivery{total} = $GLOBAL_STATUS{Sent} || 1;
$delivery{total_bytes} = $GLOBAL_STATUS{Sent_bytes} || 1;
- $delivery{lbls} = "$TRANSLATE{'Ext -> Int'}:$TRANSLATE{'Ext -> Ext'}:$TRANSLATE{'Int -> Int'}:$TRANSLATE{'Int -> Ext'}";
$delivery{'Ext_Int_percent'} = sprintf("%.2f", ($delivery{'Ext_Int'}*100) / $delivery{'total'});
$data{$TRANSLATE{'Ext -> Int'}} = $delivery{'Ext_Int_percent'};
$delivery{'Ext_Ext_percent'} = sprintf("%.2f", ($delivery{'Ext_Ext'}*100) / $delivery{'total'});
@@ -2153,6 +2162,34 @@ sub display_messageflow
$data{$TRANSLATE{'Int -> Int'}} = $delivery{'Int_Int_percent'};
$delivery{'Int_Ext_percent'} = sprintf("%.2f", ($delivery{'Int_Ext'}*100) / $delivery{'total'});
$data{$TRANSLATE{'Int -> Ext'}} = $delivery{'Int_Ext_percent'};
+ $delivery{lbls} = "$TRANSLATE{'Ext -> Int'}:$TRANSLATE{'Ext -> Ext'}:$TRANSLATE{'Int -> Int'}:$TRANSLATE{'Int -> Ext'}";
+
+ if ($delivery{'Unk_Int'}) {
+ $delivery{'Unk_Int_percent'} = sprintf("%.2f", ($delivery{'Unk_Int'}*100) / $delivery{'total'});
+ $data{$TRANSLATE{'Unk -> Int'}} = $delivery{'Unk_Int_percent'};
+ $delivery{lbls} .= ":$TRANSLATE{'Unk -> Int'}";
+ }
+ if ($delivery{'Unk_Ext'}) {
+ $delivery{'Unk_Ext_percent'} = sprintf("%.2f", ($delivery{'Unk_Ext'}*100) / $delivery{'total'});
+ $data{$TRANSLATE{'Unk -> Ext'}} = $delivery{'Unk_Ext_percent'};
+ $delivery{lbls} .= ":$TRANSLATE{'Unk -> Ext'}";
+ }
+ if ($delivery{'Int_Unk'}) {
+ $delivery{'Int_Unk_percent'} = sprintf("%.2f", ($delivery{'Int_Unk'}*100) / $delivery{'total'});
+ $data{$TRANSLATE{'Int -> Unk'}} = $delivery{'Int_Unk_percent'};
+ $delivery{lbls} .= ":$TRANSLATE{'Int_Unk'}";
+ }
+ if ($delivery{'Ext_Unk'}) {
+ $delivery{'Ext_Unk_percent'} = sprintf("%.2f", ($delivery{'Ext_Unk'}*100) / $delivery{'total'});
+ $data{$TRANSLATE{'Ext -> Unk'}} = $delivery{'Ext_Unk_percent'};
+ $delivery{lbls} .= ":$TRANSLATE{'Ext_Unk'}";
+ }
+ if ($delivery{'Unk_Unk'}) {
+ $delivery{'Unk_Unk_percent'} = sprintf("%.2f", ($delivery{'Unk_Unk'}*100) / $delivery{'total'});
+ $data{$TRANSLATE{'Unk -> Unk'}} = $delivery{'Unk_Unk_percent'};
+ $delivery{lbls} .= ":$TRANSLATE{'Unk_Unk'}";
+ }
+
my $nbsender = 0;
my $nbrcpt = 0;
if (ref $messaging{nbsender} eq 'HASH') {
@@ -2176,11 +2213,27 @@ sub display_messageflow
| $TRANSLATE{'Message delivery flows'} |
| | $TRANSLATE{'Messages'} | $TRANSLATE{'Size'} ($TRANSLATE{$CONFIG{'SIZE_UNIT'}}) | $TRANSLATE{'Percentage'} |
-| $TRANSLATE{'Internet -> Internal'} | $delivery{'Ext_Int'} | $delivery{'Ext_Int_bytes'} | $delivery{'Ext_Int_percent'} % |
-| $TRANSLATE{'Internet -> Internet'} | $delivery{'Ext_Ext'} | $delivery{'Ext_Ext_bytes'} | $delivery{'Ext_Ext_percent'} % |
-| $TRANSLATE{'Internal -> Internal'} | $delivery{'Int_Int'} | $delivery{'Int_Int_bytes'} | $delivery{'Int_Int_percent'} % |
-| $TRANSLATE{'Internal -> Internet'} | $delivery{'Int_Ext'} | $delivery{'Int_Ext_bytes'} | $delivery{'Int_Ext_percent'} % |
-| |
+| $TRANSLATE{'Internet -> Internal'} | $delivery{'Ext_Int'} | $delivery{'Ext_Int_bytes'} | $delivery{'Ext_Int_percent'} % |
+| $TRANSLATE{'Internet -> Internet'} | $delivery{'Ext_Ext'} | $delivery{'Ext_Ext_bytes'} | $delivery{'Ext_Ext_percent'} % |
+| $TRANSLATE{'Internal -> Internal'} | $delivery{'Int_Int'} | $delivery{'Int_Int_bytes'} | $delivery{'Int_Int_percent'} % |
+| $TRANSLATE{'Internal -> Internet'} | $delivery{'Int_Ext'} | $delivery{'Int_Ext_bytes'} | $delivery{'Int_Ext_percent'} % |
+};
+ print qq {
+| $TRANSLATE{'Unknown -> Internal'} | $delivery{'Unk_Int'} | $delivery{'Unk_Int_bytes'} | $delivery{'Unk_Int_percent'} % |
+} if ($delivery{'Unk_Int'});
+ print qq {
+| $TRANSLATE{'Unknown -> Internet'} | $delivery{'Unk_Ext'} | $delivery{'Unk_Ext_bytes'} | $delivery{'Unk_Ext_percent'} % |
+} if ($delivery{'Unk_Ext'});
+ print qq {
+| $TRANSLATE{'Internal -> Unknown'} | $delivery{'Int_Unk'} | $delivery{'Int_Unk_bytes'} | $delivery{'Int_Unk_percent'} % |
+} if ($delivery{'Int_Unk'});
+ print qq {
+| $TRANSLATE{'Internet -> Unknown'} | $delivery{'Ext_Unk'} | $delivery{'Ext_Unk_bytes'} | $delivery{'Ext_Unk_percent'} % |
+} if ($delivery{'Int_Unk'});
+ print qq {
+| $TRANSLATE{'Unknown -> Unknown'} | $delivery{'Unk_Unk'} | $delivery{'Unk_Unk_bytes'} | $delivery{'Unk_Unk_percent'} % |
+} if ($delivery{'Unk_Unk'});
+ print qq {
@@ -2246,7 +2299,7 @@ sub compute_spamflow
for (my $i = 0; $i <= $#{$STATS{$id}{status}}; $i++) {
next if ($mailbox && ($STATS{$id}{rcpt}[$i] !~ /$mailbox\@/) );
if ($STATS{$id}{status}[$i] eq 'Sent') {
- my $direction = &set_direction($id, $i, $hostname);
+ my $direction = &set_direction($STATS{$id}{sender_relay}, $STATS{$id}{rcpt_relay}[$i], $hostname);
$spam{$direction}++;
$direction .= '_bytes';
$spam{$direction} += $STATS{$id}{size};
@@ -2376,18 +2429,18 @@ sub display_spamflow
|
};
- print &grafit( labels => $spam{lbls}, values => $spam{values},
- title => $TRANSLATE{'Spamming Flow'},
- x_label => $x_label, y_label => $TRANSLATE{'Number of spam'},
- divid => 'spamflow'
- );
- print qq{
+print &grafit( labels => $spam{lbls}, values => $spam{values},
+ title => $TRANSLATE{'Spamming Flow'},
+ x_label => $x_label, y_label => $TRANSLATE{'Number of spam'},
+ divid => 'spamflow'
+);
+print qq{
|
};
- }
+}
print "\n";
@@ -2395,122 +2448,122 @@ print "\n";
sub compute_virusflow
{
- my ($hostname, $mailbox) = @_;
+my ($hostname, $mailbox) = @_;
- my %period_stat = ();
- foreach my $id (keys %STATS) {
- next if ($DOMAIN && ($STATS{$id}{sender} !~ /$DOMAIN/) && !grep(/$DOMAIN/, @{$STATS{$id}{rcpt}}));
- if (exists $STATS{$id}{virus}) {
- $period_stat{virus}{$STATS{$id}{idx_virus}}++;
- $GLOBAL_STATUS{Virus}++;
- $GLOBAL_STATUS{Virus_bytes} += $STATS{$id}{size};
- if ($STATS{$id}{sender_relay} ne 'localhost') {
- $virus{local_inbound}++;
- $virus{local_inbound_bytes} += $STATS{$id}{size} || 0;
- } else {
- $virus{inbound}++;
- $virus{inbound_bytes} += $STATS{$id}{size} || 0;
- }
- for (my $i = 0; $i <= $#{$STATS{$id}{status}}; $i++) {
- next if ($mailbox && ($STATS{$id}{rcpt}[$i] !~ /$mailbox\@/) );
- if ($STATS{$id}{status}[$i] eq 'Sent') {
- my $direction = &set_direction($id, $i, $hostname);
- $virus{$direction}++;
- $direction .= '_bytes';
- $virus{$direction} += $STATS{$id}{size};
- if ($direction =~ /_Int/) {
- $virus{local_outbound}++;
- $virus{local_outbound_bytes} += $STATS{$id}{size} || 0;
- } else {
- $virus{outbound}++;
- $virus{outbound_bytes} += $STATS{$id}{size} || 0;
- }
+my %period_stat = ();
+foreach my $id (keys %STATS) {
+ next if ($DOMAIN && ($STATS{$id}{sender} !~ /$DOMAIN/) && !grep(/$DOMAIN/, @{$STATS{$id}{rcpt}}));
+ if (exists $STATS{$id}{virus}) {
+ $period_stat{virus}{$STATS{$id}{idx_virus}}++;
+ $GLOBAL_STATUS{Virus}++;
+ $GLOBAL_STATUS{Virus_bytes} += $STATS{$id}{size};
+ if ($STATS{$id}{sender_relay} ne 'localhost') {
+ $virus{local_inbound}++;
+ $virus{local_inbound_bytes} += $STATS{$id}{size} || 0;
+ } else {
+ $virus{inbound}++;
+ $virus{inbound_bytes} += $STATS{$id}{size} || 0;
+ }
+ for (my $i = 0; $i <= $#{$STATS{$id}{status}}; $i++) {
+ next if ($mailbox && ($STATS{$id}{rcpt}[$i] !~ /$mailbox\@/) );
+ if ($STATS{$id}{status}[$i] eq 'Sent') {
+ my $direction = &set_direction($STATS{$id}{sender_relay}, $STATS{$id}{rcpt_relay}[$i], $hostname);
+ $virus{$direction}++;
+ $direction .= '_bytes';
+ $virus{$direction} += $STATS{$id}{size};
+ if ($direction =~ /_Int/) {
+ $virus{local_outbound}++;
+ $virus{local_outbound_bytes} += $STATS{$id}{size} || 0;
+ } else {
+ $virus{outbound}++;
+ $virus{outbound_bytes} += $STATS{$id}{size} || 0;
}
}
}
}
- %STATS = ();
- return %period_stat;
+}
+%STATS = ();
+return %period_stat;
}
sub summarize_virusflow
{
- my ($begin, $end, %period_stat) = @_;
+my ($begin, $end, %period_stat) = @_;
- $virus{inbound} ||= 0;
- $virus{local_inbound} ||= 0;
- $virus{outbound} ||= 0;
- $virus{local_outbound} ||= 0;
- $virus{total_inbound} = $virus{inbound} + $virus{local_inbound};
- $virus{total_inbound_bytes} = $virus{inbound_bytes} + $virus{local_inbound_bytes};
- $virus{total_outbound} = $virus{outbound} + $virus{local_outbound};
- $virus{total_outbound_bytes} = $virus{outbound_bytes} + $virus{local_outbound_bytes};
- $virus{total_inbound_bytes} = sprintf("%.2f", $virus{total_inbound_bytes}/$SIZE_UNIT);
- $virus{inbound_bytes} = sprintf("%.2f", $virus{inbound_bytes}/$SIZE_UNIT);
- $virus{local_inbound_bytes} = sprintf("%.2f", $virus{local_inbound_bytes}/$SIZE_UNIT);
- $virus{total_outbound_bytes} = sprintf("%.2f", $virus{total_outbound_bytes}/$SIZE_UNIT);
- $virus{outbound_bytes} = sprintf("%.2f", $virus{outbound_bytes}/$SIZE_UNIT);
- $virus{local_outbound_bytes} = sprintf("%.2f", $virus{local_outbound_bytes}/$SIZE_UNIT);
+$virus{inbound} ||= 0;
+$virus{local_inbound} ||= 0;
+$virus{outbound} ||= 0;
+$virus{local_outbound} ||= 0;
+$virus{total_inbound} = $virus{inbound} + $virus{local_inbound};
+$virus{total_inbound_bytes} = $virus{inbound_bytes} + $virus{local_inbound_bytes};
+$virus{total_outbound} = $virus{outbound} + $virus{local_outbound};
+$virus{total_outbound_bytes} = $virus{outbound_bytes} + $virus{local_outbound_bytes};
+$virus{total_inbound_bytes} = sprintf("%.2f", $virus{total_inbound_bytes}/$SIZE_UNIT);
+$virus{inbound_bytes} = sprintf("%.2f", $virus{inbound_bytes}/$SIZE_UNIT);
+$virus{local_inbound_bytes} = sprintf("%.2f", $virus{local_inbound_bytes}/$SIZE_UNIT);
+$virus{total_outbound_bytes} = sprintf("%.2f", $virus{total_outbound_bytes}/$SIZE_UNIT);
+$virus{outbound_bytes} = sprintf("%.2f", $virus{outbound_bytes}/$SIZE_UNIT);
+$virus{local_outbound_bytes} = sprintf("%.2f", $virus{local_outbound_bytes}/$SIZE_UNIT);
- if (!exists $virus{lbls}) {
- if ($end && ($end ne '60')) {
- foreach ("$begin" .. "$end") {
- $virus{lbls} .= "$_:";
- $virus{values} .= ($period_stat{virus}{"$_"} || 0) . ':';
- }
- } elsif ($end) {
- for (my $i = 5; $i <= 60; $i += 5) {
- $virus{lbls} .= sprintf("%02d", $i) . ":";
- my $count = 0;
- foreach my $b (keys %{$period_stat{virus}}) {
- if ( ($b < $i) && ($b >= ($i - 5)) ) {
- $count += $period_stat{virus}{"$b"};
- }
+if (!exists $virus{lbls}) {
+ if ($end && ($end ne '60')) {
+ foreach ("$begin" .. "$end") {
+ $virus{lbls} .= "$_:";
+ $virus{values} .= ($period_stat{virus}{"$_"} || 0) . ':';
+ }
+ } elsif ($end) {
+ for (my $i = 5; $i <= 60; $i += 5) {
+ $virus{lbls} .= sprintf("%02d", $i) . ":";
+ my $count = 0;
+ foreach my $b (keys %{$period_stat{virus}}) {
+ if ( ($b < $i) && ($b >= ($i - 5)) ) {
+ $count += $period_stat{virus}{"$b"};
}
- $virus{values} .= ($count || 0) . ':';
- }
- } else {
- foreach my $b (split(/:/, $begin)) {
- $virus{lbls} .= "$b:";
- $virus{values} .= ($period_stat{virus}{"$b"} || 0) . ':';
}
+ $virus{values} .= ($count || 0) . ':';
+ }
+ } else {
+ foreach my $b (split(/:/, $begin)) {
+ $virus{lbls} .= "$b:";
+ $virus{values} .= ($period_stat{virus}{"$b"} || 0) . ':';
}
}
- $virus{lbls} =~ s/:$//;
- $virus{values} =~ s/:$//;
+}
+$virus{lbls} =~ s/:$//;
+$virus{values} =~ s/:$//;
- $virus{'Int_Int'} ||= 0;
- $virus{'Int_Ext'} ||= 0;
- $virus{'Ext_Ext'} ||= 0;
- $virus{'Ext_Int'} ||= 0;
+$virus{'Int_Int'} ||= 0;
+$virus{'Int_Ext'} ||= 0;
+$virus{'Ext_Ext'} ||= 0;
+$virus{'Ext_Int'} ||= 0;
}
sub display_virusflow
{
- my ($x_label) = @_;
+my ($x_label) = @_;
- # Viruses flows / Viruses delivery flows / syserr flows
- $virus{inbound_mean} = sprintf("%.2f", $virus{inbound_bytes} / ($virus{inbound} || 1));
- $virus{local_inbound_mean} = sprintf("%.2f", $virus{local_inbound_bytes} / ($virus{local_inbound} || 1));
- $virus{total_inbound_mean} = sprintf("%.2f", $virus{total_inbound_bytes} / ($virus{total_inbound} || 1));
- $virus{outbound_mean} = sprintf("%.2f", $virus{outbound_bytes} / ($virus{outbound} || 1));
- $virus{local_outbound_mean} = sprintf("%.2f", $virus{local_outbound_bytes} / ($virus{local_outbound} || 1));
- $virus{total_outbound_mean} = sprintf("%.2f", $virus{total_outbound_bytes} / ($virus{total_outbound} || 1));
- $virus{Ext_Int_mean} = sprintf("%.2f", $virus{Ext_Int} / ($virus{Ext_Int_bytes} || 1));
- $virus{Int_Int_mean} = sprintf("%.2f", $virus{Int_Int} / ($virus{Int_Int_bytes} || 1));
- $virus{Int_Ext_mean} = sprintf("%.2f", $virus{Int_Ext} / ($virus{Int_Ext_bytes} || 1));
- $virus{Ext_Ext_mean} = sprintf("%.2f", $virus{Ext_Ext} / ($virus{Ext_Ext_bytes} || 1));
- $virus{'Int_Int_bytes'} = sprintf("%.2f", $virus{'Int_Int_bytes'}/$SIZE_UNIT);
- $virus{'Int_Ext_bytes'} = sprintf("%.2f", $virus{'Int_Ext_bytes'}/$SIZE_UNIT);
- $virus{'Ext_Ext_bytes'} = sprintf("%.2f", $virus{'Ext_Ext_bytes'}/$SIZE_UNIT);
- $virus{'Ext_Int_bytes'} = sprintf("%.2f", $virus{'Ext_Int_bytes'}/$SIZE_UNIT);
+# Viruses flows / Viruses delivery flows / syserr flows
+$virus{inbound_mean} = sprintf("%.2f", $virus{inbound_bytes} / ($virus{inbound} || 1));
+$virus{local_inbound_mean} = sprintf("%.2f", $virus{local_inbound_bytes} / ($virus{local_inbound} || 1));
+$virus{total_inbound_mean} = sprintf("%.2f", $virus{total_inbound_bytes} / ($virus{total_inbound} || 1));
+$virus{outbound_mean} = sprintf("%.2f", $virus{outbound_bytes} / ($virus{outbound} || 1));
+$virus{local_outbound_mean} = sprintf("%.2f", $virus{local_outbound_bytes} / ($virus{local_outbound} || 1));
+$virus{total_outbound_mean} = sprintf("%.2f", $virus{total_outbound_bytes} / ($virus{total_outbound} || 1));
+$virus{Ext_Int_mean} = sprintf("%.2f", $virus{Ext_Int} / ($virus{Ext_Int_bytes} || 1));
+$virus{Int_Int_mean} = sprintf("%.2f", $virus{Int_Int} / ($virus{Int_Int_bytes} || 1));
+$virus{Int_Ext_mean} = sprintf("%.2f", $virus{Int_Ext} / ($virus{Int_Ext_bytes} || 1));
+$virus{Ext_Ext_mean} = sprintf("%.2f", $virus{Ext_Ext} / ($virus{Ext_Ext_bytes} || 1));
+$virus{'Int_Int_bytes'} = sprintf("%.2f", $virus{'Int_Int_bytes'}/$SIZE_UNIT);
+$virus{'Int_Ext_bytes'} = sprintf("%.2f", $virus{'Int_Ext_bytes'}/$SIZE_UNIT);
+$virus{'Ext_Ext_bytes'} = sprintf("%.2f", $virus{'Ext_Ext_bytes'}/$SIZE_UNIT);
+$virus{'Ext_Int_bytes'} = sprintf("%.2f", $virus{'Ext_Int_bytes'}/$SIZE_UNIT);
- if (!$virus{total_inbound} && !$virus{total_outbound}) {
- print qq{};
- return;
- }
+if (!$virus{total_inbound} && !$virus{total_outbound}) {
+ print qq{};
+ return;
+}
- print qq {
+print qq {
@@ -2525,8 +2578,8 @@ sub display_virusflow
| |
};
- if ($CONFIG{SHOW_DIRECTION}) {
- print qq{
+if ($CONFIG{SHOW_DIRECTION}) {
+ print qq{
| $TRANSLATE{'Viruses delivery flows'} |
| | $TRANSLATE{'Messages'} | $TRANSLATE{'Size'} ($TRANSLATE{$CONFIG{'SIZE_UNIT'}}) | $TRANSLATE{'Mean'} |
@@ -2569,7 +2622,7 @@ sub compute_dsnflow
for (my $i = 0; $i <= $#{$STATS{$id}{status}}; $i++) {
next if ($mailbox && ($STATS{$id}{rcpt}[$i] !~ /$mailbox\@/) );
if ($STATS{$id}{status}[$i] eq 'Sent') {
- my $direction = &set_direction($id, $i, $hostname);
+ my $direction = &set_direction($STATS{$id}{sender_relay}, $STATS{$id}{rcpt_relay}[$i], $hostname);
$dsn{$direction}++;
if ($direction =~ /_Int$/) {
$dsn{local_outbound}++;
@@ -4290,6 +4343,8 @@ sub get_detail_stat
%lstat = &get_dsnsrc_detail($path, $peri, $search, $hour);
} elsif ($type eq 'postgrey') {
%lstat = &get_postgrey_detail($path, $peri, $search, $hour);
+ } elsif ($type eq 'flow') {
+ %lstat = &get_flow_detail($path, $peri, $search, $hour, $hostname);
} else {
print "BAD DETAIL TYPE\n";
}
@@ -4332,7 +4387,7 @@ sub show_detail
if ($type !~ /spam/) {
print qq{$TRANSLATE{'Status'} | \n};
}
- if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey')) {
+ if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey', 'flow')) {
if ($type eq 'spam') {
print qq{$TRANSLATE{'Spam'} | \n};
} elsif ($type =~ /spam_/) {
@@ -4467,7 +4522,7 @@ sub show_detail
}
print "";
}
- if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey')) {
+ if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey', 'flow')) {
if ($type eq 'spam') {
$lstat{$id}{spam} ||= ' ';
print qq{$lstat{$id}{spam} | };
@@ -4528,7 +4583,7 @@ sub show_download_detail
if ($type !~ /spam/) {
print "$TRANSLATE{'Status'};";
}
- if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey')) {
+ if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey', 'flow')) {
if ($type eq 'spam') {
print "$TRANSLATE{'Spam'};";
} elsif ($type =~ /spam_/) {
@@ -4636,7 +4691,7 @@ sub show_download_detail
}
print ";"
}
- if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey')) {
+ if (!grep(/$type/, 'dsn', 'dsnsrc', 'sender', 'recipient', 'postgrey', 'flow')) {
if ($type eq 'spam') {
print "$lstat{$id}{spam};";
} elsif ($type =~ /spam_/) {
@@ -5370,6 +5425,62 @@ sub get_postgrey_detail
return %local_stat;
}
+sub get_flow_detail
+{
+ my ($path, $peri, $search, $hour, $hostname) = @_;
+
+ my %local_stat = ();
+
+ my $file = "$path/senders.dat";
+ if (open(IN, $file)) {
+ while (my $l = ) {
+ chomp($l);
+ # Format: Hour:Id:Sender:Size:Nrcpts:Relay:Subject
+ my @data = split(/:/, $l);
+ $data[0] =~ /^(\d{2})/;
+ next if (($hour ne '') && ($1 != $hour));
+ $data[2] ||= '<>';
+ $local_stat{$data[1]}{hour} = $data[0];
+ $local_stat{$data[1]}{sender} = $data[2];
+ $local_stat{$data[1]}{size} = $data[3];
+ $local_stat{$data[1]}{nrcpt} = $data[4];
+ $local_stat{$data[1]}{sender_relay} = $data[5];
+ for (my $i = 6; $i <= $#data; $i++) {
+ $local_stat{$data[1]}{subject} .= ($i > 6) ? ':' : '';
+ $local_stat{$data[1]}{subject} .= $data[$i];
+ }
+ }
+ close(IN);
+ }
+
+ $file = "$path/recipient.dat";
+ if (open(IN, $file)) {
+ while (my $l = ) {
+ chomp($l);
+ # Format: Hour:Id:recipient:Relay:Status
+ my @data = split(/:/, $l);
+ $data[0] =~ /^(\d{2})/;
+ next if (($hour ne '') && ($1 != $hour));
+ if ($data[4] eq 'Sent') {
+ my $direction = &set_direction($local_stat{$data[1]}{sender_relay}, $data[3], $hostname);
+ if ($direction eq $search) {
+ push(@{$local_stat{$data[1]}{rcpt}}, $data[2]);
+ push(@{$local_stat{$data[1]}{rcpt_relay}}, $data[3]);
+ push(@{$local_stat{$data[1]}{status}}, $data[4]);
+ }
+ }
+ }
+ close(IN);
+
+ # Eliminate unwanted sender only entries
+ foreach my $k (keys %local_stat) {
+ delete $local_stat{$k} if (!exists $local_stat{$k}{rcpt} || $#{$local_stat{$k}{rcpt}} == -1);
+ }
+ }
+
+ return %local_stat;
+}
+
sub check_auth
{
# Allow if site with no auth or user is an admin
|