* [pmg-devel] [PATCH pmg-api 0/2] add Date and Auto-Submitted headers to reports, bounces, notifications
@ 2025-03-10 18:06 Stoiko Ivanov
2025-03-10 18:06 ` [pmg-devel] [PATCH pmg-api 1/2] dkim: local mail: add Date header Stoiko Ivanov
2025-03-10 18:06 ` [pmg-devel] [PATCH pmg-api 2/2] local generated mail: add Auto-Submitted header Stoiko Ivanov
0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2025-03-10 18:06 UTC (permalink / raw)
To: pmg-devel
the following 2 patches are indepedent, but touch the same areas of code
(thus send as one series).
signing local mail as introduced in PMG 8.2 works in general, but some
DKIM verifiers expect a present Date header to be signed as well (Patch
1/2)
patch 2/2 addresses https://bugzilla.proxmox.com/show_bug.cgi?id=4162 for
the PMG sources - it's been fixed for over a year in context of the
original report (PBS).
minimally tested in my setup.
Stoiko Ivanov (2):
dkim: local mail: add Date header
local generated mail: add Auto-Submitted header
src/PMG/RuleDB/Notify.pm | 4 ++++
src/PMG/SMTP.pm | 4 ++++
src/PMG/Utils.pm | 4 ++++
3 files changed, 12 insertions(+)
--
2.39.5
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pmg-devel] [PATCH pmg-api 1/2] dkim: local mail: add Date header
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
2025-03-10 18:06 ` [pmg-devel] [PATCH pmg-api 2/2] local generated mail: add Auto-Submitted header Stoiko Ivanov
1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2025-03-10 18:06 UTC (permalink / raw)
To: pmg-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pmg-devel] [PATCH pmg-api 2/2] local generated mail: add Auto-Submitted header
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 ` [pmg-devel] [PATCH pmg-api 1/2] dkim: local mail: add Date header Stoiko Ivanov
@ 2025-03-10 18:06 ` Stoiko Ivanov
1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2025-03-10 18:06 UTC (permalink / raw)
To: pmg-devel
following the implementation in the proxmox-sendmail crate:
bcdcb181 ("fix #4162: sys: added `auto-submitted` header to email body")
this patch adds Auto-Submitted headers to the mail generated by PMG
(notifications, reports, bounces). reports and notifications get a
'auto-generated' value set, while bounces 'auto-replied'. The latter
is following postfix' bounces.
see https://www.rfc-editor.org/rfc/rfc3834.html and
https://bugzilla.proxmox.com/show_bug.cgi?id=4162
the header is added after MIME::Entity->build(), because this has a
list of allowed headers that are accepted as arguments:
https://metacpan.org/pod/MIME::Entity#Construction
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/PMG/RuleDB/Notify.pm | 2 ++
src/PMG/SMTP.pm | 2 ++
src/PMG/Utils.pm | 3 +++
3 files changed, 7 insertions(+)
diff --git a/src/PMG/RuleDB/Notify.pm b/src/PMG/RuleDB/Notify.pm
index b74675b..1ed1a20 100644
--- a/src/PMG/RuleDB/Notify.pm
+++ b/src/PMG/RuleDB/Notify.pm
@@ -244,6 +244,8 @@ sub execute {
Type => "message/rfc822",);
}
+ $top->head()->add('Auto-Submitted', 'auto-generated');
+
if ($msginfo->{testmode}) {
my $fh = $msginfo->{test_fh};
print $fh "notify: $self->{to}\n";
diff --git a/src/PMG/SMTP.pm b/src/PMG/SMTP.pm
index 77a707a..3fcfea2 100644
--- a/src/PMG/SMTP.pm
+++ b/src/PMG/SMTP.pm
@@ -290,6 +290,8 @@ EOF
Date => strftime("%a, %d %b %Y %T %z", localtime()),
Subject => 'Undelivered Mail');
+ $ndr->head()->add('Auto-Submitted', 'auto-replied');
+
$ndr->attach(
Data => $ndr_text,
Type => 'text/plain; charset=utf-8',
diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
index ab0e6ac..d4d2b87 100644
--- a/src/PMG/Utils.pm
+++ b/src/PMG/Utils.pm
@@ -1328,6 +1328,9 @@ sub finalize_report {
Type => 'text/plain; charset=utf-8',
Encoding => '8-bit');
}
+
+ $top->head()->add('Auto-Submitted', 'auto-generated');
+
if ($debug) {
$top->print();
return;
--
2.39.5
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-10 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pmg-devel] [PATCH pmg-api 1/2] dkim: local mail: add Date header Stoiko Ivanov
2025-03-10 18:06 ` [pmg-devel] [PATCH pmg-api 2/2] local generated mail: add Auto-Submitted header Stoiko Ivanov
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