public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api 1/2] dkim: local mail: add Date header
Date: Mon, 10 Mar 2025 19:06:11 +0100	[thread overview]
Message-ID: <20250310180612.21877-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20250310180612.21877-1-s.ivanov@proxmox.com>

The DKIM signing of locally generated mail introduced in
cd011e2 ("reinject_local_mail: sign mails with DKIM based on header")
does not cover the date-header, since it is not added by our stack,
but by postfix/cleanup(8). This trips certain software (e.g.
Thunderbird), and covering 'Date' by the signature is 'highly advised'
by the DKIM-rfc:
https://datatracker.ietf.org/doc/html/rfc6376#section-5.4

Reported in our community forum:
https://forum.proxmox.com/threads/142465/page-2

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/RuleDB/Notify.pm | 2 ++
 src/PMG/SMTP.pm          | 2 ++
 src/PMG/Utils.pm         | 1 +
 3 files changed, 5 insertions(+)

diff --git a/src/PMG/RuleDB/Notify.pm b/src/PMG/RuleDB/Notify.pm
index 95d2ffa..b74675b 100644
--- a/src/PMG/RuleDB/Notify.pm
+++ b/src/PMG/RuleDB/Notify.pm
@@ -8,6 +8,7 @@ use MIME::Head;
 use MIME::Entity;
 use MIME::Words qw(encode_mimewords);
 use Encode qw(decode encode);
+use POSIX qw(strftime);
 
 use PVE::SafeSyslog;
 
@@ -230,6 +231,7 @@ sub execute {
 	From    => $from_header,
 	To      => $to,
 	Subject => encode_mimewords(encode('UTF-8', $subject), "Charset" => "UTF-8"),
+	Date    => strftime("%a, %d %b %Y %T %z", localtime()),
 	Data => encode('UTF-8', $body));
 
     if ($self->{attach} eq 'O') {
diff --git a/src/PMG/SMTP.pm b/src/PMG/SMTP.pm
index 15c8464..77a707a 100644
--- a/src/PMG/SMTP.pm
+++ b/src/PMG/SMTP.pm
@@ -5,6 +5,7 @@ use warnings;
 use IO::Socket;
 use Encode;
 use MIME::Entity;
+use POSIX qw(strftime);
 
 use PVE::SafeSyslog;
 
@@ -286,6 +287,7 @@ EOF
 	Type => 'multipart/report; report-type=delivery-status;',
 	To => $sender,
 	From => $from_header,
+	Date => strftime("%a, %d %b %Y %T %z", localtime()),
 	Subject => 'Undelivered Mail');
 
     $ndr->attach(
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index 3e7adbb..ab0e6ac 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1313,6 +1313,7 @@ sub finalize_report {
 	Type    => ($html && $plaintext) ? 'multipart/alternative' : 'multipart/related',
 	To      => $data->{pmail_raw},
 	From    => $mailfrom,
+	Date    => strftime("%a, %d %b %Y %T %z", localtime()),
 	Subject => bencode_header(decode_entities($title)));
 
     if ($html) {
-- 
2.39.5



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


  reply	other threads:[~2025-03-10 18:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 18:06 [pmg-devel] [PATCH pmg-api 0/2] add Date and Auto-Submitted headers to reports, bounces, notifications Stoiko Ivanov
2025-03-10 18:06 ` Stoiko Ivanov [this message]
2025-03-10 18:06 ` [pmg-devel] [PATCH pmg-api 2/2] local generated mail: add Auto-Submitted header Stoiko Ivanov
2025-07-29 13:53 ` [pmg-devel] applied: [PATCH pmg-api 0/2] add Date and Auto-Submitted headers to reports, bounces, notifications Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250310180612.21877-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal