From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pmg-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id C05181FF39B
	for <inbox@lore.proxmox.com>; Wed, 22 May 2024 09:33:55 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id E13306979;
	Wed, 22 May 2024 09:34:11 +0200 (CEST)
From: Nigel van Keulen <nigel2392@gmail.com>
To: pmg-devel@lists.proxmox.com
Date: Sat, 18 May 2024 16:58:55 +0200
Message-ID: <20240518145855.670-2-nigel2392@gmail.com>
In-Reply-To: <20240518145855.670-1-nigel2392@gmail.com>
References: <20240518145855.670-1-nigel2392@gmail.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  4
 AWL 0.750 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_ADSP_CUSTOM_MED    0.001 No valid author signature,
 adsp_override is CUSTOM_MED
 DMARC_NONE                0.1 DMARC none policy
 FORGED_GMAIL_RCVD 1 'From' gmail.com does not match 'Received' headers
 FREEMAIL_ENVFROM_END_DIGIT 0.25 Envelope-from freemail username ends in digit
 FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider
 GB_FREEMAIL_NUM             1 Freemail spammy address
 GB_GMAIL_NUM                2 Spam from random Gmail address
 KAM_DMARC_NONE 0.25 DKIM has Failed or SPF has failed on the message and the
 domain has no 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_SOFTFAIL 0.665 SPF: sender does not match SPF record (softfail)
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [accept.pm]
X-Mailman-Approved-At: Wed, 22 May 2024 09:34:10 +0200
Subject: [pmg-devel] SPAM: [PATCH pmg-api 1/1] fix: 2971,
 to DKIM signing for OOO messages by using postmaster@<domain> as a
 sender if it is not present.
X-BeenThere: pmg-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Mail Gateway development discussion
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
Cc: Nigel van Keulen <nigel2392@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pmg-devel-bounces@lists.proxmox.com
Sender: "pmg-devel" <pmg-devel-bounces@lists.proxmox.com>

---
 src/PMG/RuleDB/Accept.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/PMG/RuleDB/Accept.pm b/src/PMG/RuleDB/Accept.pm
index e3e39a7..8a6261f 100644
--- a/src/PMG/RuleDB/Accept.pm
+++ b/src/PMG/RuleDB/Accept.pm
@@ -101,8 +101,16 @@ sub execute {
 	PMG::Utils::remove_marks($entity);
 
 	if ($dkim->{sign}) {
+
+		my $mailSender = $msginfo->{sender};
+		if ($mailSender eq '') {
+			my $mailDomain = $msginfo->{domain};
+			$mailSender = "postmaster\@$mailDomain";
+			syslog('info', "%s: No sender found, using default sender: %s", $queue->{logid}, $mailSender);
+		}
+
 	    eval {
-		$entity = PMG::DKIMSign::sign_entity($entity, $dkim, $msginfo->{sender});
+		$entity = PMG::DKIMSign::sign_entity($entity, $dkim, $mailSender);
 	    };
 	    if ($@) {
 		syslog('warning',
-- 
2.43.0.windows.1


_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel