Add new configuration directive RELAY_IP_ONLY to only store recipient or

sender relay as Ip addresses. Actually when possible sendmailanalyzer
extract the fqdn part of the relay not the Ip address. Enable this
directive if you just want Ip addresses.
This commit is contained in:
Gilles Darold 2018-12-10 17:21:41 +01:00
parent 797391edb9
commit d6353ee075
4 changed files with 25 additions and 6 deletions

View file

@ -356,6 +356,10 @@ NO_HOST_DOMAIN 0
# this directive to force sendmailanalyzer to take them as sent.
NO_QUEUE_EXCLUSION 0
# When possible sendmailanalyzer extract the fqdn part of the sender or
# recipient relay. Enable this directive if you just want Ip addresses.
RELAY_IP_ONLY 0
};
close(OUTCFG);

5
README
View file

@ -905,6 +905,11 @@ CONFIGURATION
will exclude from report all recipient statistics sent to
bcc-addr1@domain1.com and bcc-addr2@domain2.com
RELAY_IP_ONLY
When possible sendmailanalyzer extract the fqdn part of the sender
or recipient relay. Enable this directive if you just want Ip
addresses.
Domain / user views options
LOW_LIMIT, MEDIUM_LIMIT, HIGH_LIMIT (NO MORE USED)
User messaging data limit in megabytes to show/warn the level of

View file

@ -1070,6 +1070,11 @@ in all destination adresses with $TO =~ /^$EXCLUDE_TO$/. For example:
will exclude from report all recipient statistics sent to bcc-addr1@domain1.com
and bcc-addr2@domain2.com
=item RELAY_IP_ONLY
When possible sendmailanalyzer extract the fqdn part of the sender or
recipient relay. Enable this directive if you just want Ip addresses.
=back
=head2 Domain / user views options

View file

@ -2290,18 +2290,22 @@ sub clean_relay
if ($relay =~ m#\b([a-fA-F0-9\.\:]+) \(may be forged#) {
$relay = $1;
} elsif ($relay =~ m#localhost|127\.0\.0\.1#) {
} elsif ($relay =~ m#localhost|127\.0\.0\.1|::1#) {
return 'localhost';
} elsif ( $relay =~ s/\[([^\]]+)\]// ) {
my $fqdn = $relay;
my $ip = $1;
$fqdn =~ s#:.*##;
if (!$fqdn || ($fqdn eq 'unknown')) {
$relay = $ip;
} elsif ($fqdn =~ /[\s,]/) {
if ($CONFIG{RELAY_IP_ONLY}) {
$relay = $ip;
} else {
$relay = $fqdn;
$fqdn =~ s#:.*##;
if (!$fqdn || ($fqdn eq 'unknown')) {
$relay = $ip;
} elsif ($fqdn =~ /[\s,]/) {
$relay = $ip;
} else {
$relay = $fqdn;
}
}
} elsif ( $relay =~ s/\(([a-fA-F0-9\.\:]+)\)// ) {
$relay = $1;
@ -2964,6 +2968,7 @@ sub read_config
$CONFIG{POSTGREY_NAME} ||= 'postgrey|sqlgrey';
$CONFIG{SPAMD_NAME} ||= 'spamd';
$CONFIG{SPF_DKIM_NAME} ||= 'opendmarc|opendkim';
$CONFIG{RELAY_IP_ONLY} ||= 0;
}
####