[pmg-devel] [PATCH pmg-api 5/7] dkim: signer: degrade missing domain in from header to info
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Feb 25 00:24:50 CET 2025
for mail locally generated by PMG the From header can contain only a
local-part (postmaster).
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 potential for regression
should not be too high.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/DKIMSign.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/PMG/DKIMSign.pm b/src/PMG/DKIMSign.pm
index 6f309c8..be8f1d0 100644
--- a/src/PMG/DKIMSign.pm
+++ b/src/PMG/DKIMSign.pm
@@ -59,6 +59,10 @@ sub signing_domain {
my $input_domain;
if ($use_domain eq 'header') {
$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 {
my @parts = split('@', $sender_email);
die "no domain in sender e-mail\n" if scalar(@parts) < 2;
@@ -107,7 +111,6 @@ sub parse_headers_for_signing {
$domain = $addresses[0]->host();
}
- die "there is no sender in the header\n" if !defined($domain);
return $domain;
}
--
2.39.5
More information about the pmg-devel
mailing list