From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 2E9281FF15E for ; Tue, 25 Feb 2025 00:25:36 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EDDAC11564; Tue, 25 Feb 2025 00:25:33 +0100 (CET) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Tue, 25 Feb 2025 00:24:50 +0100 Message-Id: <20250224232451.399803-6-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250224232451.399803-1-s.ivanov@proxmox.com> References: <20250224232451.399803-1-s.ivanov@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.068 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api 5/7] dkim: signer: degrade missing domain in from header to info X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" 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 --- 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 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel