* [PATCH pmg-api 0/2] small improvements for log-header functionality
@ 2026-06-11 8:56 Stoiko Ivanov
2026-06-11 8:57 ` [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 8:56 UTC (permalink / raw)
To: pmg-devel
patch 1 ensures that pmg-smtp-filter reloads if the parameter is changed
via API (pmgdaemon writes a config-snippet in /run and sends HUP to
pmg-smtp-filter, which reloads it)
patch 2 strips the trailing space the headers currently have.
minimally tested on a container.
Stoiko Ivanov (2):
config: add log-headers to pmg-smtp-filter parameters
pmg-smtp-filter: log-headers: trim trailing whitespace
src/PMG/Config.pm | 1 +
src/bin/pmg-smtp-filter | 1 +
2 files changed, 2 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters
2026-06-11 8:56 [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
@ 2026-06-11 8:57 ` Stoiko Ivanov
2026-06-11 9:06 ` Dominik Csapak
2026-06-11 8:57 ` [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
2026-06-11 10:16 ` superseded: [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
2 siblings, 1 reply; 6+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 8:57 UTC (permalink / raw)
To: pmg-devel
changing this setting via our API (and eventually via GUI) should
notify pmg-smtp-filter that the workers should reload their
configuration.
tested by sending testmails and running:
`pmgsh set /config/mail --log-headers (0|1)`
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/PMG/Config.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 83d687bd..943ae1ea 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1926,6 +1926,7 @@ my $pmg_service_params = {
ndr_on_block => 1,
smtputf8 => 1,
'accept-broken-mime' => 1,
+ 'log-headers' => 1,
},
admin => {
dkim_selector => 1,
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace
2026-06-11 8:56 [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
2026-06-11 8:57 ` [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
@ 2026-06-11 8:57 ` Stoiko Ivanov
2026-06-11 9:09 ` Dominik Csapak
2026-06-11 10:16 ` superseded: [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
2 siblings, 1 reply; 6+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 8:57 UTC (permalink / raw)
To: pmg-devel
Reported-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/bin/pmg-smtp-filter | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 7f9cdb85..7aa5865c 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -714,6 +714,7 @@ sub handle_smtp {
$value = PMG::Utils::decode_rfc1522($value);
# remove non-printable and Unicode format chars to avoid log injection and spoofing
$value =~ s/[^\p{XPosixPrint}]|\p{Cf}/ /g;
+ $value =~ s/^\s+|\s+$//g;;
return encode('UTF-8', substr($value, 0, 512));
};
# separate line on purpose, so the log-tracker does not parse it as an event
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters
2026-06-11 8:57 ` [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
@ 2026-06-11 9:06 ` Dominik Csapak
0 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-06-11 9:06 UTC (permalink / raw)
To: Stoiko Ivanov, pmg-devel
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
On 6/11/26 10:57 AM, Stoiko Ivanov wrote:
> changing this setting via our API (and eventually via GUI) should
> notify pmg-smtp-filter that the workers should reload their
> configuration.
>
> tested by sending testmails and running:
> `pmgsh set /config/mail --log-headers (0|1)`
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> src/PMG/Config.pm | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 83d687bd..943ae1ea 100644
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -1926,6 +1926,7 @@ my $pmg_service_params = {
> ndr_on_block => 1,
> smtputf8 => 1,
> 'accept-broken-mime' => 1,
> + 'log-headers' => 1,
> },
> admin => {
> dkim_selector => 1,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace
2026-06-11 8:57 ` [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
@ 2026-06-11 9:09 ` Dominik Csapak
0 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2026-06-11 9:09 UTC (permalink / raw)
To: Stoiko Ivanov, pmg-devel
depending on the subject, we could still have trailing space, e.g.
if the subject is the output of `perl -e 'print "x"x511; print " ";
print "x";'`
the 512th character is space (but not the at the end pre cutting off)
so it gets printed with space as the last character.
one could argue that this is intended since we probably only
want to trim white space on the actual subject not what we log.
with that said:
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
On 6/11/26 10:56 AM, Stoiko Ivanov wrote:
> Reported-by: Dominik Csapak <d.csapak@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> src/bin/pmg-smtp-filter | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
> index 7f9cdb85..7aa5865c 100755
> --- a/src/bin/pmg-smtp-filter
> +++ b/src/bin/pmg-smtp-filter
> @@ -714,6 +714,7 @@ sub handle_smtp {
> $value = PMG::Utils::decode_rfc1522($value);
> # remove non-printable and Unicode format chars to avoid log injection and spoofing
> $value =~ s/[^\p{XPosixPrint}]|\p{Cf}/ /g;
> + $value =~ s/^\s+|\s+$//g;;
> return encode('UTF-8', substr($value, 0, 512));
> };
> # separate line on purpose, so the log-tracker does not parse it as an event
^ permalink raw reply [flat|nested] 6+ messages in thread
* superseded: [PATCH pmg-api 0/2] small improvements for log-header functionality
2026-06-11 8:56 [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
2026-06-11 8:57 ` [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
2026-06-11 8:57 ` [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
@ 2026-06-11 10:16 ` Stoiko Ivanov
2 siblings, 0 replies; 6+ messages in thread
From: Stoiko Ivanov @ 2026-06-11 10:16 UTC (permalink / raw)
To: pmg-devel
sent a v2 based on Dominik's feedback (thx for testing and reviewing)!
https://lore.proxmox.com/pmg-devel/20260611101513.1150807-1-s.ivanov@proxmox.com/T/#t
On Thu, 11 Jun 2026 10:56:59 +0200
Stoiko Ivanov <s.ivanov@proxmox.com> wrote:
> patch 1 ensures that pmg-smtp-filter reloads if the parameter is changed
> via API (pmgdaemon writes a config-snippet in /run and sends HUP to
> pmg-smtp-filter, which reloads it)
>
> patch 2 strips the trailing space the headers currently have.
>
> minimally tested on a container.
>
> Stoiko Ivanov (2):
> config: add log-headers to pmg-smtp-filter parameters
> pmg-smtp-filter: log-headers: trim trailing whitespace
>
> src/PMG/Config.pm | 1 +
> src/bin/pmg-smtp-filter | 1 +
> 2 files changed, 2 insertions(+)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-11 10:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 8:56 [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
2026-06-11 8:57 ` [PATCH pmg-api 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
2026-06-11 9:06 ` Dominik Csapak
2026-06-11 8:57 ` [PATCH pmg-api 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace Stoiko Ivanov
2026-06-11 9:09 ` Dominik Csapak
2026-06-11 10:16 ` superseded: [PATCH pmg-api 0/2] small improvements for log-header functionality Stoiko Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox