mirror of
https://git.proxmox.com/git/pmg-api
synced 2025-10-04 22:28:21 +00:00
dkim: signer: log info instead of die'ing when missing domain
for mail locally generated by PMG the signing sources (envelope-sender, From header) can contain only a local-part (postmaster) or even be empty (envelope-sender). While such mail cannot be sensibly signed, it should be treated as if the domain is not listed in DKIM-domains - by an log message on 'info' level instead of a `die`. the sub with the changed behavior is only used in this module, and sign_entity as external entry-point is only called in eval context, resulting in a log message on level 'warn'. so effectively this change should only reduce log-levels for DKIM failures in these cases from 'warning' to 'info' Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
0cf47f5fcd
commit
98de1f61de
@ -59,9 +59,16 @@ sub signing_domain {
|
|||||||
my $input_domain;
|
my $input_domain;
|
||||||
if ($use_domain eq 'header') {
|
if ($use_domain eq 'header') {
|
||||||
$input_domain = parse_headers_for_signing($entity);
|
$input_domain = parse_headers_for_signing($entity);
|
||||||
|
if (!defined($input_domain)) {
|
||||||
|
syslog('info', "DKIM signing: no domain found in the headers from '$sender_email'");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
my @parts = split('@', $sender_email);
|
my @parts = split('@', $sender_email);
|
||||||
die "no domain in sender e-mail\n" if scalar(@parts) < 2;
|
if (scalar(@parts) < 2) {
|
||||||
|
syslog('info', "DKIM signing: no domain found in '$sender_email'");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
$input_domain = $parts[-1];
|
$input_domain = $parts[-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +114,6 @@ sub parse_headers_for_signing {
|
|||||||
$domain = $addresses[0]->host();
|
$domain = $addresses[0]->host();
|
||||||
}
|
}
|
||||||
|
|
||||||
die "there is no sender in the header\n" if !defined($domain);
|
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user